My "hybrid" gateway
My gateway build project has progressed far enough to be "announced".
Goal of the project: To create a gateway that is capable of providing serial/Ethernet/MQTT capabilities and securely authenticated transmissions. Because I like a challenge, I am doing this on a Arduino Nano. So far I have managed to squeeze in a sketch that can handle both serial and HDCP capable Ethernet (gateway becomes a serial if it cannot aquire an IP through DHCP). I am hoping to also fit MQTT code into it but I am not sure that is possible since I also want to put in a driver for my authentication chip and probably need a software SHA256 algorithm as well. But as the USB connector will be exposed, I can live with having to reprogram it, should I need to.
The bill of material is as follows (may be updated as build progresses):
- 1 Arduino Nano
- 1 NRF23L01 PA-enabled radio transceiver
- 1 W5100 Ethernet module
- 1 LE33 regulator
- 1 ATSHA204 authentication chip (on breakout board)
- 1 Red LED
- 1 Green LED
- 1 Yellow LED
- 3 330Ω resistors
- 2 0Ω resistors (optional)
- 2 4.7uF capacitors
- 1 100pF capacitor
- 1 10pF capacitor
- 2 pushbuttons
- 1 Adafruit half-size perma-proto PCB
- A few meters of leads suitable for PCB wiring
- Male/Female pin headers (cut to various sizes)
- Heat shrink tubing
I have modeled the perma-proto in the gEDA PCB tool in order to figure out the optimum wiring with respect to holes, component placement and wire widths and to make sure I do not miss any connection (almost every interconnect needs to be handwired/soldered).
This is the top and bottom placements:
And the routing of the sides (routing is done with respect to hand wiring and component clearances due to thick cables, hence the sometimes less-than-optimal routing paths). Also note that the back-side routing is displayed as viewed from the top.
Start by cutting the PCB on the bottom side so that the modules can be inserted without shorts:
After a few man-hours cutting and soldering:
Top side with components:
The LEDs are "tall" because I have not yet decided on exact box format, so this gives me some flexibility in positioning/aligning the LEDs.
Bottom side with components:
The antenna connector aligns with one of the ground-rails, so it can be soldered down on the board as well to provide additional support for the RF module:
Gateway sketch has been updated to manage the ETH_SPI_EN signal. Available on GitHub. Please note that I will at my own leisure do force-pushes to this branch, so if you clone it; you have been warned. You are welcome to copy it anyway you like.
Also note that the ATSHA204_SDA has been moved from A7 to A3 so the graphics above are not entirely true (but GitHub is).
Nice projects and good to see that you can combine a serial and Ethernet gateway, although I am not so sure what is the use-case
The ATSHA204 chip has SHA1 and an unique 72-bit serial number and is low-cost and low-current, nice chip. Yes, with that you can do authentication, already some ideas on how to fit in into the packets?
@daulagari actually the at chip does sha256. I have posted a link to a sequence diagram showing how one could implement message signing and authentication in the security thread.
About the serial/ethernet thing, it is more for fun and to not have to bring the gw to the computer for reprogramming should I like to switch mode of operation.
EDIT: Updated with more pictures. The electrical build is now complete. GitHub is also updated with the HW design.
EDIT 2: I found out the hard way that pin A7 cannot be used for digital IO. So I had to patch the ATSHA204 signal to use A3 insterad (this also matches other MySensors HW that uses ATSHA204, ping @tbowmo).
Same thing hapenned to me on the first Mysensors Micro board, I had attached a LED to A6, which is also only an input pin.. So Had to hack things, in order to get it working (it also sparked of a new iteration of the PCB, which now includes the atsha204, so something good came out of it anyways :))
@Anticimex How do you manage SPI_EN from software? I seem to have run into the same problem with SPI and the Ethernet gateway (despite having run the MQTT gateway for months with no issue). Thinking of doing the hardware hack on the ethernet shield to avoid soft spi (better to solder one more wire than de-solder and re-solder a bunch of wires).
@bjornhallberg i am going to put my gw hacks on a branch and publish it on github. I'll post a link when that's done.
Original post is now updated (look at the bottom of it). (ping @bjornhallberg)