Every coffee roaster needs ethernet…

Ok… not really but today I decided to see if I could get the Ethernet card talking to the internet.  After experimenting with the NTP demo code as well as some web servers and clients I tried implementing a NTP query while it was booting.  During this process I noticed it needs to have some sort of loop going to check for the UDP data to be made available.  I’m pretty sure it was working getting the Ethernet initialized but it just never gets an NTP response during the first initialization and send.  I think the demo code only works due to the repeated loops over and over and randomly misses 1 response here and there.

I need to work on implementing a time zone calculation, the loop to check for NTP until it either gets one or fails a specific number of times, and then the code to translate the NTP packet buffer contents into a valid time/date setting to go into the RTC.  I also downloaded the libraries to install into Processing to make the graphs work over ethernet. It will take some time creating the buffers that it’ll read but it should work pretty well.  I’m hoping to also get it to list out the SD memory and allow me to download the individual files to the laptop through that connection.

Yesterday I purchased the last of the resistors I needed and managed to get the schematic worked out for the button pad with a decent enough layout on the PCB.  I need to solder them together but haven’t gotten to it yet.  I will have that portion built sometime this week and need to determine how often I need to sample the button presses to detect a forced cool setting at the least before I start building a menu system to set up roasts and start them.

More fun today was that I learned the system won’t compile under Arduino IDE 1.0.  I fixed a series of changes due to BYTE no longer being supported in the Serial.print commands (use Serial.write and then number you are sending).  They changed the name of one of the header files that gets used in almost every add on library out there.   Next I discovered that I2C has a bug in the Wire library that didnt make it into 1.0 that it won’t send a 0 to the I2C bus without a typecast being applied or patching other sections of the code.  Finally I’m getting some sort of illegal conversion from an int to a char or something like that on several lines.  I hope to have the system converted over the Arduino IDE 1.0 before the end of the month but I’m not going to put a lot of effort into it unless I run into a library I need to use that needs 1.0.  I’m not really anticipating that happening but I’ll work on it anyway.

Bookmark the permalink.

One Response to Every coffee roaster needs ethernet…

  1. SteveS says:

    So tonight I realized that the NTP started acting buggy AFTER I initialized my RTC. When the NTP check was before the RTC init it worked dead on. The moment it was below the RTC init it either wouldn’t return a date/time or else it was some totally erroneous number that didn’t make sense. This is similar to what happened when I started trying to get a few other SPI devices working. The reason is the Ethernet is running SPI Mode0 while some of the other devices were running SPI Mode1. By inserting a SPI.setDataMode(SPI_MODE0); before I run the NTP everything works fine. Elsewhere in the code it was using SPI_Mode1.

Leave a Reply