Author Topic: A testament to Felix's Mega  (Read 6199 times)

syrinxtech

  • Sr. Member
  • ****
  • Posts: 347
  • Country: us
    • Syrinx Technologies
A testament to Felix's Mega
« on: June 29, 2020, 11:21:41 AM »
UPDATE: all new posts are now in this thread.

I just wanted to give a shout out to Felix and his Mega.  Here's a list of what's currently connected to the Mega.  There are only 5 digital and one analog ports open.  There are two I2C devices connected and I still need to add an INA-219 to measure the current of the lipo's.  Way to go Felix!

Mega with HW radio
N/O rocker switch
BME280 - I2C
BNO055 9DOF IMU - I2C
Adafruit GPS (Serial1)
Adafruit GA1A12S202 Analog light sensor
ML8511 UV Sensor
Max9814 Microphone
SD Cardreader - SPI
Buzzer
Tri-Color LED

The microphone can be remotely activated and record up to about 9 hours of audio and save in WAV format onto the SD card.  All of the GPS and environmental data are streamed over the RFM69 to another Moteino which grabs and displays the data.
« Last Edit: July 27, 2020, 08:22:49 AM by Felix »

syrinxtech

  • Sr. Member
  • ****
  • Posts: 347
  • Country: us
    • Syrinx Technologies
Re: A testament to Felix's Mega
« Reply #1 on: July 07, 2020, 10:53:40 PM »
Update:

1.  Adding the Adafruit SI1145 UV/IR/Visible light sensor to get a "true" UV Index reading.
2.  Converting the RFM69 radios to LoRA for greater distance at slower speeds.
3.  Finished the menu system so I can send remote commands to the unit and have it respond with data to the logging device.
4.  Just received the INA3221 so I can start getting electrical telemetry readings.

syrinxtech

  • Sr. Member
  • ****
  • Posts: 347
  • Country: us
    • Syrinx Technologies
Re: A testament to Felix's Mega
« Reply #2 on: July 12, 2020, 07:51:05 AM »
Well, the LoRA Mega, INA3221 and the SI1145 came in over the weekend.  I won't be able to install them until this Friday, but I can't wait to get the new parts installed.

I also ordered a small fan (about 1.5" square) and the DS1631 thermostat chip which should be here in several days.  I'm going to use an ATTiny85 to create an "autonomous cooling unit" for the rover.  When the DS1631 detects a temp of 90 or greater, it will raise a pin which the ATTiny will read and turn on the fan through a power FET.  The unit will also have a small Lipo with a solar panel to recharge.  If my calculations work, it will be able to run independently of any other systems and cool down the inside "forever".

syrinxtech

  • Sr. Member
  • ****
  • Posts: 347
  • Country: us
    • Syrinx Technologies
Re: A testament to Felix's Mega
« Reply #3 on: July 16, 2020, 10:22:03 AM »
What to add to the rover that has everything?

Why, a vibration "theft sensor" of course.  Right before the MCU goes to sleep, I read a vibration sensor for 1.5 seconds.  If it detects vibration (calibrated to exceed normal movement), it will send out a log message and sound the buzzer.  I know it's over the top but I am trying to cram every conceivable option into the design.  I'm officially out of pins on the long breadboard but the Mega is still running strong.

Hopefully swapping out the RFM69HW for the LoRa this weekend, along with upgrading the UV sensor.

Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 6866
  • Country: us
    • LowPowerLab
Re: A testament to Felix's Mega
« Reply #4 on: July 17, 2020, 09:57:29 AM »
Wouldn't you need to read that vibe sensor all the time though? Vibes can occur at any time.

syrinxtech

  • Sr. Member
  • ****
  • Posts: 347
  • Country: us
    • Syrinx Technologies
Re: A testament to Felix's Mega
« Reply #5 on: July 17, 2020, 02:42:36 PM »
In loop(), just before I put the Mega to sleep for 8s, I count millis() for 1.5 seconds and read the vibration sensor.  The thinking is that if you're walking away with the rover, it will catch you after the next 8 sec cycle.

Just upgraded the UV sensor to the SI1145.  Working on the LoRA radio conversion now.  Using the arduinolibs crypto library to keep encryption with LoRA.


syrinxtech

  • Sr. Member
  • ****
  • Posts: 347
  • Country: us
    • Syrinx Technologies
Re: A testament to Felix's Mega
« Reply #6 on: July 18, 2020, 07:36:10 AM »
Well, after spending a few hours trying to get the "arduinolibs" encryption package working with the RadioHead LoRa drivers, I gave up and took a break.  I started on it again and actually reached out to the author.  Rhys was incredibly responsive and answered my questions and I got the encryption working with the Speck cipher.

Then I ran into another problem because I wanted to overlay the encryption with the RH95 driver and the RHReliableDatagram manager.  I couldn't figure out how to use both the encrypted driver and the RH95 driver with one manager.  If anyone has worked out those details I would love to hear how you did it.

For now I'm punting encryption and going to back to finish the basic integration of the LoRa radio on the Mega.  Many thanks to Rhys for helping me out so quickly.

syrinxtech

  • Sr. Member
  • ****
  • Posts: 347
  • Country: us
    • Syrinx Technologies
Re: A testament to Felix's Mega
« Reply #7 on: July 20, 2020, 01:54:46 PM »
The SI1145 UV sensor is installed and working perfectly.  Sitting on the deck, it measured a perfect 9.9 UV Index as compared to several other online measurement websites.

The fan arrived today and it looks really great.  The DS1631 chip is supposed to arrive on Thursday so hopefully Friday I will be able to add the ATTiny 85 and a BJT or MOSFET to power the fan (50 uA).  Once the DS1631 chip is programmed it will automatically turn on the fan through the ATTiny when a set high temperature threshold is reached.

The LoRa radios swap is complete, minus encryption.  At some point I hope to be able to do some range testing.

syrinxtech

  • Sr. Member
  • ****
  • Posts: 347
  • Country: us
    • Syrinx Technologies
Re: A testament to Felix's Mega
« Reply #8 on: July 23, 2020, 09:16:44 PM »
Update on vibration sensor.  Reading the vibration sensor at the end of loop() and checking for "theft" was too ugly for me to ignore, so today I finally moved it to a pin-change interrupt using the EnableInterrupt library.  Had a slight issue with the microphone library and duplicated declarations, but fortunately the EnableInterrupt WIKI helped out with the #define needed to make the problem go away.  Now, it's a simple flag update in the ISR and the loop() now only checks for the flag.  If there has been movement it disables the interrupt, updates some timers, and enables the timer again after 5 mins.  Poor mans debounce.

Tomorrow I am going to start doing some testing to see how much of a difference the 5v fan might have.  Going to create two small boxes, with identical temp/hum measurements and set them outside.  One will have the fan and small vents installed.  Just curious to see how much of a difference the fan will make in 95 degree weather with the heat index at 105.

syrinxtech

  • Sr. Member
  • ****
  • Posts: 347
  • Country: us
    • Syrinx Technologies
Re: A testament to Felix's Mega
« Reply #9 on: July 25, 2020, 08:56:17 AM »
Yesterday we did about 4 hours worth of testing in the heat to see how the fan might improve the ambient temperature inside a closed area.  I've never taken thermodynamics so excuse my testing methods.  We tried to keep it simple using two Moteinos, DHT11's and a power brick each inside of a plastic milk jug cut in half.  We put a small piece of wood on top of each jug to shield it from direct sunlight.  What we found over time is the one unit with the fan averaged 3-5 degrees cooler than the one without.  Is that enough to worry with?  Who knows....but I'll probably so some more testing just because it's fun. 

Since I'm still waiting on UPS to bring me the DS1631 chip, we just ran the fan at full speed on 5v.  The fan does support PWM, so I might experiment with running the fan at different speeds depending on the temperature.

syrinxtech

  • Sr. Member
  • ****
  • Posts: 347
  • Country: us
    • Syrinx Technologies
Re: A testament to Felix's Mega
« Reply #10 on: July 26, 2020, 07:55:09 AM »
Here's a graph of yesteray's testing of the fan.  You can really tell when the clouds came over.  The test ran for a little over 4 hours.  I have one more test I want to run but so far I'm impressed with the output of this little fan.


syrinxtech

  • Sr. Member
  • ****
  • Posts: 347
  • Country: us
    • Syrinx Technologies
Re: A testament to Felix's Mega
« Reply #11 on: July 27, 2020, 04:44:57 PM »
Thanks to UPS for delivering my PRUSA 3D printer today after 7 weeks of waiting!  And, according to their website, my DS1631 chip is supposed to be delivered today.  That chip will allow me to finish the "auto cooling" circuit for the rover and start testing this weekend.

I've been thinking about integrating OTA so I can update the code without having to bring the rover back to home base.  I also added a "flash erase" function to the wireless menu.  I've been thinking about potentially writing some measurements to flash in addition to the SD card.  We'll see about that one....just a thought at the moment.

If anyone has a suggestion for a sensor or measurement tool I have missed, please suggest it.  There is always room for improvement.

syrinxtech

  • Sr. Member
  • ****
  • Posts: 347
  • Country: us
    • Syrinx Technologies
Re: A testament to Felix's Mega
« Reply #12 on: August 05, 2020, 10:33:22 PM »
Great news....the Prusa 3D printer is up and operational!  Now I get to drink through the new firehoses of the Prusa slicer and Fusion 360!  Love new challenges.  I felt I made a good choice on the cooling fan for the rover when I saw it was the same make and probably model as the one on the 3D printer.

Also just got in the Adafruit 3x4 keypad.  I decided to combine the logging and control functions into one 3D printed box.  It will house the 3x4 keypad for entering the commands to be sent to the rover.  The box will also have some form of screen (either a 4x20 LCD or more likely a Nextion screen, which comes in a variety of sizes.  Throw in the LoRA Moteino and some miscellaneous parts (power switch, buzzer, etc) and I'll be able to completely control the rover from one screen.  I have a little more code on the 3x4 keypad to try and make it as bulletproof as possible.

I have also picked out what I think might be the underlying drive system for the rover, a Traxxas Rustler RTR kit.  It will give me a great foundation on which to build the rover.  Lots more work there in the future.


syrinxtech

  • Sr. Member
  • ****
  • Posts: 347
  • Country: us
    • Syrinx Technologies
Re: A testament to Felix's Mega
« Reply #13 on: August 06, 2020, 09:33:57 AM »
Just finished writing the code for the 3x4 keypad to accept 3-digit numbers for the commands.  I'm using the "*" as a BS character and "#" for ENTER.  After the user inputs the 3-digit code, it is verified as being a valid command number.

Although I'm not short on memory, I had never worked with integer arrays in PROGMEM before so I threw that in there to save 800 bytes.

I'm also considering an e-paper display in addition to the Nextion screen and the typical 2x16 or 4x20 LCD screens.  I have a couple of OLED's but I like the Nextion and e-paper displays better.


syrinxtech

  • Sr. Member
  • ****
  • Posts: 347
  • Country: us
    • Syrinx Technologies
Re: A testament to Felix's Mega
« Reply #14 on: August 07, 2020, 04:52:55 PM »
Ran into an issue where the keypad entry was causing the radio to miss the incoming packets.  Rewrote the code using two different keypad events, one using the "*" to enter 'command mode' and the other to handle the keypad input.  You now have to hold down the '*' key until you are prompted for the command code.  That way the radio gets the majority of the time to help missing an incoming log packet.

Also pitched the PROGMEM code since I was already checking for invalid inputs on the rover end.

Worked out the dimensions for a 3d-printed opening to install the keypad.

Adding conditional compiles so I can swap out RFM69 and LoRA radios with a simple #define and a re-compile.  This will primarily be used for range testing in wooded areas.