Hi.
Got a little challenge I hope you guys can help me with.
But first, a little back ground……..
I built another target system about 5 yrs ago, pretty basic, single sensor & that was my introduction to Arduino systems.
Thread here - Introducing a proximity sw as an end to the loop
My back ground is mechanical, not electrical (Machinist turned Mech Engineer)
So, onto the current project.
Ive recently re-discovered my fettish for Archery & my involvement with the local club has me thinking….no obsessing with developing an interactive system to go on some 3D targets.
The plan is to use a couple of sensors & wifi to sense impacts & movement.
Depending on which sensor is triggered, the mp3 will play a different sound for each.
1st is a walk up sensor, where it (PIR sensor) is triggered as people aproach the location - This triggers a soft sounding feeding noise or that of an animal rooting around in the bush, before you can see the target.
2nd is an accelerometer on the back of the 3D target which picks up the Arrow impact - this triggers a distress type squeal (Pig), a Roar (Bear) or Bleat (Goat) etc,
3rd is another PIR sensor in the central unit that will pick up an Arrow in flight (If this is possible). The purpose of this one is to set up an “IF” scenario in the code. “IF” Arrow detected & Vibration not detected = a miss. The mp3 then plays a “fail” type sound, like on a game show BZZZZT! type sound or Southpark, HaHa! I would have 3-4 of these sounds & be set to play in a random order, one each time.
So the Hardware is pretty much sorted.
No,1 - Wemos D1 Mini pro & a SR501 PIR sensor
No,2 - Wemos D1 Mini pro & a SW420 Vibe sensor
No, 3 - Central unit - Arduino UNO R2, another SR501 PIR sensor, a DY-SV5W mp3 player & an nRF24L01+ Wifi reciever
The first bit I’d like some help with is setting up sensor #2 - the Vibe sensor.
(No,1 will be pretty much the same anyway, just a different pipeline)
Setting up pinmodes & inputs/outputs is pretty straightforward but it is setting up the transmit code that has me stumped ATM as that is something I have not done before & pulling bits of code from AI sources & the like is just as confusing, ask the same question 3 times & get 3 different sets of code!!!
The other thing to mention is I also have an LED blink finction in there to indicate power on. it is an extarnal LED set to blink 0.5 sec on & 2 sec, off.
This is what I have so far.
Q1. How do I set up the pipeline. (To the nRF24)
Q2. How do I get it to transmit “Vibe detected”
void setup() {
Serial.begin(9600);
pinMode(A0, INPUT); // Captures signal from the vibration sensor
pinMode(D6, OUTPUT); // Output for LED
//esp_now_init() How do I use this
}
void loop() {
int signalState = analogRead(A0);
if (signalState == HIGH) {
Serial.println("Signal Triggered!"); // Sends signal over USB/Serial
delay(500);
//esp_now_send() How do I use this
}
digitalWrite(D6, HIGH); // turn the LED on (HIGH is the voltage level)
delay(500); // wait for a second
digitalWrite(D6, LOW); // turn the LED off by making the voltage LOW
delay(2000); // wait for a second
}
Thx in advance, Mick.
