Hey all,
Sorry in advance for how basic this is. I am trying to build a really basic wireless user controlled outlet (which is why I am so interested in the SwitchMote shield haha). I have the relay circuit designed, built, and tested. I can turn it on and off with a Moteino, now I need to go wireless.
On Moteino A there will be a momentary switch connected to pin A0. I can figure out the wiring and the code to get the momentary read by the Moteino.
On Moteino B will be the relay circuit, already built and tested with the relay control connected to pin 8. Now where I need a little help to get going is how to transmit the analog read from Moteino A to Moteino B and get it to change pin 8 from high to low.
From examining the example sketches my guess would be using the if (Serial.available() > call somehow, but I am really lost trying to dig through this code.
Anyone care to take a couple minutes to help get me heading in the right direction? I'll give you a seriously bitchin' internet high-five!
You don't need to use an analog in pin for a momentary switch, just use one of the GPIO pins, like D3.
In brief you may want to do something like: have A send "ON" or "OFF" (or "1" or "0") to B.
A and B will need to be assigned unique ID addresses, lets say A is 10 and B is 20. A will send to 20. Both will need to have the same network number or B won't "hear" A.
Send data wirelessly with the sendWithRetry command. Serial is for debugging or talking over wires to other serial devices (like a computer or Raspberry Pi). The Arduino IDE has a serial monitor which will show you any data your Moteino sends out with serial.print commands.
Look at the MotionMote project - http://lowpowerlab.com/blog/2013/11/17/motionmote-moteino-motion-sensor/
The code is here, pretty simple, not many lines - https://github.com/LowPowerLab/RFM69/blob/master/Examples/MotionMote/MotionMote.ino
MotionMote has an infrared sensor that triggers an interrupt pin of the Moteino so it wakes up and sends a message. You can connect your switch to the interrupt pin, but bouncing may cause problems, if so forget the interrupt and use that pin as a general input and loop to check when it changes state, then send when it does.
Hey hang in there, I am close to coming out with the SwitchMote. I am in the final stages of the code development. Almost done with the physical aspects (enclosure etc).
Waiting for some more parts to complete that. Also need some more testing and oh ... putting together some kind of documentation (hopefully video too), but all of this takes so much time and is painstaking to edit so that it doesn't all look like it's made on my smart phone.
I will probably sell a few kits/units to people willing to do some more testing for me...
OH ME ME ME ME ME!!! I know I'm not the most experienced user, but I do know how to dump the serial monitor and send it to you! And I guarantee I'll test the living hell out of it!
I'll definitely be buying a bunch of SwitchMote Shields, but I want to finish this project first 1) for a sense of accomplishment and 2) to get a better idea of exactly how the Moteinos send data to each other so once I do get a SwitchMote I can really play with it.
Ok I was able to put together a demo of the latest SwitchMote progress and functionality. Blog and video here: http://lowpowerlab.com/blog/2014/01/31/switchmote-project-update-and-demo/