Showing posts with label Ethernet Shield. Show all posts
Showing posts with label Ethernet Shield. Show all posts

Saturday, May 31, 2014

Components - Arduino Web Logger

Diagram of Arduino Web Logger Component

Let's log ADAM-4017's AD value every 500 ms.
We are going to make 512 bytes long block every 1 minute and write that block to the SD card in Ethernet Shield.

Data Block Component.

  • Used Flag: 4 bytes
    Set it to 0xaa55a55a.
  • Time Stamp: 4 bytes
    This is only the sec part of POSIX time_t value.  We are not going to use the millisecond, thus we are going to multiply the value by 1000 (*1000).  It is 32 bit unsigned integer.
  • Data: 4 bytes float value.  It is going to be sampled twice every second.
    1 minute measurement: 2 * 60 * 4 = 480 bytes
    Second is going to be offset.
    For example, The offset for second measurement in 27 second will be 8 + 27 * 8 + 4 = 228.
    Set the unmeasured values to -99.999.  When initializing the block set everything to -99.999.
  • Backup: 24 bytes, set it to Null.

Data File.

Logging is going to be one File.

In FAT32, the biggest file size is 512 * 232 = 241 = 2,199,023,255,552 = 2GB.  Even the smallest SD card is bigger than 2GB.  With 2GB, we can log for 2,199,023,255,552 / 512 / 60 / 24 / 365 = 8,217 years.  Thus memory is going to be full approximately after 8,000 years so we don't have to worry about that.

Data inside File are going to be in time order, which will allow us to retrieve Data Block from certain time very quickly using the simplest Binary Search.  However, adjusting the RTC clock due to whatever reasons will screw this up.  ( Getting deeper into this is too much for this posting, so I am going to skip it. )

Web DB.

Arduino cannot hold all this log data like Browser might hope.  If the browser wants to look through a year long data "very quickly" it's impossible.  Thus, browser is going to keep log data in its database and once in a while connect with Arduino to get the most recent log and update its DB.





Friday, May 30, 2014

Testing: Temporary Test Board(volume) + ADAM-4017 + RS485 + Arduino UNO + Ethernet Shield

Temporary Test Board + ADAM 4017 + RS485 + Arduino UNO + Ethernet Shield

I tested connecting volume to CH0 of ADAM-4017.
I used same source voltage.
Because input range is set to ±10V, if voltage is over +10V Arduino code shows it as +10V.
I didn't cut the board because I was too lazy it is easier to turn the knob with the board like that.

Schematic for volume attaching

I am attaching schematic for volume attaching just in case.
CH0 - CH5 on ADAM-4017 is differential, and CH6 - CH7 is single ended.
Thus, Vin0- has to be set to GND.





Tuesday, May 20, 2014

UNO, Ethernet Shield - Web/Arduino/Adam

UNO

I used UNO, the most basic Arduino model.

The one I purchased is from the following Korean site, and it is not the original version.
http://www.nulsom.com/
You could purchase it from other sites ( a lot of them sell it ).
http://eleparts.co.kr/EPX7R9BJ
http://devicemart.co.kr/goods/view.php?seq=38296

This machine gives off a lot of heat ( enough heat to make me worry about the PCB ).

Arduino UNO from http://www.nulsom.com/





Ethernet Shield


This is an original, I purchased it from plughouse (Korean site).
http://www.plughouse.co.kr/shop/goods/Goods_view.php?G_code=102705472330

Ethernet Shield





UNO + Ethernet Shield + RS-485 Shield

Let's stack all 3.

Arduino UNO + Ethernet Shield + RS-485 Shield





Photo with ADAM!

Arduino UNO + Ethernet Shield + RS-485 Shield, Adam-4050, LED & Switches