I have an alarm system built around a Uno and I want to add a remote panic switch, to that end I got a Gravity voice recognition module and I can connect that to an Uno and "see" the Gravity recognise a voice command.
The Gravity device talks via serial to the UNO and sends a string which represents the command given to it. That works
I have not been able to get the Gravity device to talk to either a D1 mini or a ESP8266 dev board via serial, no problems getting it to talkto the UNO.
I have two D1 minis that talk to each other and pass an indication of a btn press .
I need to connect the D1 minis to the UNO to pass the indication of the button press,
I am not sure how best to do that
Power the D1 mini from the UNOs so they share earth and just connect a logic pin from the D1 mini to the UNO , how to deal with the power diff logic shifter?
OR
Use an optocoupler between the logic pins on the D1 mini and the UNO to trigger an action
if an optocoupler is the way to go which one is best it would be 3,3v on one side and 5v on the other side
I figured optocoupler would be best but after spending hours looking for them I was unable to work out which would be best can you recommend a part number please.
I had no worries at all getting the sample program to work with a UNO ,
BUT,
was totally unsuccessful trying to get the gravity device to talk serial to ESP8266 D1 mini or a Node MCU I have, I found the code devices would load and run and then reboot themselves
Serial.println ("Serial begin"); // would print out
NodeMCU_SoftSerial.begin (115200); // device would reboot
Serial.println ("after NodeMCU_SoftSerial.begin");
So I gave up trying to talk to the ESP8266 and just went with the UNO.
Ordered some from Ali Barber, so might get them late next week , I really don't understand the tech sheets for these things, but will be happy if they work.
The UNO that will provide notification from the Gravity device will send a signal to the D1 if either the button is pressed, or the gravity device sends the UNO a message "panic"
The D1 sender sends that message of to the D1 receiver which then sends a message to the alarm monitor UNO.
I wasn't sure you could do that, I had thought I would have to have separation of the two devices.
I read somewhere that the UNO would accept a signal of 3.3, so I expect that that can just be a wire between two pins as long as the devices share an earth. It had been my plan to power the D1 from the UNO.
My circuit will work for sending a signal from the Uno to the D1. It will not work reliably from the D1 to the Uno. However if you use an analog input on the Uno say A0, you can connect the D1 output directly to A0. Then in your code you do an analog read and compare it to 338.
Otherwise you will need a transistor and a resistor.
Have a look at RF 433 Mhz that usually sells as RX and TX pair.
People were using them for Arduino doorbell projects years ago.
Button on TX sends a signal, RX gets it and signals Arduino pin.
RX module and TX module ran about $3 for 1 channel 1 way radio.
Youtube has videos, Arduino forum has posts, there's code...
Ultimately I used the information provided by Jim-p a transistor to connect the D1 mini to the UNO and a voltage divider to connect the UNO to the sending D1 mini.
I can now wake up the Gravity device by saying "hello robot" then I say "panic" and the panic led connected to the sending D1 mini will light, a message is sent to the receiving D1 mini which lights it's panic led and a signal sent to the transistor to create a circuit to ground so that the alarm monitor UNO can trigger an event, or, press the panic button
jim-p had suggested a TN3904 but I used a 2N2222 because I had one and not the other.
The plan is to have the sender in the kitchen and the receiver in the garage with the alarm monitor,
I have to tidy up my code but should anyone want it, scream, and I shall make it available.
My testing went something like this, me "hello robot" robot "yes I am here" me "panic" me "expletive" me "PANIC" me "expletive" me "panic" robot "ok"
So if I am in a panic I shall have to speak very clearly, I might need a few different recordings of "panic"