Author Topic: Walkabout - Moteino Mega/GPS/SD card/OLED/LiPo/Battery charger  (Read 4847 times)

syrinxtech

  • Sr. Member
  • ****
  • Posts: 347
  • Country: us
    • Syrinx Technologies
Just finished the "Walkabout".....a portable GPS that captures various data to an SD card.  The output is also displayed on the OLED.  The unit is powered by a 3.7v, 1200 mAh LiPo and has an on-board charging card with a USB port for charging.

Output is displayed on the SSD1306 OLED connected via I2C.  The SD card runs over SPI with a CS=3.  The nice thing about the setup is that we only added a 220 Ohm resistor between the MISO out of the SD card.  No other SD code was required to make it reliable.  We did program the SD card writes "atomically", i.e., we open the file, write the log entry and close the file in one function.

To make it easier to gain access to the data on the SD card, we added an "OTA dump" feature.  This allows me to run a client program on a separate Moteino which reads the SD card contents and transmits it over the air so I don't have to remove the SD card every time I want access to the card contents.  I can also delete the file from the client when I want to start fresh with a new file.

The following data points are logged and displayed:

1. Lat
2. Lon
3. Speed in mph
4. Altitude in feet
5. # of satellites
6. Battery voltage
7. Date/time

I'm currently writing these data points every 5 seconds.  I added code for time to automatically handle daylight savings time.  I also threw in the Moving_Average library that averages the speed and altitude numbers over the last 3 readings.  WAAS is enabled on the GPS.  I also configured date/time callbacks for the SD card so the files written on the SD card are properly time and date stamped.

WhiteHare

  • Hero Member
  • *****
  • Posts: 1300
  • Country: us
Re: Walkabout - Moteino Mega/GPS/SD card/OLED/LiPo/Battery charger
« Reply #1 on: March 10, 2017, 11:07:03 AM »
A photo would be nice.   ;)

syrinxtech

  • Sr. Member
  • ****
  • Posts: 347
  • Country: us
    • Syrinx Technologies
Re: Walkabout - Moteino Mega/GPS/SD card/OLED/LiPo/Battery charger
« Reply #2 on: March 10, 2017, 01:25:43 PM »
Sure, I'll post a few when I get home tonight.

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: Walkabout - Moteino Mega/GPS/SD card/OLED/LiPo/Battery charger
« Reply #3 on: March 10, 2017, 04:28:42 PM »
Sounds great, do we get to see any code too?
The OTA SD reading feature will be of interest here. There's a forum user EnMon who might be very interested in that since he is deploying underwater cave probes that collect data to SD cards and has to dive every time he wants the data.

syrinxtech

  • Sr. Member
  • ****
  • Posts: 347
  • Country: us
    • Syrinx Technologies
Re: Walkabout - Moteino Mega/GPS/SD card/OLED/LiPo/Battery charger
« Reply #4 on: March 10, 2017, 04:52:33 PM »
No problem, be happy to upload the code as well.  I'm not very proficient with the fancy schematic programs, but it's a good opportunity to learn either Eagle or Fritzing.  Once I learn one of those I'll upload a schematic as well.

syrinxtech

  • Sr. Member
  • ****
  • Posts: 347
  • Country: us
    • Syrinx Technologies
Re: Walkabout - Moteino Mega/GPS/SD card/OLED/LiPo/Battery charger
« Reply #5 on: March 10, 2017, 11:10:31 PM »
Attached are a couple of pictures....showing the front, a closeup of the screen, the side showing the on/off switch and the recharge USB, and finally the inside.

On the screen notice the "SD" in the upper right corner.  I flash that every 5 seconds to let me know it's writing to the SD card.  It will flash "NF" if the GPS loses its fix.  Since I'm doing some limited error detection, I also flash "BP" if there is a bad packet.

syrinxtech

  • Sr. Member
  • ****
  • Posts: 347
  • Country: us
    • Syrinx Technologies
Re: Walkabout - Moteino Mega/GPS/SD card/OLED/LiPo/Battery charger
« Reply #6 on: March 10, 2017, 11:50:48 PM »
Attached are the three source files:

1.  Walkabout_sd_dump.ino - the main program
2.  Walkabout_sd_dump.h - header file
3.  Moving_Average.h - moving average code

If you're looking for the code that transmits the SD card file over the RFM69 radio, check out the dumpSDFile() function.  I transmit 60 bytes per packet back to the client.  In the loop() routine I check for an incoming client request using the normal radio.receiveDone() call.

Since I'm a security guy, I added a little more security by only allowing client requests from a specific node ID.  I also added a magic cookie in the client request struct.  Without this field and specific value, the request will be rejected.


WhiteHare

  • Hero Member
  • *****
  • Posts: 1300
  • Country: us
Re: Walkabout - Moteino Mega/GPS/SD card/OLED/LiPo/Battery charger
« Reply #7 on: March 11, 2017, 09:46:26 AM »
Thanks for the pictures.  I can't quite figure out how you mounted the screen though, as you didn't show the back of the lid.  However you did it, it looks nice.

syrinxtech

  • Sr. Member
  • ****
  • Posts: 347
  • Country: us
    • Syrinx Technologies
Re: Walkabout - Moteino Mega/GPS/SD card/OLED/LiPo/Battery charger
« Reply #8 on: March 11, 2017, 11:46:57 AM »
4 dabs of hot glue, one in each corner.

Nothing fancy, just practical.  Picture attached.

syrinxtech

  • Sr. Member
  • ****
  • Posts: 347
  • Country: us
    • Syrinx Technologies
Re: Walkabout - Moteino Mega/GPS/SD card/OLED/LiPo/Battery charger
« Reply #9 on: March 11, 2017, 11:51:22 AM »
I should add that my partner added the "Walkabout" lettering and the black outline around the OLED using a craft machine named the "Cricut".  It's a machine that you use to cut out specific shapes, lettering, etc. on a variety of paper, etc.  He used it to make a frame around the OLED.


WhiteHare

  • Hero Member
  • *****
  • Posts: 1300
  • Country: us
Re: Walkabout - Moteino Mega/GPS/SD card/OLED/LiPo/Battery charger
« Reply #10 on: March 11, 2017, 12:41:45 PM »
Well that's interesting.  So it's actually some kind of black contact paper applied to the front of the lid that acts as a kind of frame around the OLED?  I guess that way it can cover up any slop in however it is that you cut the opening?  After all, cutting a perfect rectangle in a lid would be quite hard to do without using some kind of CNC or laser or something.  At least in the photos, your result looks like very clean lines around the OLED from the front.

Sorry to go on a bit of a tangent over the packaging, but it's the part that almost no one ever seems to talk about.  It's of interest to me because I'll probably (eventually) be adding an OLED to the front of my Moteino remote control so as to help in selecting what it will control.

Nice work!
« Last Edit: March 11, 2017, 12:51:12 PM by WhiteHare »

syrinxtech

  • Sr. Member
  • ****
  • Posts: 347
  • Country: us
    • Syrinx Technologies
Re: Walkabout - Moteino Mega/GPS/SD card/OLED/LiPo/Battery charger
« Reply #11 on: March 11, 2017, 12:50:09 PM »
Yes, the Cricut can cut many different kinds of materials.  There is a GUI that can be used to layout almost any design and then the machine cuts it out.  My brother-in-law deserves all the credit for that one....he is a perfectionist when it comes to fit and finish.  He cut out the square for the OLED and mounted it, and then used the Cricut to make the frame so it would look almost inset.