Small server/logger/gateway based on ATMEGA1284

Hi,
The board is programmed by SPI.
Just before manufacture I added a DTR pin with the required resistor and cap so it should be possible to use a FDTI basic serial adapter for downloading. This is not tested yet. Arduino bootloaders are available for the Mega1284 but I just have not had time to actually try it.

The strip of holes on the end of the PCB has a footprint for a Sparkfun radio SparkFun Transceiver Breakout - nRF24L01+ - WRL-00691 - SparkFun Electronics
I used this pinout because the Sparkfun units are available from distributors all over the world.
So I could use other radio options, I also made up breakout boards for other radios. The RFM12 and RFM73 can be used in the same place.
The breakouts are in the style shown at http://www.byremote.blogspot.com.au/.

At home I currently use a Freetronics Ethermega which runs logging to Thingspeak, a webserver to view/control some stuff and RS485 to talk to a RF gateway (the RF sensor interface). With very minor tweaking to add the reset/power-down additions for the Wiz820 it ran fine on the new board. It was a bit of a surprise :slight_smile:
I'll run it for a few weeks and see how it behaves.

Made me smile reading you found C a bit hard going at first as your preferred language is assembler...

I still find C hard. I can get by with basic stuff but my C is probably 'bad' C.
I have tried (unsuccessfully) to figure out whats going on in the Ethernet libraries but its just beyond me. Arduino ethernet has always given me problems with long term reliability but I find C difficult (C++ is harder :frowning: ).
I have had some valuable help with ethernet from members of this forum which has improved things for me but reliability issues persist. At the end of the day, Its probably my programming.
I have started to write assembly drivers for the W5100 and its going OK. They are not as generally comprehensive as the C ones but in my embedded application thats not an issue as I can see everything thats going on and insert diagnostics into the code wherever I want. I cant do this in C libraries because I dont know how.
One of the items I implemented in the mega1284 board is the reset and power-down pins of the Wiz820 are connected so I can fully reset the module and re-initialise on the fly. It may not make it more reliable but recovering from ethernet lockups will be more friendly. Not the best solution but for now its what I can manage.
Its a looooong learning curve... :slight_smile:

Great project,
I have done similar work, but using Atmga328+ENC28j60+RFM12B; I was always running short on resources, but then had no compatibility issues

Did you handsolder both sides?
If yes, I always wonder how ppl do that with QF44 packages...

As for the Sparkfun RF24 breakout board: I understand your choises to create a standard, easy to get breakout, but the tenfold price of a normal RF24 board is ridicolous.

A breakout board to hold the standard RF24 8-pin boards would solve this though!

Nonetheless a ver nice build! Any idea when you will release the design files?

Did you handsolder both sides?
If yes, I always wonder how ppl do that with QF44 packages...

I do the 'big' sm parts 1st. First, I go over the pads with a flux-pen, I hold the PCB in place with Blu-Tack so its raised and does not rock when trying to solder, then just flip it over and do the other side. I got lucky and found a cheap stereo microscope in a second-hand shop so that has been a great help. If no microscope then I use a pair of cheap magnifying reading glasses that you can get in the supermarket or chemists (+3.5), they work surprisingly well.

As for the Sparkfun RF24 breakout board: I understand your choises to create a standard, easy to get breakout, but the tenfold price of a normal RF24 board is ridicolous.

I understand, I thought the same. I have wondered about an adaptor for the cheap ebay boards, or just using its footprint.
I figured that this would not be the only version of this I produced. So far I have not found any actual mistakes in the build but there is things I would change after making the 1st one.
There is too much ground plane around the edges of the RTC battery holder, the RTC xtal footprint is not quite right, or perhaps a different package would be better and the drill size for the edge holes was a bit big so not much land left on the pads. more may come to light in time.
This 1st PCB is a 'tester' so I can see how (if) it all works.
When I do the changes I mentioned, I'll try the ebay version footprint.
I want to keep the board length under 50mm so it fits in the cheapest 5cm x 5cm PCB service from seedstudio (currently 49.5mm)
I'll test for few weeks and then make the files available (this version). The PCB's are done in Kicad, not eagle.

So far, so good :slight_smile: Everything has now been tested and works.

Thanx sofar for the info.

Nice that you want to limit boardsize, but what is the current size?

Furthermore, I see you are using 5V on the radio breakout board. All radios are 3.3V, so are the sparkfun boards using a 3.3V regulator by any chance?

Last but not least: is it possible to use (switchable maybe?) 3.3V for the complete board? About all the sensors I use require 3.3V or less! Board should still be able to run on 16MHz, as JeeNodes also run on 16MHz without any problems on a 3.3V power supply.

Happy testing!

current board size is 49.5 x 32mm. No particular reason at the start, it just had to be wide enough for the ethernet module, the pins on the outside edge and a little bit more.
Initially I did not expect it to all fit but after a few iterations it did. I was struggling a bit towards the end.
If I do another version, I'll make it an extra 0.1" wider to maintain the breadboard pluggability and just give me a bit more room to play with.
The Sparkfun radio has a 3.3V reg on board, as do my RF breakout boards so 5V was fine for that. I needed 5V at that end of the PCB for the RS485 and the RTC so it was just convenient.
I get what your saying about running it all on 3.3V, even at 16Mhz, but I want it to be able to run at 20Mhz, or 22.1184MHz (as per the soon to arrive Goldilocks board). I dont think I'd get that at 3.3V.
I could fit more on in the way of power options if I use more of the whole 17.5mm I still have available :slight_smile: as I'd like to keep within the 50mm x 50mm size. I'll see how things work out with this one first.

If you want the 20MHz or more, you have no choice than to run it at 5V. I was to late for the Goldilocks board, any idea when you will receive it?

But for a max of 16MHz there is hardly any reason not to use 3.3V. Running it on batteries makes it even more important to use 3.3V or even 3.0V.

Your board is small and still easy to extend with the SD, LAN and radio 'shields'. I hope testing is going strong and that we can welcome the final design soon :cold_sweat:

Testing is going well :slight_smile:
I'm currently running a test sketch that is a server, client, logs to SD card with time/date from RTC. I'll let it run for a couple of weeks and just see how it goes.
The radio system was tested with Maniacbug's RF24 library and after assigning the pins it worked straight-away, reading the key-presses from a Nordic keyfob.
Running from just 3.3V is a good idea. I thought about it early on and figured that I could just feed it with 3.3V externally and link out the 3.3V reg.
It makes more sense to keep the reg and put some kind of link/jumper on the PCB so that the on-board regulator is always used.
Its a linear reg so pulling too much current will make it hot quick, and the one I used (MCP1826) has a absolute max input voltage of 6.5V. While running my test sketch, it is slightly warm to the touch, no heatsink and a 5V i/p.
Running everything from a 5V plugpack through the reg should be fine, but only testing will tell.
The regulator has a very low quiescent current and pretty low dropout so its reasonable for battery use if the micro is in power-down mode to conserve energy. The Wiz820 power-down is connected so it can be shut down in power critical situations that require ethernet.
There is a drop-in replacement RTC that runs on 3.3v (DS1338) and also RS485 chips for 3.3V so the whole board functionality will still be available, which is a requirement for my intended uses.
So far I'm happy with the results.
I need to make up another couple, one at 22.11Mhz and one running at 3.3V, 16Mhz so I can try things.
And, where does all the time go.... ?

Stewie:
Testing is going well :slight_smile:
I'm currently running a test sketch that is a server, client, logs to SD card with time/date from RTC. I'll let it run for a couple of weeks and just see how it goes.
The radio system was tested with Maniacbug's RF24 library and after assigning the pins it worked straight-away, reading the key-presses from a Nordic keyfob.

That is very nice to hear... 8)

Running from just 3.3V is a good idea.
[...]

That is even better!
It seems this board is applicable for the full range of my applications with the standard RTC, and optional SD, LAN en RF cards. Even more than the Goldilocks board (shipping in August??) now that I compare the two :astonished:
Most of the apps will only need the RF card (RFM12B or NRF24), and only a few the SD/LAN/RF combination. And because of this flexibility, I for instance don't need the Arduino shield compatibility and really like these kind of boards!

I need to make up another couple, one at 22.11Mhz and one running at 3.3V, 16Mhz so I can try things.
And, where does all the time go.... ?

A well, so many possibilities and options to make the ultimate and easy to extend Arduino compatible board!

BTW: Could the RS485 chip be left out if not needed?

If you get your own PCB's made when the design files are available, you can just fit the components you want, bridging out the RS485 driver will let you still use the serial channel, but at logic-levels.

When I release the files, the PCB artwork will be in a zipfile, just email it to seedstudio, pay the low fee and a few weeks later your very own batch of 10 boards will arrive.

There are refinements I want to make for a next version, perhaps a LED on the board and a reset button. I really want to keep to 1206 resistor/cap packages as for home assembly they are quite manageable, and to keep away from the tiny sm footprints as I just cant work with them. I did have to resort to three 0803 components, the xtal caps and a ferrite bead.
Perhaps some solder bridges for power and 2nd serial options. I'm trying things to see what I can fit.
At this point, I dont have any way to sell these, or even have an idea if people would want them. I made these with my requirements in mind, ie the RS485 port is not a common requirement. I can probably make it optional (bypass the chip) so in that regard its more generally useable.
So I'll just keep on with the testing and trying to fit any modifications I can think of (or are suggested)

I was lucky enough to be one of the Goldilocks backers, I cant wait to get mine.
Its in a completely different class from my effort. It is a very well engineered board and a huge amount of effort and thought has gone into it to make it one of the most 'serious' Arduino's I have come across, suitable for complex and diverse applications, even using the two CPU's for independent programs and communicating between them.

I just thought of the bits I wanted, crammed them into a small space and figured its worth a try... If its a dud then its not the end of the world. If it all works then happy me.
I just like making stuff :slight_smile:

Stewie:
If you get your own PCB's made when the design files are available, you can just fit the components you want, bridging out the RS485 driver will let you still use the serial channel, but at logic-levels.

When I release the files, the PCB artwork will be in a zipfile, just email it to seedstudio, pay the low fee and a few weeks later your very own batch of 10 boards will arrive.

There are refinements I want to make for a next version, perhaps a LED on the board and a reset button. I really want to keep to 1206 resistor/cap packages as for home assembly they are quite manageable, and to keep away from the tiny sm footprints as I just cant work with them. I did have to resort to three 0803 components, the xtal caps and a ferrite bead.
Perhaps some solder bridges for power and 2nd serial options. I'm trying things to see what I can fit.
At this point, I dont have any way to sell these, or even have an idea if people would want them. I made these with my requirements in mind, ie the RS485 port is not a common requirement. I can probably make it optional (bypass the chip) so in that regard its more generally useable.
So I'll just keep on with the testing and trying to fit any modifications I can think of (or are suggested)

You should be putting your own requirements on top of course. I guess you could make modifications for the rest of this year by implementing wishes from other ppl. On the other hand, I don't see so many other ppl showing interest =( It seems not many run out of the 328P RAM/ROM space, and thus requiering something like a 1284P.

Looking at my own personal wishes: running the board on 3.3V is currently the most important one. A better RTC like the DS323x would be nice (but more expensive, and much larger size, ie probably difficult to fit) and some extra I2C and SPI headers for easily connecting sensors also.

I was lucky enough to be one of the Goldilocks backers, I cant wait to get mine.
Its in a completely different class from my effort. It is a very well engineered board and a huge amount of effort and thought has gone into it to make it one of the most 'serious' Arduino's I have come across, suitable for complex and diverse applications, even using the two CPU's for independent programs and communicating between them.

The Goldilocks board is indeed a well thought, high quality 4-layer board, but no pluggable LAN and only a 6-pin extension header for RF cards (couldn't get 8-pins to fit due to the Arduino compatible holes). All the Freetronics boards have the prototyping area. I guess if that wasn't necessary the LAN/RF headers could have been added.

Because of this your board fits my needs much more... Next to that, I have some breadboard designs that are running for a few years without any problems, so I don't seem to be in need of high quality, factory grade stuff XD. That these breadboard designs do work so nicely is a bit of a surprise (to me), as I'm not a hardware designer :blush:

Pricing will probably also something different. 10 PCB boards for around €10-€15, ie €1.50 / board. Then €6 for the 1284P, €2 for the NRF24, so I guess the total board (without SD/LAN shields) won't be more than €15... Priceless $)

I just thought of the bits I wanted, crammed them into a small space and figured its worth a try... If its a dud then its not the end of the world. If it all works then happy me.
I just like making stuff :slight_smile:

The 1284P, as I'm always running out of RAM, certainly combined with LAN, is the key factor for me. I'm also looking for a board that could become my standard board to use for several prototypes (and thus re-use of software). Next, I like the formfactor. It fits a standard, cheap 1591M Hammond case nicely. Even if you would extend the board to the 49.5x49.5mm limit as Hammond has 85x56x21mm, 85x56x35mm small enclosures (inside is just over 51mm, so a perfect fit) and a bit bigger the 112x62x27mm and 120x65x36mm ones. The larger boxes can even fit two of these boards, giving you dual-core 1284P power!

for enclosure sizes, dont forget that the radio either sticks up, or behind.
I'm looking at both options, I'm tending towards a footprint that allows a right-angle connector on the rear of the PCB so the radio sticks-up. This allows a vertical radio, or if no Wiznet module fitted then a vertical connector so the radio is above and parallel to the main PCB.
Not sure if some kind of screening would be required between the micro and the transmitter but with such close proximity its certainly worth considering.
-The above is with the cheap ebay nRF module footprint (2x4 pin)
I'm experimenting with other PCB options. Solder bridges if no RS485 fitted seems OK, reset button is OK, LED should be fine but not done yet and still considering power options.

Martins Funky v2 (http://harizanov.com/wiki/wiki-home/funky-sensor-v2/) has the Atmega 32u4 and a Hope RFM12B sandwitched together, so I guess not much of a problem having them very close together.

It probably will be OK.
One of my boards is a ATtiny861 with a RFM12, at http://byremote.blogspot.com.au/2013/03/rfm12-mini-nodes-tiny861.html , is quite similar but slightly larger, its never been a problem for me. The RFM12 works at 433Mhz. I wondered if 2.4Ghz might be more of a problem. It comes down to try and see I suppose.
If your interested, the design files for the atTiny board are on AVRfreaks.. http://www.avrfreaks.net/index.php?module=Freaks%20Academy&func=viewItem&item_type=project&item_id=3848

Tested with an Arduino bootloader, seems OK. Not tested with a HUGE sketch yet, I'll have to embed a large table and try that so it is across the 64K boundary.
The bootloader is a slight tweak of the Goldilocks one, built for 16Mhz and a different LED pin.
I also tried 22.11Mhz but the oscillator was not rock stable. Waiting for some different XTAL cap values to turn up and also for different xtal manufacturer version.
On 22.11Mhz, delay() was out by up to 25% (running too slow), but the serial bootloader loaded at 115K with no errors.
I enabled CLK-OUT and checked it on my scope. It certainly seems like the right frequency (counted 10 cycles on the screen and did the sums) and if the bootloader is happy at 115K, it cant be too far out.
I wonder if something is overflowing in the timer chain that derives the delay. More investigation required.
At least the 16Mhz tryout seems all good. Its been serving/posting and logging for some time now and no issues. A goodie-bag from mouser arrives tomorrow so more building to do :slight_smile:
I just upgraded to AVRstudio-6.1 and the Arduino plugin from http://www.visualmicro.com/ . Its looking very promising! A real editor/IDE with debugging features, and all the Arduino functionality available.

Thanx for the update!
Good to know that the Arduino bootloader works, same for the 16Mhz build.

wrt the 22Mhz version: I assume you made a different board type with the 22.11Mhz as CPU speed?

And what does the goodie-bag bring? More CPU's & stuff??

I tested AVR Studio also with the Arduino plugin. Its nice, but I like CodeBlocks a bit better. Donno why, but it seems easier to use (and faster...).

I've built up a few boards now for testing purposes, The 22M version is one of them.
On digging into the Arduino code for the problem with the delay() times, from what I can see (and I'm not really a software person), it looks like the delay code is only going to produce valid results for 8 or 16Mhz. Anything else will give wrong results. This is a bit of a pain. Its probably fixable but this will involve modifying some core files and I'm not too keen to go down that path, and not really sure how to. 22.1184Mhz is good for accurate baud-rates and loading at 115K, but a non-friendly number for deriving a 1ms counter.
I'll live with it for now as its not a show-stopper and everything else seems to be good. 16Mhz is fine and Arduino delays work as expected.

I got a batch of 1284P's from Mouser, + assorted other support components. This will let me make up the basic boards without the extras and have some available if people want one.

I tried codeblocks but it seems to have issues running on my XP virtual machine. Took ages to load and each time I tried to do anything, there was a 20~30 sec delay before anything happened. I'll stick with AvrStudio for now.

Stewie:
I've built up a few boards now for testing purposes, The 22M version is one of them.
On digging into the Arduino code for the problem with the delay() times, from what I can see (and I'm not really a software person), it looks like the delay code is only going to produce valid results for 8 or 16Mhz. Anything else will give wrong results. This is a bit of a pain. Its probably fixable but this will involve modifying some core files and I'm not too keen to go down that path, and not really sure how to. 22.1184Mhz is good for accurate baud-rates and loading at 115K, but a non-friendly number for deriving a 1ms counter.
I'll live with it for now as its not a show-stopper and everything else seems to be good. 16Mhz is fine and Arduino delays work as expected.

If you didn't make a different board type for 22Mhz (AFAIK), then it defaults to 16Mhz. But I might be wrong..., as I never did that route.
Great that the testing is good for the default 16Mhz speed. And you can upload sketches using the standard Arduino serial?

I got a batch of 1284P's from Mouser, + assorted other support components. This will let me make up the basic boards without the extras and have some available if people want one.

You can count me in for at least 1 board, maybe 2 8)
You did made changes compared to the original boards you posted in the OP?

I tried codeblocks but it seems to have issues running on my XP virtual machine. Took ages to load and each time I tried to do anything, there was a 20~30 sec delay before anything happened. I'll stick with AvrStudio for now.

No problems with CodeBlocks here, but I have them with KiCad. I never used it, so I'm new to that program. Made, using some tutorials, some very basic pcb's with a few resistors, caps, switches and so on. And now when I want to use the autorouter, and thus must use the export to spectra dsn files, pcbnew simply crashes, it stops, without any error message. Very frustrating I must say as I have no idea why! Even if I - as a beginner - did something wrong, it shouldn't do this ]:smiley:
Not all pcbs I made suffer from this. It seems that if I change something after making a pcb, this happens, but I'm not sure yet!

Are you btw using the default KiCad libraries, or do you use other libraries?