A new gateway option has been added. You can now use Ethernet instead of serial link. This means free placement of your gateway anywhere in your house (near ethernet connector) and that you can use any Arduino board (not just Nano) for your gateway (by adding Ethernet module).
You should be able to use both the WizNet or the ENC28J60 module (I have only verified with ENC28J60)
You will need to update the Vera plugin with a new “L_Arduino.lua”-file
Vera Configuration:
Enter “ip-number:port” in the ip-field of the Arduino GW device(advanced tab). This will override any serial configuration for the Vera plugin. E.g. If you want to use the default values in this sketch enter: 192.168.178.66:5003
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
version 2 as published by the Free Software Foundation.
DESCRIPTION
The EthernetGateway sends data received from sensors to the ethernet link.
The gateway also accepts input on ethernet interface, which is then sent out to the radio network.
The GW code is designed for Arduino 328p / 16MHz. ATmega168 does not have enough memory to run this program.
COMPILING
You must make sure to disable DEBUG in Sensor.h before compiling this sketch. Othervise the sketch won’t fit in program space when downloading.
For UIPEthernet(ENC28J60) usage: Note that I had to disable UDP and DHCP support in uipethernet-conf.h to reduce space. (which meas you ave to choose a static IP)
For WizNET usage: Do not install the provided UIPEthernet-library. Remove UIPEthernet-include below and uncomment the Ethernet.h.
VERA CONFIGURATION:
Enter “ip-number:port” in the ip-field of the Arduino GW device. This will temporarily override any serial configuration for the Vera plugin.
E.g. If you want to use the default values in this sketch enter: 192.168.178.66:5003
LED purposes:
RX (green) - blink fast on radio message recieved. In inclusion mode will blink fast only on presentation recieved
TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly
ERR (red) - fast blink on error during transmission error or recieve crc error
What would you say the advanges are of running ethernet versus serial? would serial be much faster? Could multiple vera talk to the ethernet gateway at one time? Or a vera talk to multiple ethernet gateways at one time?
There’s no speed improvement. In my case, there are several advantages though It allows me to locate the Gateway any place there’s an Ethernet connection… I no longer have to tie the Gateway to the Vera. I’ve also had occasional problems with the USB port loosing connection to the Gateway if Vera looses power (I’m hoping the Ethernet connection will help this).
I have a few mr3020 lying around and was thinking of using their wifi to build a wireless mesh (2 mb/s speed are achievable with a mesh network), and the expose serial gateway over an ip port.
SoC: Atheros AR9330 rev 1
802.11 b/g/n 150 Mbps
Powered via USB B-Mini (5 Volts)
Tiny form factor
5.7 cm x 5.7 cm PCB
6.7 cm x 7.4 cm x 2.2 cm case
This would allow the nodes to be wifi-capable and only one node would have to be tied into the lan. It would make the WAF (wife acceptance factor) increase tenfold at least :). And i would rather spend 15-20$ for a mr3020 instead of 10-15$ for an ethernet module.
On the other hand, using an ethernet connection to the mr3020 and using the mr3020 as a bridge only would remove the need to write a serial-to-usb interface on the little router.
Darn, i’ve just finished making a pcb to plug the nano and everthing else and bought a case… back to the drawing board again…
And i’m guessing using an ethernet gateway would allow me to use an arduino mega, uno or anything else as long as it’s fast enough and has enough memory ? This would allow me to keep my nano and mini pro’s for actual sensors…
I’ve got everything switched over to Ethernet and all is working well.
I’m using the ENC28J60
For those who are switching over… There are two radio signals (CE & CSN) as well as the LED’s (if you use em’) that are now different from the default USB sketch when adding the ENC28J60.
If you used the default pins published in the USB Gateway Sketch, the changes are summarized below:
Moves From To
CE Pin 9 Pin 5
CSN Pin 10 Pin 6
Rx LED Pin 6 Pin 8
Tx LED Pin 5 Pin 9
Err LED Pin 4 Pin 7
Using a wiznet 5100 arduino module and an arduino uno (assuming they are compatible with the arduino nano sketch), are these the correct pins? I’m trying to make sure i don’t fry anything…
gnd /1 - gnd
vcc /2 - 3.3v
ce /3 - digital 5
csn /4 - digital 6
sck /5 - digital 13
mosi/6 - digital 11
miso/7 - digital 12
irq /8 - digital 2
I lost connection with the gateway today. When I pinged the Gateway there was no response until I cycled the power. I’ve been having problems with my cable modem resetting so I suspected the Gateway got lost when the network went down. I recreated the problem by disconnecting the Ethernet cable from the Gateway for 30 seconds and trying to ping… no response until I cycle the power.
This is the down side of using the luup io module to communicate with a device. If the power fails on the remote device, then the link cannot be re-established once power is restored, unless Vera is restarted. This is a major Vera problem. More here:
Due to this limitation, users may be better off having the Arduino Gateway act as a web server? You would command with GETs or POSTs and receive data in say json. However it requires polling be used. I have taken this approach here:
The ow server plugin also acts in this manner and works perfectly.
@MDoc I was a bit surprised to read that just unplugging the cable and plugging it back in caused a failure. Have you the latest firmware and which Ethernet interface are you using? Also worth a look at:
In summary however, their is no doubt that if the power is lost to your gateway, you need to restart the Vera Luup engine once power is restored. Otherwise you’re hosed.
did you mean cycle the power of the Gateway (Arduino + Ethernet module) or power cycle the Vera itself?
Sorry that wasn’t clear to me since a-lurker seemed to talk about having to restart the Vera.
Yeah… I’m having problems with my cable modem and loosing the internet several time a day. Since I’ve switched over to Ethernet, I’ve not gotten though a day without loosing contact with the Gateway. As @a-lurker said, I just need to cycle power to the Gateway (because it’s in an enclosed box) or hit the reset button to re-sync with the Vera.
Weird that your local network is affected by fluctuating internet access.
Is it possible to detect loss of connectivity from the gateway itself somehow?
In that case we could probably just update booloader to one that support WDT (Watch Dog Timer).
I.e. http://code.google.com/p/optiboot/
With WDT we could to make the arduino automatically reset when it loses contact.
Nope… If I ping the gateway there’s no response (obviously, also if I scan the network there the gateway IP is not present). Once I reset the Gateway (without restarting Luup) I’m reconnected and start getting sensor updates.
@hek, I agree about the cable modem… Don’t see why the modem should affect network devices… But at this point it’s the only thing I can hang my hat on. I replaced my modem tonight so I should know by tomorrow if it makes a difference. I’ll let you know.
I believe the problem is that I’m using a 3.3V 328P Nano as my Gateway. I’ve got the ENC28J60 connected to the 3.3V output. The FDTI output (FT233RL) can only supply 50ma while the ENC28J60 pulls 160ma when transmitting and 125ma at idle. I’ll switch over to a separate 3.3V source and re-post.
Hey… at least the new cable model fixed my resetting problems