All times are UTC + 8 hours




Post new topic Reply to topic  [ 29 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Apr 11th, '13, 05:19 
Offline
Bordering on Legend
Bordering on Legend
User avatar

Joined: Jan 18th, '11, 08:29
Posts: 422
Images: 0
Location: Western NC
Gender: Male
Are you human?: Unknown Cyborg
Location: North Carolina
I put together an Arduino-based temperature sender/logger and thought I would share the software.
It uses waterproof One-Wire DS18B20 temp sensors from eBay and an Arduino UNO and Ethernet/SD shield from dx.com (only costs $30 USD for both): http://dx.com/p/arduino-uno-rev3-develo ... ard-120464 and http://dx.com/p/ethernet-shield-with-wi ... lot-118061

Options (everything is optional so you can reduce code size, you can't use every option because the UNO only has 32K of program memory):
* Ethernet: Send temp/light values over UDP to a logging server/program
* Use DHCP for Ethernet or hardcode IP (DHCP uses a lot of memory so recommend hardcoding)
* SD Logging: Log data to SD card on Ethernet shield
* Time: Poor man's RTC, will query your logging server for the time on occasion to keep a somewhat accurate time (however accurate millis() is).
* Voltage-type light sensor (I don't have one to test so there could be bugs there)

Check the SENSOR_PACKET struct for making your own server, but you could easily modify it to send ASCII strings or whatever you want.

My temp sensors are using digital pin 2, but you can change it if needed. I have +5v/GND/Pin 2 going to a breadboard to attach my sensors to. The only thing else you need is a 4.7k resistor between +5v and pin 2.

If you can't run Ethernet you could use a WiFi bridge/router/gaming adapter or maybe those Ethernet over powerline adapters.

The program code is simple but the #ifdef's for the options have made it a bit of a mess, sorry.


Attachments:
temp_sender_1.0.zip [3.39 KiB]
Downloaded 414 times

_________________
LowCarbTNPer's Systems: [v3] [v2] [v1]

Arduino UNO Data Sender / Logger
Top
 Profile  
Reply with quote  
    Advertisement
 
PostPosted: Apr 11th, '13, 13:38 
Offline
In need of a life
In need of a life

Joined: Oct 26th, '11, 10:29
Posts: 1708
Gender: Male
Are you human?: super
Location: Australia, NSW, Sydney
Thanks. I didn't open the file cause I'm on my phone. Is logging server code included? If not, do you use a third party application or did u role your own?


Top
 Profile  
Reply with quote  
PostPosted: Apr 11th, '13, 22:23 
Offline
Bordering on Legend
Bordering on Legend
User avatar

Joined: Jan 18th, '11, 08:29
Posts: 422
Images: 0
Location: Western NC
Gender: Male
Are you human?: Unknown Cyborg
Location: North Carolina
My current server is a plugin for a larger data logging program (unfortunately due to licensing I can't give that code away).

If there is interest I can make a quick server program to log to CSV or MySQL or something

_________________
LowCarbTNPer's Systems: [v3] [v2] [v1]

Arduino UNO Data Sender / Logger


Top
 Profile  
Reply with quote  
PostPosted: Apr 12th, '13, 10:33 
Offline
Bordering on Legend
Bordering on Legend
User avatar

Joined: Jan 18th, '11, 08:29
Posts: 422
Images: 0
Location: Western NC
Gender: Male
Are you human?: Unknown Cyborg
Location: North Carolina
I made a quick server that logs to a text file and replies to time requests. I have included the source code (GPL except the win32 getopt I used which is LGPL) and compiled binary for Windows. It will also compile on Linux using g++.

There are only 2 command line options, -s X to change how often it logs to the file in seconds, and -p X to use a different port.

In the Arduino code I also updated it to only log data every 5 minutes to the SD card (you can adjust it of course).


Attachments:
temp_sender_logger_1.1.zip [70.14 KiB]
Downloaded 297 times

_________________
LowCarbTNPer's Systems: [v3] [v2] [v1]

Arduino UNO Data Sender / Logger
Top
 Profile  
Reply with quote  
PostPosted: Apr 12th, '13, 12:45 
Offline
In need of a life
In need of a life

Joined: Oct 26th, '11, 10:29
Posts: 1708
Gender: Male
Are you human?: super
Location: Australia, NSW, Sydney
Excellent. I might not get to use it straight away, but I'll will get to it after a lot of other work building a system. Cheers.


Top
 Profile  
Reply with quote  
PostPosted: Apr 12th, '13, 14:18 
Offline
Bordering on Legend
Bordering on Legend

Joined: Mar 3rd, '10, 12:09
Posts: 431
Images: 0
Gender: Male
Are you human?: yes
Location: Brisbane, QLD
my uno is still sitting in the box after I first tested it then realised I needed more of those one wire Waterproof sensors.

i'll definately have alook at your code, and probably steal much of it.

thanks for posting.

_________________
My system in Brisbane viewtopic.php?f=18&t=7129


Top
 Profile Personal album  
Reply with quote  
PostPosted: Sep 22nd, '13, 22:34 
Offline
Newbie
Newbie

Joined: Sep 22nd, '13, 22:23
Posts: 12
Gender: Male
Are you human?: yes
Location: australia
Hi Lowcarb, I am extremely interested in your creation,

, I am a newbie to Arduino but a long time grower and want to log temperature from greenhouse to a
flat file on a webserver and eventually to an mysql db.

What exactly am I setting up on my linux webserver, a cron job?
If you have some ref links etc or tips, most appreciated.


Top
 Profile  
Reply with quote  
PostPosted: Sep 23rd, '13, 04:48 
Offline
Bordering on Legend
Bordering on Legend
User avatar

Joined: Jan 18th, '11, 08:29
Posts: 422
Images: 0
Location: Western NC
Gender: Male
Are you human?: Unknown Cyborg
Location: North Carolina
The logging server will just run and log the data it receives every 300 seconds (5 minutes). You can use a cron job to automatically start it when your server reboots though. Source code is included so you can change the format or have it log directly to MySQL/MariaDB.

One thing I found out is it is probably better to make your own sensors. I got 2 cheap "waterproof" ones off ebay and one quit working right away and the other would just sporadically quit working for a while. You can get the sensors for free as samples from Maxim. (Make sure you get one of the ones listed here: http://www.milesburton.com/Dallas_Tempe ... ol_Library)

_________________
LowCarbTNPer's Systems: [v3] [v2] [v1]

Arduino UNO Data Sender / Logger


Top
 Profile  
Reply with quote  
PostPosted: Sep 23rd, '13, 10:26 
Offline
Newbie
Newbie

Joined: Sep 22nd, '13, 22:23
Posts: 12
Gender: Male
Are you human?: yes
Location: australia
I have been trying to compile as you mentioned to linux to run on my linux vps but cant manage to do it correctly? Is it possible to post the linux version of logger?? (I did try for last 2 hours :oops: )

Also once you have your flat file have you managed to plot a graph ie
http://www.jscharts.com/how-to-use-line-

thanks again


Top
 Profile  
Reply with quote  
PostPosted: Sep 23rd, '13, 10:32 
Offline
Bordering on Legend
Bordering on Legend
User avatar

Joined: Jan 18th, '11, 08:29
Posts: 422
Images: 0
Location: Western NC
Gender: Male
Are you human?: Unknown Cyborg
Location: North Carolina
You just extract the zip file and cd to the LoggingServer folder, then type make
If it says something like make is an invalid command or not found then you don't have it installed. You will need make and g++ installed with yum/apt-get. If there is some other error if you copy/paste it I can help you with it.

_________________
LowCarbTNPer's Systems: [v3] [v2] [v1]

Arduino UNO Data Sender / Logger


Top
 Profile  
Reply with quote  
PostPosted: Sep 23rd, '13, 11:06 
Offline
Newbie
Newbie

Joined: Sep 22nd, '13, 22:23
Posts: 12
Gender: Male
Are you human?: yes
Location: australia
sorry to ask, what cd are you refering to?


Top
 Profile  
Reply with quote  
PostPosted: Sep 23rd, '13, 11:08 
Offline
Bordering on Legend
Bordering on Legend
User avatar

Joined: Jan 18th, '11, 08:29
Posts: 422
Images: 0
Location: Western NC
Gender: Male
Are you human?: Unknown Cyborg
Location: North Carolina
cd is the linux command to change the current directory, you would have to do the whole thing in SSH or a terminal/shell/xterm if you are running a GUI desktop.

_________________
LowCarbTNPer's Systems: [v3] [v2] [v1]

Arduino UNO Data Sender / Logger


Top
 Profile  
Reply with quote  
PostPosted: Sep 23rd, '13, 13:55 
Offline
Newbie
Newbie

Joined: Sep 22nd, '13, 22:23
Posts: 12
Gender: Male
Are you human?: yes
Location: australia
after installing the compiler, I did a g++ server.cpp
and got an a.out file
executing the file started the server listening on the port!

getting excited, found a dallas 3 pin sensor in my junk box, wired it up to pin 2, power and 4.7k pullup as usual..

but it wont compile! so close yet so far!

here is the compile error when I compile temp_sender_1.1.ino
(I installed one wire libraries as per instructions - had to rename library folder to "DallasTemperature" as download link creates something different )

Arduino: 1.5.4 (Windows XP), Board: "Arduino Uno"

temp_sender_1.1.ino: In function 'void setup()':
temp_sender_1.1.ino:112: error: redefinition of 'void setup()'
sketch_sep23a:1: error: 'void setup()' previously defined here
temp_sender_1.1.ino: In function 'void loop()':
temp_sender_1.1.ino:197: error: redefinition of 'void loop()'
sketch_sep23a:6: error: 'void loop()' previously defined here


thanks for your help again... :wave:

ps: how do I hardcode an ip address and disable dhcp which wastes memory


Top
 Profile  
Reply with quote  
PostPosted: Sep 23rd, '13, 18:05 
Offline
Newbie
Newbie

Joined: Sep 22nd, '13, 22:23
Posts: 12
Gender: Male
Are you human?: yes
Location: australia
ok I got past all the wiered compilation errors.. I had to rename the project name that caused errors when I launch the editor. ie had to rename temp_sender_1.1.ino to temp_sender_11.ino . After I got rid of extra dot errors at launch of compiler went away.

so now it is compiled and I tried to change to static ip

u have this
#ifdef USE_ETHERNET
byte eth_mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xF0, 0x0D };
#ifndef USE_DHCP
//the IP address for the shield:
const byte eth_ip[] = { 10, 0, 0, 42 };
//the gateway address for the shield:
const byte eth_gw[] = { 10, 0, 0, 1 };
//the subnet mask for the shield:
const byte eth_mask[] = { 2550, 255, 255, 0 };
#endif

I changed const byte eth_ip[] = { 10, 0, 0, 42 };
to an internal ip 192.168.0.7
and const byte eth_gw[] = { 10, 0, 0, 1 };
changed to point to my router const byte eth_gw[] = { 192, 168, 0, 1 };

and the subnet mask seems to have a typo in it ie 2550 instead of 255 so changed to 255

trying to get it all to work now... having trouble getting it to work still
I cannot ping arduino on internal network from a pc on internal network ping 192.168.0.25 has no reply
and I notice all 4 leds on ethernet shield constantly on.

one other point is after successful compilation to my uno3 I do get a comment like this
Global variables use 1,649 bytes (80%) of dynamic memory, leaving 399 bytes for local variables. Maximum is 2,048 bytes.
"Low memory available, stability problems may occur
"
any ideas what to try next..
been a long day and steep learning curve.. would love to get this thing talking to vps 2nite.


Top
 Profile  
Reply with quote  
PostPosted: Sep 23rd, '13, 19:55 
Offline
Newbie
Newbie

Joined: Sep 19th, '13, 02:49
Posts: 30
Gender: Male
Are you human?: YES
Location: Utrecht, Netherlands
Ahh working with the Arduino requires lots of patients especially when working with Networking!

Good luck with your debugging lentildude. Embedded coding is not always easy!

I am working on another Arduino project using the ethernet controller and the free Xively cloud logger. It seems to work better than having to set up all the server stuff yourself.

For my own AP system, I am currently looking at using a Raspberry PI instead to track air/water temperature in addition to having a usb cam to track the plant growth and fish activity. The cost of all the kit is not significantly different and the RPI has a much more robust software stack. Will post it all on the forum when done.

Mark

_________________
Mark

http://paago.org/aquaponics


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 29 posts ]  Go to page 1, 2  Next

All times are UTC + 8 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Powered by phpBB® Forum Software © phpBB Group
Portal by phpBB3 Portal © phpBB Türkiye
[ Time : 0.059s | 17 Queries | GZIP : Off ]