Yun: perhaps a lower-power alternative to the Pi for gateway moteinos

Started by Antony, July 30, 2014, 01:26:04 PM

Antony

I got hold of an Arduino Yun in the hopes of connecting it to a gateway moteino and using it in place of a Pi to serve sensor data from several moteinos. The Yun seems like a valid alternative to a Pi for some projects that use moteinos and want to connect to the internet, but which would benefit from battery power (Yun 400MHz processor draws less than the Pi's 700MHz processor). After searching "Yun" on the forum, and finding little, I thought it might help others by starting a thread, even though I haven't yet connected my gateway moteino. After reading other posts on this forum, and Felix's gargage-mote RPi blog, I tend to agree with Felix (and others) that connecting the ethernet shield to a gateway moteino is certainly possible, but a limiting move (low or no security etc.), which is why I moved onto the Yun.

I looked at the image of Felix's connections from the FTDI of the gateway moteino to the Pi and it seemed like it used two GPIO pins of the Pi for the serial data to and from the moteino.

The only problem seems to be that the Yun's ATMega32u4 uses up all the GPIOs of the AR9331 internally, and no AR9331 pins are exposed. So, where exactly to connect the two signal wires of the FTDI (gateway moteino) to get the data into the Yun to be handled by a python script?

Perhaps the Yun's SPI on the ICSP header is a clue? If so, then this link may help: http://arduino.cc/en/Main/ArduinoBoardYun?from=Products.ArduinoYUN. About half way down the page, the section "input and output" explains the SPI on the ICSP header. Does anyone know if two of these six pins (ICSP header) can be used, and if so, which ones?

Spexx

Hi Antony,

I'm not familar with the Arduino Yun, but maybe it would be possible that you connect the Moteino to the ATMega32u4 and the ATMega32u4 will send the data to the AR9331? The ATMega supports the SoftwareSerial Library, so I think there shouldn't be a problem to find a pin to connect the Moteino.

Do you have any concrete information regarding the power consumption of the Yun? I don't believe that there are big differences between the both boards.

Antony

Thanks for your reply, Spexx. As both operate at 5v, a bit of research revealed the following:

Seems like the Yun is roughly half the consumption of the Pi, so perhaps worth looking into. The Pi draws approximately 3.5w, or 700 ma (source: http://www.raspberrypi.org/forums/viewtopic.php?f=63&t=79905&p=567334) and the Yun seems nearer 300 ma. See the following link for a real-world example of someone testing power draw under different loads (source: http://forum.arduino.cc/index.php?topic=188821.0)

If anyone here has real-world power draw limitations (i.e. using batteries for the Pi), then the Yun is perhaps worth looking at. Although I do not have a Pi, I've read that Yun setup is a little bit more tricky.

Wiring to get data to and from the Yun is simplest by using the Yun's USB, acting as host, connected by FTDI to the gateway moteino. At least that setup is what other Yun users are doing for devices similar to but different from moteino (e.g. usb camera, gps). Hope this helps others.

Thanks again to posters of this community for helping me as I learned Moteino, and to Felix for a fabulous product suite; can't imagine the energy and effort to get so many products, tutorials working, and find time to look over this forum. (not a compensated sponsor, by the way, just an appreciative customer!)

Felix

Anthony,
I don't have a Yun, and if that's trickier let me tell you some things on the Pi are not quite as smooth as I would wish. The Pi however has a huge community and great support, and if you know you way around linux a little you can get a lot of stuff done. Yun can run an open-wrt linux distro as well. The problem even with Pi and all these small devices that can run linux distros is that there are not always packages available to install and sometimes even to compile for them. For instance NGINX ... I needed version 1.3.13 which had the secure sockets forwarding feature, and while that's available for x86 and other platforms, it's not avilable for ARM. So I had to compile the thing myself. A far cry from the "sudo apt-get install nginx" which is the 1-line command that works in most cases but not always for less common packages.
Also Yun is 2X the price of Pi ;)
Thanks for the feedback, appreciated :)

Charly86

Antony,

I totally agree Felix, Pi is not "the solution", I'm using Open-Wrt platform (TPLink, NSLU2) with Arduino RF custom Gateway on them, rock solid, and no SD or nand write issue, openwrt is created for this.
The difficulty is the flash space on these device, but LUA is integrated and I open the Serial in LUA to send to data received by the gateway to emoncms, all fit just in size but no more space left, but that works, and never stop !!!

Antony

@Charly86: by chance, I just saw your post to Felix about your suggested interrupt mod to the RFM69, and then came here and saw your comment about open-wrt and the only difficulty being onboard flash. Since I posted, I've got a bit more familiar with open-wrt and would agree it seems rock-solid. I have my moteino happily chatting to my yun through FTDI.

You probably already know this (it seems you are pretty much an expert from your RFM69 library mods), but in case you or other forum readers are interested, yun has an expansion to SD that includes system files, not only data. So packages and such don't fill up the onboard flash and writes are mainly to the SD card, not the onboard flash. Here's the link to the expansion tutorial which includes an .io file http://arduino.cc/en/Tutorial/ExpandingYunDiskSpace. Perhaps this could be informative to readers cobbling together moteinos with devices that run light linux distros (yun, pi etc.)

@Felix: I was going to get an RFM69 module from you and try to stick it on my yun (the Leonardo part), so my moteino can talk wirelessly with my yun and not through serial which wastes the Leonardo part of it. I can't see under the RFM69 that is pre-soldered to my moteino, and I'm wondering if there's a link to a diagram of the pin-outs for the RFM69 (couldn't find among the moteino schematics, sorry if I missed it). It looks like all the connections are on the edge, but I also saw what looks like two pads on the moteino under the RFM69. So I wondered if there are more connections to the module that I'm unaware of.
Second related question: assuming I'm not as familiar as you or Charly86 with modifying libraries, do you think I'll need to do much code tinkering to get your libraries to work on the Leonardo? If it is likely to be dauntingly difficult, I won't start. Tagging on the end of this yun thread seemed like best place for this question, rather than start new post, as yun is perhaps an "edge case" for the moteino forum:)

Felix

Hey Antony,
The Moteinos have 2 sets of pads, for RFM12B and RFM69. WHat you saw are unused pads that would be for RFM12b, there are no hidden pads on the RFM radios.
You can see the schematic and renderings here: https://github.com/LowPowerLab/Moteino/tree/master/R4

I have not tried the RFM69 lib on Leonardo but should be pretty straight forward.