My 3rd and currently latest iteration on a network datalogger.
Recently updated to use switcing regulators.
The board has room for
9 DS18B20 sensors driven by the mega directly (3 busses).
Besides the 3 onewire busses, 4 analog and 4 digital pins also reside in the screw terminals.
There are 2 expansions headers with the spare IO pins, a "LCD" connector with a serial output, a ISP header for programming the board and finally an 6pin FTDI pin header.
My firmware uses a ethernet based bootloader, so it can be updated remotely.
Code is based off the tuxgraphics example, so one packet at a time max, with the decent memory size on 1284 that means we can send around 1.5kbyte of data at a time.
However the hardware wirings works with the 1284P arduino code, so one could use UIPethernet lib instead...
I havent been able to get the board running stable using Arduino UIP code yet, when it gets stressed it starts to drop old connections.
The source code has been updated to latest stack from tuxgraphics, which adds the ability to use DHCP.
Also added some CoAP support, for now its just spamming coap packages when theres a change over UDP to the same server as the webclient, but in time a full CoAP enabled server should be possible.
Using UDP allows us to send updates much more frequent than with TCP, since we dont have to bother with handshakes and all, however the RFC does state that if the code dont use confirmations (and it does not) and it cant estimate a RTT it should limit itself to 1 packet every 3 seconds. Currently the code is more towards 1-n packages per second depending on how often sensor data changes, one problem is the analog inputs, which if unconnected will change constantly, while it makes for a easy debug of the system, its a waste of network bandwidth to send information that noone cares about.
So ideally I should be able to detect if a ADC port is in use or not, maybe by activating internal pullup and seeing if it returns 1023, but that could damage any less than 5v sensors, unlikely but still...
Currently all analog data is sent in one package, and all digital data is sent in one package, the DS18B20 data is sent in 1 packet per sensor change, less than ideal, so room for improvements to send all changes up to the max packet length in one.
Still plenty of space for expansion (The data usage is mostly high due to not much code optimizations done, due to being spoiled with the sram size) Program Memory Usage : 51952 bytes 39,6 % Full Data Memory Usage : 11030 bytes 67,3 % Full
In other news the W5500 from wiznet is now so cheap that its a much more potent competitor to ENC28J60, the price difference is about 0.5-1$ and the W5500 is 5V tolerant, so since the ENc is currently the only 3V3 device on the board the logic converter could be scrapped. The W5500 requires a bit more support passives though, so in total maybe 2-3$ more expensive.
The big selling point of the wiznet chips is hardware network stack, it should be more robust than the software one used with ENC, and maybe it will play nicer on bad networks (ENC usually wont work if its conncted to bad equipment that duplicates packages, or wont accept 10mbit half duplex). So if the ENC is replaced with W5500 the atmega 1284 could be replaced with a lesser version since the 16KB SRAM isnt needed as much without the network buffer, and the code fits nicely in half the flash.
Sadly theres not many Atmegas below 1284 with 4kbyte SRAM and 64kbyte flash, so downgrade options are limited.
You can however get a SAMD21 Atmel Arm Cortex-M0+ for 2.5$, about 3$ below the 1284P with same flash/ram and 48MHz instead of 20MHz. But if you do that route, adding a few bucks more gets you onboard ethernet (ATSAM4E 8.5-11.5$ vs 5.5$ for D21+w5500).