Wednesday, 28 August 2013

Mini web ATmega1284P board, V2

(Update: 04/Oct/13.  PCB files are now available from here )


A couple of exciting things today smiley
My Goldilocks reward board turned up. Its a work of art, but I'm exercising great restraint, I'll play with it later...
First board built of my second version of Mega1284P mini-web PCB, here is some pictures...
Fractionally wider than the 1st one and with two regulators. One for 5V, one for 3.3V.
A link is available to run both voltages for max speed processing or just run 3.3V for everything in a low power environment.
A reset button, power led and user led are added in this version. Also solder bridges to bring the 2nd serial port out if the RS485 chip is not fitted.
When using both 5V & 3.3V rails and running Ethernet, some quick measurements of current draw gives a max of about 220mA. Thats before using the SD card.
Feeding the input with 7.5V, the regulators get pretty warm. I figure that with the SD card as well, some kind of heat-sinking will be required for continuous running.
However when using the power-down feature on the Wiz820, the current drops to about 45mA (16Mhz xtal). I have yet to experiment with the different sleep modes to see how low I can get it.
Using the Ethernet power-down feature, I can wake up the Wiznet module, post some data to Thingspeak and then shut it down again. When using it in this manner, the regulators get barely warm.
I'll experiment over the coming week, use the SD card as well and make some more measurements and see how it goes.
The radio is mounted at the rear but this time with the cheap mass produced nRF module footprint, a fraction of the cost of the Sparkfun part.
Almost all the pin locations are on a 0.1" grid so it can be plugged onto stripboard if required. The only things that are not on the 0.1" grid are the SD card and Wiznet module pins.


 with the nRF radio module



The Wiznet module unplugged exposing the micro-SD card socket.


underside











face on



















Wednesday, 3 July 2013

The new mini biggie

First build of my Mini-web board.
It has:
ATMEGA1284 (2 serial ports, 16K ram, lots of other goodies....)
DS1307 battery-backed clock
RS485
micro SD card
Ethernet (WIZ820 module)
Radio socket-strip (for nRF24L01 or other)
Breadboard friendly
Atmel 6-pin ICP header

Initial testing with Arduino software, programming by AVRISP MkII.
Ethernet, RTC, SD and radio all tested. 
Soon, I'll put an Arduino bootloader on and try serial programming. It should work with a FDTI basic, using DTR to reset. The resistor/cap are in place on the reset line and the DTR has a pin of the board-edge.
The required TX/RX/DTR/+V/GND are not all together as per the Arduino standard but a small wire harness will hook it up OK.
Serial programming was an afterthought, I use the ICP header for all my stuff.


Its a layered construction. The SD socket is under the Ethernet connector


The white connector is the RS485.
6-pin ICP is on the closest corner










Bottom of PCB, battery holder not yet present.

Top without the WIZ820 module.
SD socket is between the mounts for the Wiznet module.

From left to right, 1st 8-pin SM chip is the RS485 driver, next one is the DS1307 RTC

Socket strip on the right-edge is for a radio.
This can be a sparkfun nRF24L01 breakout, or a RFM12 breakout, or a RFM70/73 breakout.



And a Sparkfun radio board plugged in.


So, 2.4Ghz link, 128K flash, 16K ram, RTC, micro-SD slot, Wiz820 ethernet and RS485 on the 2nd serial port.


I suppose I'd better learn to program it now.....








Thursday, 21 March 2013

RF breakout boards

In my ongoing compulsion to connect things to other things, I did not want to be locked in with a design to one RF solution.
There are a few minimalist options available now. The Hope-RF RFM12 is a favorite, the newer Hope-RF RFM70 or 73 and not forgetting Sparkfun with the Nordic nRF24L01 solutions

I wanted to use the sparkfun SIL footprint as my 'fit-all' footprint.  and make small breakout boards so that I could use any of the 3 options as a plug-in.
The breakouts need space for an on-board regulator to enable use with 3.3V or 5V. Dont fit the reg for 3,3V, cut a track and fit the reg for 5V. The RFM12 also needs spaces for some resistors if used with 5V. Its inputs are not 5V tolerant.

This is the first version I came up with. Its before I decided to use the Sparkfun footprint as the model.
New version will use the Sparkfun footprint.

I dont need to solder the RF board on to the 'main' board, its just a plug-in, fit if required. One footprint does all.
The Sparkfun versions are available pretty much everywhere and now I have options to use RFM12's in the same socket or the RFM70.


RFM70 and RFM12

front







back










 The Sparkfun version.

This is what the new versions will adhere to.

RFM12 water meter

The latest use I have for the RFM12 mini-node is to monitor the water I'm using on keeping my garden alive.

Where I live, there is no public water supply, ALL of my water comes (directly) from rain. This is collected on my house and shed roof areas and stored in several tanks.
At long last I fitted an irrigation system that waters the garden around my house, but then I wondered, how much water am I actually using?


I purchased a 3/4" flow meter from littlebird electronics (and available from several other suppliers).

It is spec'ed at 5V but runs fine at 3.3V with clean edge transitions and 0-3.2V switching on the sensor o/p (using the internal pin pullup)

Without the sensor connected, the node board (in active mode) consumes about 0.5~0.6 mA. This is at 1Mhz.
With the meter connected this jumps up to a whopping 3.2mA if the sensor is giving a 'zero' or 2.6mA if its a 'one'.
Its a bit high for comfort.
When paired with the solar charger this should actually be fine.
The solar panels are supposed to give 170mA (I measured just over 150mA).
If we round up the consumption to 4mA and then have 18hrs of no charging per day, (18 x 4), that's only 72mA/hrs. This takes less than 30-min of good charging to replace the used energy.
I have a stack of 1000mA/hr single-cell Lipos as that is what is used in the garden lights so one of then should let it run for (theoretically) about 250 hrs in the dark, just over 10 days.

The 1st attempt software is done. The board keeps a running total of water through since powered up and also the water through in the last minute.
From the data-sheet, if I got my sums right, it gives a pulse for each 3ml of water through the meter. This will only be so within the specified flow-rates (see here) but I'm not needing a precision device, just an approximation. If its within 5~8 % it will be good enough for my purposes


Another possibility I have not tried yet is to tie the 4 free port pins together and see if I can power it from them directly.
The trouble with that is I would then have to find another way to detect the water staring to flow.
If I managed to use three pins, that leaves an analog i/p free.
Perhaps a piezo sensor on the pipe. Or a micro hydro generator that gives power from the water flow so no batteries required.
Or fit a micro-switch over the anti siphon vacuum breaker that is already installed on the pipework. Its a simple little valve that when the pipe is pressured, it pop's up, pushed by the internal water pressure, and closes a seal. When the pump is off and the pressure drains out of the system it releases and lets air into the pipework so my water tank does not siphon out and empty itself.

I think I'll make one for the shower next. Its probably the largest water consumption item I have. If you have ever had teenagers in the house then you know what I mean....


Solar charger for RF nodes

In my remote nodes, they currently use alkaline batteries. These will run a node for perhaps 12~18-months. It depends on how much they send and how often and what type of heat cycling they are exposed to.

Typically on a temperature node, I send the info every minute. This comprises of temp and battery voltage.
The duration that the RFM12 is actually powered-up and transmitting is a large proportion of the power drain so if the string that is sent is longer, ie it goes from 15ms to 30ms, thats a doubling of power consumption. If you send more, batteries last for less. Not really a surprise.

I wanted a solar option as one of my nodes in on the roof monitoring the solar hot water system. It has a Dallas 1-wire sensor globbed on the on the end of the tank, under the cover, with heat-sink paste.
I dont measure the tank internal water temp, but its close enough so I can see whats happening. The manufacturer has the electric thermostat mounted in a similar location. I reckon where I measure its about 3~4 Deg cooler than the internal temp.
This is a Thingspeak live graph of the solar hot-water system. Its logging most of the time but off now and again if I'm messing with it.
I figure if I put a solar one up there, I can just forget about it.

The board is pretty small, about 23 x 33 mm with a couple of mounting holes. It uses the same single cell Lipo charger IC as the garden lights, the CN3083.  I got them from Ebay


This is the circuit. Nothing fancy, pretty much off the data sheet with the monitoring dividers added.


I use it wired-in and as a plug-in.



The PCB on the left is my first 'real' version, a general purpose board that I use for assorted purposes.
The software files are on AVRfreaks but quite old now, Its evolved slightly but essentially the same. The core RFM12 software is almost unchanged.


RFM12 mini-nodes (Tiny861)

The latest evolution of the RFM12 module is a mini version using an AVR TINY861
Design files are on AVRfreaks.


This is it, top and bottom
White connector on the left (3-pin) gets used as a one-wire port, its +V, GND and a port-pin

The other white connector is +V, GND and 4 analog i/p port pins
Also sporting a 6-pin programming header + LED.
After-all, its not really electronics if it cant have a flashing LED.

Schematic as shown, or a PDF version here
Boards are fairly compact, 35mm square.

The PCB's were produced in Kicad and manufactured by Seed Studio's PCB service.


These work well when paired with a solar charger + L-ion cell. The charger was an offshoot from the solar garden lights , also on the blog.





The small board on the right of the picture is a single-cell Lipo charger.
Its used here with one of the Tiny861 RF nodes (above). The charger board, as well as supplying the battery voltage to power the node, also gives out monitoring voltages (resistively divided) for the panel and battery voltages.
Charger is here

Wiznet in AVR assembler

I've been exploring the use of the Wiznet W5100.
I have a logging/serving system at home using a Freetronics Ethermega. It runs as a combined web-server and logging client.
The Ethermega has on board the W5100 ethernet chip and a mini SD card socket. Ideal for serving web pages.
Assorted RFM12 nodes send back sensor data which is collected and then available on the web pages. Much of this data is also logged to Thingspeak and Nimbits.
The web related stuff is all done in the Arduino environment and that has become my problem.
So far, it just is not reliable. There seems to be a lot of stuff out there about the problems with the Arduino Ethernet implementation.
In my case, it is just as likely to be my software as I write C at kindergarten level. I just aint very good at it!
I lack the knowledge to dig into the libraries to add/modify/diagnose.
So I started on an AVR assembly language version for the W5100.
Once the W5100 version is done, I have a W5200 module just waiting for its turn. Its TINY and has a power-down mode.

Masochist? perhaps...

The easy way to start was to use a WIZ811MJ module, commonly available and reasonably priced.


The client side is done, I can post data to Nimbits and Thingspeak. A couple of days back I signed up for a free PROWL account and pushed data to my Ipod touch. It was quite straightforward so that was a pleasant surprise.
Server side is done in the sense that it can serve pages from flash but not yet from any other medium.

Just getting to grips with DNS as I dont like to hard-code IP addresses.
Its a working skeleton and I get responses back now and can (at last) understand them. Next bit is to make a parsing module to find and extract the data, shouldn't be too difficult.
Then its on to NTP requests.

So far, with client/server/DNS/serial/timebase and other support routines,code size it at 4.5K, another 1,4k used for data so not too bad yet. Its by no means optimised.
I mostly use Mega328's so space will not be a problem for a while.

The client and server are done as state machines so the software (as part of the operating main loop) checks in to see if anything needs doing. It is designed to be non blocking for the 'main' application so the micro can continue with other tasks and as the web system needs attention, it gets it.
At this point it is not interrupt driven and so far during the learning process I'm only using one socket from the 4 available.

The starting point for my code was mainly from a contest entry, the WIZnet iEthernet Design Contest 2007 by Chuck Baird.
This enabled a good start to getting things going.