LowPowerLab Forum

Hardware support => Moteino => Topic started by: tva164 on October 12, 2014, 04:27:43 PM

Title: MotionMote Rev1 R1 sketch problem [SOLVED]
Post by: tva164 on October 12, 2014, 04:27:43 PM
Hi, just got the motionmote kit I ordered.  Been over to http://lowpowerlab.com/MotionMote/ but no assembly, code & walkthrough save a few photos of the completed kit etc.  Can someone help me get started - relatively newbie but with some steer I can get the job done.  Thanks folks!
Title: Re: MotionMote Kit Rev 1
Post by: Felix on October 12, 2014, 07:58:53 PM
Hi there, the post I've posted on Motion mote is not very thorough indeed but there really isn't much to that piece of kit in terms of assembly. You have the Moteino (whichever you purchased), the PIR sensor and the LED+resistor. The pieces that get soldered together are shown in the last set of photos towards the bottom. You basically power the whole thing from a 9V battery through the provided clip, which you may split on the VCC (red) wire and run it through the provided switch. That switch goes in the side of the enclosure (small rectangle cutout).
The PIR is wired from 9V as well. The OUT signal from the PIR goes to D3 and to the LED (longer LED lead is positive). Run the LED to GND through the provided resistor. All should fit in the provided case which you can just hold together with clear tape for easy disassembly at a later time.
I hope this helps.
Title: Re: MotionMote Kit Rev 1
Post by: tva164 on December 22, 2014, 03:43:46 PM
Thanks.  Finally got the solder kit and got a functioning motionmote.  Very exciting to see it all fit into the case and the light come on indicating it all works as it should.  Now I have hit a bit of an issue. Of the three moteinos I bought (to use two as transmitters and one receiver), two of them return an upload error..

Quoteavrdude: stk500_getsync(): not in sync: resp=0x0a

I have checked the Arduino IDE settings etc and there is a good serial connection via the FTDI.  Turning on Serial Monitor, I see garbage . . like this:

Quoteþÿ1ì0¨ÿ ýÿ°¹þü›ø»þ¹þ¸ü¸ø›ð¹à¹ðð›à»ð°à¹Âð°p¹ðàð°ð¸,à»âà¹à¸pà¸ð°ÿ¸þ¸þ¹ü¹ø¹ð›þ¹ü¸Â¹Â¸ðð¸ð°à¸àð¸»à¹ð¹à›p¹ð¸ð›p¹ð›Â¸à›ð¸ð›à»¹¸þ¹ÿ›ð°à¹Â›à¹Âpà›à™À»a¸p¹àâ¹à¸ðâ¹Â›p›â¸Â¹à¸à¹p¸ð°™à¹ÿ¸¹þ¸ü¹øð›à¸ð›à°ð›ððâ¹À¸Â¸Â¹â¹ðà¹ð¸à›â¸p¹ð¹ð¸à¹p¸p°a›p°p›ÿþþ¹ü¸ø¸þð¹ü›ð¹ð¹

Any idea what's wrong?
Title: Re: MotionMote Kit Rev 1
Post by: Felix on December 23, 2014, 09:04:14 AM
What is your target board when you are uploading?

What are your settings in the serial monitor?
You should have 115200baud.
Title: Re: MotionMote Kit Rev 1
Post by: tva164 on December 23, 2014, 10:43:05 AM
Its the R4.

My second question has been answered - I noticed someone else had the same issue and fixed it with the baud rate - that works fine now, although serial monitor shows an SPI flash not available error which I think I should ignore.
Title: Re: MotionMote Kit Rev 1
Post by: tva164 on December 23, 2014, 10:49:37 AM
Felix, hold off on this for now, I think a pin on each of the boards isnt sitting well to create the connection with FTDI.  I'll resolder it and see what happens.
Thanks
Title: Motionmote sketch [Problem]
Post by: tva164 on December 24, 2014, 10:54:58 AM
Hi I am setup on a Moteino R4 node with RFM69, and uploaded the motionmote sketch (old).  Node, network, gateway ID are all setup correctly. Board is connected via FTDI to my Mac, with the PIR connected to the R4.  I have not connected the LED as where I want to use the motionmote (my garage), I do not need visual indication. For the gateway I have used the gateway sketch and it works fine (message: Listening......433MHz).

The node R4 is where I seem to have hit a problem.  Using serial monitor (baud rate 115200), this is what I see:

Trakµ¥ÑÑ¥¹...сÑÚšj¡é¹¹²jRþ nÿ‹¡¥¹¹¹òjRü nÿ‹¡¥¹¹¹²jRþ nÿ‹¡¥¹¹¹²jRþ nÿÑ¡¥¹¹¹²jR

I think the Tra is part of the expected message "Transmitting at....." but its cut short for some reason.

Each ‹¡¥¹¹¹²jRþ nÿ represents motion.

I think the garbled messages might be pointing to a problem in the sketch?

The second issue I have is the gateway R4 does not pick up these signals.  I'm assuming that's because something is messed up on the node and fixing the above problem should address the receiver issue as well?

Thanks for looking, and please help me with pointers if you know what's going on.
Title: Re: MotionMote Rev1 R1 sketch problem
Post by: Felix on December 24, 2014, 11:18:37 AM
Try adding this before the sleep function:
Serial.flush();
And let's keep relevant forum topics together to avoid excessive threading.
Title: Re: MotionMote Rev1 R1 sketch problem
Post by: tva164 on December 24, 2014, 12:44:46 PM
That worked, thank you.  I now see the following:

Transmitting at 433 Mhz...
nothing...
nothing...
nothing...
nothing...
nothing...
nothing...
nothing...

Which is what you'd expect but the nothing... shows up when there's movement so let me take a look at the code.
Title: Re: MotionMote Rev1 R1 sketch problem
Post by: Felix on December 24, 2014, 01:03:48 PM
That means your node is not getting a reply from the gateway. Make sure the hardware settings are right (is_RFM69HW or not), same frequency and network, different IDs and that the node transmits to the right gateway Id, etc.
Title: Re: MotionMote Rev1 R1 sketch problem
Post by: tva164 on December 25, 2014, 06:41:27 PM
Communication between two nodes (#2, #3) and gateway (#1) works now, and I think I have stumbled on the very last problem that needs to be fixed.  See stream of messages below:

Node
Transmitting at 433 Mhz...
nothing...
ok!
ok!
ok!

Gateway
Listening at 433 Mhz...
SPI Flash Init FAIL! (is chip present?)
#[1][2] MOTION   [RX_RSSI:-89] - ACK sent. Pinging node 2 - ACK...nothing
#[2][2] MOTION   [RX_RSSI:-83] - ACK sent.
#[3][2] MOTION   [RX_RSSI:-79] - ACK sent.
#[4][2] MOTION   [RX_RSSI:-83] - ACK sent. Pinging node 2 - ACK...nothing
#[5][3] MOTION   [RX_RSSI:-91] - ACK sent.
#[6][3] MOTION   [RX_RSSI:-80] - ACK sent.
#[7][3] MOTION   [RX_RSSI:-80] - ACK sent. Pinging node 3 - ACK...nothing
#[8][3] MOTION   [RX_RSSI:-79] - ACK sent.
#[9][3] MOTION   [RX_RSSI:-79] - ACK sent.
#[10][3] MOTION   [RX_RSSI:-80] - ACK sent. Pinging node 3 - ACK...nothing
#[11][3] MOTION   [RX_RSSI:-77] - ACK sent.
#[12][3] MOTION   [RX_RSSI:-80] - ACK sent.
#[13][3] MOTION   [RX_RSSI:-79] - ACK sent. Pinging node 3 - ACK...nothing
#[14][3] MOTION   [RX_RSSI:-80] - ACK sent.

The node and gateway only seem to talk to each other when the R4's are kept almost right next to each other.  Antennas are soldered on fine (a little messy where I went over on to the board) - here are some photos.

https://www.dropbox.com/s/zcgzhpbo3pui14q/mote_1_gateway1.jpg?dl=0
https://www.dropbox.com/s/fwvgsc8tsj7wkpo/mote_2_gateway2.jpg?dl=0
https://www.dropbox.com/s/f7k56y1d7mbva3l/mote_3_node1a.jpg?dl=0
https://www.dropbox.com/s/zpjdoitlw8spfui/mote_4_node1b.jpg?dl=0
https://www.dropbox.com/s/lmdzz25epejs2e2/mote_5_node1c.jpg?dl=0
https://www.dropbox.com/s/tefdr9gl97w104h/mote_6_node1d.jpg?dl=0
https://www.dropbox.com/s/etzuik63wkicfvy/mote_7_node2a.jpg?dl=0
https://www.dropbox.com/s/4dcl5iz27dazruf/mote_8_node2b.jpg?dl=0
Title: Re: MotionMote Rev1 R1 sketch problem
Post by: TomWS on December 25, 2014, 08:31:18 PM
Have you set the IS_RFM69HW correctly?  It sounds like you've got a mismatch between the radio capability and which PA you're using.

Title: Re: MotionMote Rev1 R1 sketch problem [SOLVED]
Post by: tva164 on December 26, 2014, 03:56:01 AM
Got it working.  I decided to re-solder all antenna connections even though they looked fine and this time made sure I soldered them on first attempt - that made the difference. 

Thanks Felix and others for chipping in, it was a fairly simple "project" but as a newbie I have learnt a lot.
Title: Re: [SOLVED] MotionMote Rev1 R1 sketch problem
Post by: tva164 on December 27, 2014, 12:45:29 PM
Once motionmote worked as it should, I hooked up the gateway via USB to a Raspberry Pi with a Python script that parses the incoming serial data and uploads just the sequence, node and signal strength numbers to a google docs spreadsheet in real time.

Next step, get the Pi to send a tweet or email every time movement is detected.