LowPowerLab Forum

Hardware support => MightyHat => Topic started by: prolucid on February 22, 2016, 09:10:59 AM

Title: MightyHat, RPi <-> radio, requires arduino?
Post by: prolucid on February 22, 2016, 09:10:59 AM
Amazing work on the home automation gateway, I love all the features!  I really like the MightyHat because it has built in UPS, low voltage graceful shutdown of the RPi, and SMA connector.  After some digging I read in to the architecture and found there's an arduino between the RPi and the radio (RPi <-> arduino <-> radio).

Why is this?  I understand the arduino is needed for the smart UPS functionality.  But for the sake of simplifying the code base, why not just talk directly to the radio (RPi <-> radio)?  It seems like unnecessary complexity (hardware and software wise) to also have an arduino in the middle for the radio.

This seems to be the holy grail in single channel LoRa implementations at the moment.  A breakout board / shield with SPI header, radio, and SMA for $20 would be awesome.  There are some out there but are either too expensive or ship outside of the US.

So apologies ahead of time, I haven't looked at the gateway code, but can the arduino requirement for the radio be skipped?  I know I can solder the radio differently to accommodate what I need, but will SPI work with the gateway?

...I really like the MightyHat and would love to use it :)

Thanks!
Title: Re: MightyHat, RPi <-> radio, requires arduino?
Post by: Felix on February 22, 2016, 09:30:23 AM
Thanks for the feedback :)

The arduino is an atmega328p, the same MCU behind most Moteinos (except MoteinoMEGAs which have the 1284p MCU).
It was a design time decision to add this. There are many reasons to have a middle man MCU in between the Pi and the RF network. It reduces complexity on the RPi side, allows a simple serial link from the Pi, which is also imperative for separation of concerns. The Pi does not need to know what the RF network is, it simply talks serial. For that matter, we could swap the MightyHat and the rest of the network with anything else and everything would still work the same. Ie it doesn't have to be Moteino or MightyHat or anything in particular.
The atmega is what controls all the features of the MHat, and the serial link allows the Pi to channel those requests from  the Pi side without messing with libraries, SPI protocols etc. Just simple strings will suffice. And lots more to talk here. I spent many many hours and several revisions in designing the MHat, and all these features were very much considered and optimized.
Maybe when I add more documentation on MHat I can explain all the features and the WHYs that go with them.

Not really sure what you mean by this statement:
Quote from: prolucid on February 22, 2016, 09:10:59 AM
This seems to be the holy grail in single channel LoRa implementations at the moment.  A breakout board / shield with SPI header, radio, and SMA for $20 would be awesome.  There are some out there but are either too expensive or ship outside of the US.
.. but just to put things into perspective: just the LoRa radio cost is in the $10 range, compare that to the RFM69 which is much cheaper.

$20 for the MightyHat is impossible. Just the parts that go on it (the parts you see in the kit, without radio or LCD or SMA etc) cost almost $20. Add to that the assembly time, testing, soldering, and overhead of packaging etc. It's not easy to put such a complex board in the hands of the end user, while still making a profit and keeping the cost low. Not as long as it's MADE IN USA at least.
Title: Re: MightyHat, RPi <-> radio, requires arduino?
Post by: prolucid on February 22, 2016, 10:24:08 PM
Thanks for the feedback.  By the holy grail for $20, I mean something like an XBee+Shield for an RPi.  Here's the XBee part:

* http://www.soselectronic.com/?str=371&artnum=182634&name=hoperf-con-rfm95w
* LoRa chip already soldered in
* SMA mount already soldered in

Here is one for $60:
http://www.digikey.com/product-search/en?vendor=0&keywords=MTDOT-915-X1P-SMA-1

So the holy grail would be one of those "XBee LoRa" radios and an RPi shield - for $20. 

I know it's cost prohibitive to even think about getting the MightyHat at $20, that's insane :)  I'm not a wiz with all things arduino but I was talking with a colleague today and he believes I can access the LoRa chip on your MightyHat via SPI from the RPi so I think I might be good there.

I'd rather change C/Python code quickly on the RPi side than mess with uploading sketches repeatedly.  There's some digging and learning I have to do on that front.  My thinking there is I did a fun API mode 2 XBee project last summer with packetized data (two way communications between radios on the MAC level).  Honestly I don't know how nodes and gateways communicate via LoRa yet so I have some learning to do there.  If it's just TX and RX I'm not sure how you can have two way traffic between more than two addresses (radios) without sending data on the MAC level.  I only started digging in to LoRa a few days ago so I have some learning to do :)  Plus this is just single channel, there's multi channel to contend with down the road.

Thanks for the feedback!  Really looking forward to playing with the MightyHat, it's such a clean design!
Title: Re: MightyHat, RPi <-> radio, requires arduino?
Post by: Felix on February 22, 2016, 10:40:25 PM
The first link is just a breakout.
The second is an arm chip with LoRa radio in a XBee format. The "equivalent" (quotes because there are very significant differences) is my line of Moteino LoRa boards.
The MightyHat will accept a Hope LoRa radio.
BUT remember there is no SPI link between the RPi header and the LoRa module. If you want to hack at it, that's a different thing but I would consider that "voiding-of-warranty" :)