Show Posts
Pages: 1 [2] 3
16  Community / Exhibition / Gallery / Re: Small server/logger/gateway based on ATMEGA1284 on: July 06, 2013, 07:05:59 am
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 smiley as I'd like to keep within the 50mm x 50mm size. I'll see how things work out with this one first.
17  Community / Exhibition / Gallery / Re: Small server/logger/gateway based on ATMEGA1284 on: July 05, 2013, 10:25:45 pm
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 smiley Everything has now been tested and works.

18  Community / Exhibition / Gallery / Re: Small server/logger/gateway based on ATMEGA1284 on: July 03, 2013, 11:53:51 pm
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 smiley-sad ).
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... smiley
19  Community / Exhibition / Gallery / Re: Small server/logger/gateway based on ATMEGA1284 on: July 03, 2013, 10:00:15 pm
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
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

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 smiley
I'll run it for a few weeks and see how it behaves.

20  Development / Other Hardware Development / Re: Best place to fabricate custom Arduino PCB on: July 03, 2013, 07:09:35 am
I just built my first custom Arduino variant. I'm just in the testing process but when its done, it will be open hardware PCB.
Layouts are done in Kicad, I get my boards done at Seed-studio. $10 for 10 boards (+delivery)

I like the MEGA1284, it has an extra 8K ram than the MEGA2560 and a smaller footprint.

Writeup and pictures are in the forum at...

I also needed a board similar to what you require and ended up making my own. Quite a fun exercise and educational smiley
Here is a picture....
21  Community / Exhibition / Gallery / Re: Small server/logger/gateway based on ATMEGA1284 on: July 03, 2013, 02:59:43 am
First build is looking reasonable.
So far tested SD card, RTC, Ethernet, Serial comms.
Still to try radio system.
Some small tweaks needed to the PCB but nothing major has shown up so far. Plenty of time for that smiley
You have to log-in to see the board photos.
22  Community / Exhibition / Gallery / Small server/logger/gateway based on ATMEGA1284 on: May 29, 2013, 02:08:42 am
I never managed to find a board that had all the bits I commonly use so in the end I am having a go at making one.
The attached PDF has the essential details. Layout is done. I'm just procrastinating before sending it to get a batch made from Seedstudio... Its hard to stop tweaking...
The board uses a 6-pin Atmel programming header, not a Arduino programming type.
If there is interest, I'll make it available. If it all tests out OK smiley

It has:
RTC with battery backup
Micro-SD card
Radio (nRF24L01 or RFM12 or RFM70/73)

I'd be interested in comments before I get it produced for testing.


- PDF updated 4-Jul-13
23  Using Arduino / Programming Questions / Re: Manipulating an array of ram strings (how to?) on: March 26, 2013, 04:40:40 am
Thanks everyone for the extremely rapid help!

I tried both the 2-dimentional array and the strcpy() and they both achieve what I need.
I was just confusing myself with & (reference) and * (dereference) of pointers and getting nowhere.
The reason for the strange initialization values was just so I could see if what I was printing for diagnostics was what I thought it was. They are fixed length ascii temperatures that arrive by RS485 for storage and web-page viewing and logging.
I just start them off at zero rather than have nothing in them.
I'll opt for the 2-dimentional array and see how it all goes smiley
Thanks again....
24  Using Arduino / Programming Questions / Manipulating an array of ram strings (how to?) on: March 26, 2013, 03:07:06 am

If I define an array of fixed length text items like...

char* temps[] = {" 000.00"," 000.01"," 000.02"," 000.03"," 000.04"," 000.05"," 000.06"," 000.07"," 000.08"," 000.09",};  // ascii string of temperature

I can display one of the entries by...
Serial.print (temps[3]);
which shows  000.03 as I'd expect.

as stuff happens in my program I try and update an entry
ie elsewhere I have a string of the correct length called 'temptemp', this hold different values on each pass of a loop

How do I change the contents one of the items in the 'temps' array to the new value?

If I do temps[3]=temptemp , then temps[1]=temptemp next time round, all the values I try and display always show the same (latest) value.
I suspect I'm just changing the pointers to the latest value but how do I modify the actual data?

I have read stuff about strings and pointers but cant figure out how to apply it to this case  smiley-sad
Any help would be welcome..
25  Using Arduino / Networking, Protocols, and Devices / Re: Ethernet stability on: March 25, 2013, 10:12:32 am
Yes, you are right about no (in the W5100 anyway) receive timeout. I dont understand the Ethernet library enough to know if it is in the software or not.
I was getting mixed up with the connect/transmit timeout. I implemented a receive timer in my assembly language version for just that reason or, as you say, you never get out of the loop.
I kept a stack of testing logs when I was working on the client side so I just had a look through them and right enough, the receive timeout error crops up several (2~5) times daily for Thingspeak. It tends to happen around the same period as 502 gateway unavailable conditions, also a daily occurrence. I put it down to server loading during busy periods, where it could not keep up (?)
The other errors that repeatedly come up are...
While waiting from a response to the connect request, a close arrives from the remote end, or...
Connection request simply times out.
At least both of these are simple to deal with, but as you pointed out, the receive side can just hang forever. I suspect that will be the source of at least one of my problems so thanks for highlighting that one.

The timeouts/bad-gateway errors seem to not happen for ages then a block of them appear off and on for perhaps 20min, then all back to plain sailing again. Its quite possible that sometimes the Arduino would get 'stuck'  at this point, but also possible for it to get lucky and sail through and not get caught till another time.

I'll try with the timeouts in place and see how it goes.
26  Using Arduino / Networking, Protocols, and Devices / Re: Ethernet stability on: March 25, 2013, 08:17:45 am
I thought that the read-from-client part that you have inside your timeout section should not be able to happen (in theory...)
The Ethernet library has a timeout and retries built into it and if the connection hangs while waiting for data then shouldn't the library force-close the socket? thus allowing exit from the wait/read loop?
Perhaps this force-close fails if a flush is not done first? or is it?
I'm just speculating here as I don't understand the internals of the library, which is what prompted me to do it in assembly.
I'd still rather understand whats happening in the high-level code  smiley-confuse

Do you know if its possible to read the W5100 socket status register?

That would certainly help me with trying to pinpoint where things are going wrong, or at least perhaps rule some things out.

27  Using Arduino / Networking, Protocols, and Devices / Re: Ethernet stability on: March 25, 2013, 06:26:18 am
Its static IP
Also, In my attempt to reduce the potential of memory leaks/allocation problems I made almost everything global scope variables/arrays while monitoring free memory to see if it was getting eaten up by something. Bad practice from what I understand but if it nails everything down and removes a possibility then I can live with it for now. Currently 4473 bytes free.
Strings in Flash, static IP addresses except for a NTP access on boot and every 24hrs.

 - I just noticed that your timeout code just did its thing on a Nimbits post  smiley. I'm watching the status as I tinker...

28  Using Arduino / Networking, Protocols, and Devices / Re: Ethernet stability on: March 25, 2013, 04:51:28 am
Hi Nick,
No, it wont on its own. In my original post I said..

"I include the logging code here so perhaps someone may spot something I'm doing wrong. It is only a section of the complete code".

I was hoping that someone may spot an obvious error in the section of code that does the POST.

The complete code is spread through five modules and is fairly large now.
One for the server and temperature retrieval, one for power switching, one each for Thingspeak & Nimbits and one for NTP
29  Using Arduino / Networking, Protocols, and Devices / Re: Ethernet stability on: March 25, 2013, 03:12:37 am
Thanks Tim,
I have incorporated your timeout into my code and will see if it makes a difference.
To date, about 3.5 days of uptime is my best. I'll be interested to see if this now changes (my fingers are crossed....)

30  Using Arduino / Networking, Protocols, and Devices / Re: Ethernet stability on: March 24, 2013, 11:40:58 am
Hi book_woorm,
I have never been able to find a definitive answer but I have noticed that the length of time before lockup/crashes is maximised by not using DNS lookups so I use hard coded IP addresses.
Its not good as a long term fix but it makes a crash rate of hours turn into days.
The only section I still use a lookup is once every 24hrs I do a lookup for a timeserver at If my home router had a timeserver function I could even hard-code that IP addr as well.
I have read many theories about the reasons for this, lack of memory often seems to come up as a possibilty. (have you seen the Goldilocks board?, 16K ram!)
To get around my lockups, I use the watchdog timer to reboot the board. It always seems to come back up OK.
On my Arduino server, I have an uptime timer (days/hrs/min/sec) so when I look at the page I know how long its been since its last reset.
What I dont differentiate (yet) is whether a reboot is due to an ethernet lockup or a string of five consecutive logging-service post failures. I will remedy that soon.
It seems that the logging sites can miss quite a few posts in busy times, at least thingspeak can, nimbits seems more reliable in that sense.
This is only my personal experiences.
One thing you are doing that i dont is writing to the SD card. I just read from one. I'm not sure if writing uses more ram.
Good luck with your coding, I hope you find some answers smiley
Pages: 1 [2] 3