- Arduino 1-Wire Tutorial
- arduino 1-wire tutorial
- Arduino 1-Wire Address Finder
- arduino 1-wire device address (serial number) discovery
- ruby programming « idin.net
- TheGrebs.com:HowTos:Data logging and Graphing Temperature with an Arduino
- nofxx/subduino - GitHub
- subduino - Arduino Ruby Helpers + PubSub Gem
- Adafruit Industries, Unique & fun DIY electronics and kits
- Adafruit Industries, Unique & fun DIY electronics and kits
- amploc current sensors
- Drawing of the system | jankreuter
- Get It - Sanguino.cc
- Arduino Tutorial - Lesson 5
- coding « Anthony's Blog
- / - uberfridge - Open source fermentation temperature control with webserver - Google Project Hosting
- » Arduino JeeLabs
- CMiYC Labs, Inc. - Projects and Ideas by J. Lewis
- Arduino Tutorials « t r o n i x s t u f f
- Kicad libraries converted from Eagle
- JeremyBlum.com
- Detailed energy monitor system design | OpenEnergyMonitor
- Opto-Isolated 8 Channel Relay Board
- Opto-Isolated 8 Channel Relay Board
- bildr » High-Power Control: Arduino + TIP120 Transistor
- Yourduino-info - home
- SSR25A - SPST 3-32Vdc 25A Solid State Relay
- Solid State Relay, DC/DC Solid State Relay, buy SPST 3-32Vdc 25A Solid State Relay
- 12 Volt - 8 channels relay board with 5 V power supply
- us-boards, electronic relay boards manufacturer
- Opto-Isolated Transistor Drivers for Micro-Controllers
- Arduino Forum - Cheap Relay Switch?
- Ladder Gen
- Electronics for Dogs: LDmicro and Arduino
- An LDmicro Tutorial
- ldexample at master from ah01/LDmicro2arduino - GitHub
- LDmicro2arduino - The way how to program written in the LDmicro run on the Arduino board.
- Ladder Logic for PIC and AVR
- Digit’s Domotica Blog
Friday, December 9, 2011
Arduino and related links
Arduino and related bookmarks.
Tuesday, December 6, 2011
Ruby code posts to thingspeak.com as well as timestamped csv file
#!/usr/bin/env ruby # Encoding: UTF-8 # Copyright 2011 Michael Fellinger - MIT License # http://manveru.name # Currently running ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux] # Gem.loaded_specs["serialport"].version 1.0.4 api_key = 'yourthingspeakKEYhere2' min_temperature = 5 # ° Fahrenheit max_temperature = 250 # ° Fahrenheit run_every = 60 # Seconds fields_count = 8 # add more as you add sensors. Also need to add fields on thingspeak.com to match. ### # Here be Dragons! ### require 'csv' require 'serialport' require 'logger' require 'rest-client' log = Logger.new('/home/djash/scripts/logs/temperature.log', 'daily') port_str = "/dev/ttyACM0" # may be different for you baud_rate = 9600 data_bits = 8 stop_bits = 1 parity = SerialPort::NONE sp = SerialPort.new(port_str, baud_rate, data_bits, stop_bits, parity) sleep(2) last_run = Time.now buffer = '' loop do begin found = select([sp], nil, nil, run_every) next unless found && found[0] buffer << sp.getc next unless buffer.include? ",\r\n" line, buffer = buffer.split(",\r\n", 2) fields = line.split(',', fields_count) unless fields.size == fields_count log.debug "Insufficient Data, might be starting up..." next end fields.map!{|field| Float(field) } unless fields.all?{|field| field > min_temperature && field < max_temperature } log.warn "The fields are outside the #{min_temperature}..#{max_temperature} range: %p" % [fields] log.warn "Won't post to thingspeak" next end params = {key: api_key} (0...fields_count).each do |n| params["field#{n + 1}"] = "%.2f" % [fields[n]] end log.debug(params) fieldstocsv = line.split(',', fields_count).unshift Time.now CSV.open('/home/djash/scripts/logs/temperature.csv', 'a') do |writer| writer << (fieldstocsv) end RestClient.post('https://api.thingspeak.com/update', params) # djash added below 2 lines hopefully to clear what seems to be temperature hanging. So if we clear the buffer then we must get new data to post. # never did figure this out so I simply restart this script every 15 minutes with a bash script. I think it's serialport issue. buffer.clear # $stdout.flush # time_diff = run_every - (Time.now - last_run) sleep [time_diff, run_every].max rescue => exception log.error(exception) log.error(line: line) log.error(buffer: buffer) log.error(fields: fields) end end
Arduino 1-wire code with basic alarm output
// This Arduino sketch reads DS18B20 "1-Wire" digital
// temperature sensors.
// Tutorial http://www.hacktronics.com/Tutorials/arduino-1-wire-tutorial.html
#include
#include
// Define digital input pin your one_wire sensors are connected to on the Arduino
#define ONE_WIRE_BUS 10
// define my delay time on next line
#define mydelay 7500 //7500 is 7.5 seconds
// Setup a oneWire instance to communicate with any OneWire devices
OneWire oneWire(ONE_WIRE_BUS);
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);
// Assign the addresses of your 1-Wire temp sensors.
// See the tutorial on how to obtain these addresses:
// http://www.hacktronics.com/Tutorials/arduino-1-wire-address-finder.html
DeviceAddress sensor1 = {
0x28, 0x20, 0x13, 0x1C, 0x03, 0x00, 0x00, 0x54 };
DeviceAddress sensor2 = {
0x28, 0xD4, 0xE5, 0x1B, 0x03, 0x00, 0x00, 0x46 };
DeviceAddress sensor3 = {
0x28, 0x92, 0x28, 0x1C, 0x03, 0x00, 0x00, 0xC9 };
DeviceAddress sensor4 = {
0x28, 0xAF, 0x08, 0x1C, 0x03, 0x00, 0x00, 0x96 };
DeviceAddress sensor5 = {
0x28, 0xE0, 0x9D, 0xBF, 0x03, 0x00, 0x00, 0x83 };
DeviceAddress sensor6 = {
0x28, 0x8D, 0x82, 0xBF, 0x03, 0x00, 0x00, 0x19 };
DeviceAddress sensor7 = {
0x28, 0x7D, 0xA9, 0xBF, 0x03, 0x00, 0x00, 0xE3 };
DeviceAddress sensor8 = {
0x28, 0x17, 0x84, 0xBF, 0x03, 0x00, 0x00, 0xFB };
void setup(void)
{
// start serial port
Serial.begin(9600);
// Start up the library
sensors.begin();
// set the resolution to 10 bit (good enough?)
sensors.setResolution(sensor1, 10);
sensors.setResolution(sensor2, 10); //djash 1st cord single sensor
sensors.setResolution(sensor3, 10);
sensors.setResolution(sensor4, 10);
sensors.setResolution(sensor5, 10);
sensors.setResolution(sensor6, 10); //djash cord 2 2nd sensor (end)
sensors.setResolution(sensor7, 10); //djash cord 2 ist sensor (middle)
sensors.setResolution(sensor8, 10);
pinMode(13, OUTPUT);
}
void printTemperature(DeviceAddress deviceAddress)
{
float tempC = sensors.getTempC(deviceAddress);
if (tempC == -127.00) {
// djash these next two lines print if the sensor can't be read.
Serial.print("\r\n");
Serial.print("Sensor missing or unreadable");
}
else {
Serial.print(DallasTemperature::toFahrenheit(tempC));
}
}
void loop(void)
{
delay(mydelay); //1000 is 1 second
// djash Serial.print("Getting temperatures...\n\r");
sensors.requestTemperatures();
delay (3500);
float s1 = sensors.getTempC(sensor1);
float s2 = sensors.getTempC(sensor2);
float s3 = sensors.getTempC(sensor3);
float s4 = sensors.getTempC(sensor4);
float s5 = sensors.getTempC(sensor5);
float s6 = sensors.getTempC(sensor6);
float s7 = sensors.getTempC(sensor7);
float s8 = sensors.getTempC(sensor8);
if (s1 > 0)
{
// djash Serial.print("Sensor 1 temp is: ");
printTemperature(sensor1);
Serial.print(",");
}
if (s2 > 0)
{
// djash Serial.print("Sensor 2 temp is: ");
printTemperature(sensor2);
Serial.print(",");
}
if (s3 > 0)
{
// djash Serial.print("Sensor 3 temp is: ");
printTemperature(sensor3);
Serial.print(",");
}
if (s4 > 0)
{
// djash Serial.print("Sensor 4 temp is: ");
printTemperature(sensor4);
Serial.print(",");
}
if (s5 > 0)
{
// djash Serial.print("Sensor 5 temp is: ");
printTemperature(sensor5);
Serial.print(",");
}
if (s6 > 0)
{
// djash Serial.print("Sensor 6 temp is: ");
printTemperature(sensor6);
Serial.print(",");
}
if (s7 > 0)
{
// djash Serial.print("Sensor 7 temp is: ");
printTemperature(sensor7);
Serial.print(",");
}
if (s8 > 0)
{
// djash Serial.print("Sensor 8 temp is: ");
printTemperature(sensor8);
Serial.print(",");
}
Serial.print("\r\n");
// next line writes pin 13 to high (on) if sensor 6 is > 80.00 Deg F.
// an example of an alarm of sorts turns on output 13 (on board led) but can be whatever you want.
// if you write it like this it will be in degrees C. digitalWrite(13, s6 > 80);
digitalWrite(13, (DallasTemperature::toFahrenheit(s6) > 80));
}
// temperature sensors.
// Tutorial http://www.hacktronics.com/Tutorials/arduino-1-wire-tutorial.html
#include
#include
// Define digital input pin your one_wire sensors are connected to on the Arduino
#define ONE_WIRE_BUS 10
// define my delay time on next line
#define mydelay 7500 //7500 is 7.5 seconds
// Setup a oneWire instance to communicate with any OneWire devices
OneWire oneWire(ONE_WIRE_BUS);
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);
// Assign the addresses of your 1-Wire temp sensors.
// See the tutorial on how to obtain these addresses:
// http://www.hacktronics.com/Tutorials/arduino-1-wire-address-finder.html
DeviceAddress sensor1 = {
0x28, 0x20, 0x13, 0x1C, 0x03, 0x00, 0x00, 0x54 };
DeviceAddress sensor2 = {
0x28, 0xD4, 0xE5, 0x1B, 0x03, 0x00, 0x00, 0x46 };
DeviceAddress sensor3 = {
0x28, 0x92, 0x28, 0x1C, 0x03, 0x00, 0x00, 0xC9 };
DeviceAddress sensor4 = {
0x28, 0xAF, 0x08, 0x1C, 0x03, 0x00, 0x00, 0x96 };
DeviceAddress sensor5 = {
0x28, 0xE0, 0x9D, 0xBF, 0x03, 0x00, 0x00, 0x83 };
DeviceAddress sensor6 = {
0x28, 0x8D, 0x82, 0xBF, 0x03, 0x00, 0x00, 0x19 };
DeviceAddress sensor7 = {
0x28, 0x7D, 0xA9, 0xBF, 0x03, 0x00, 0x00, 0xE3 };
DeviceAddress sensor8 = {
0x28, 0x17, 0x84, 0xBF, 0x03, 0x00, 0x00, 0xFB };
void setup(void)
{
// start serial port
Serial.begin(9600);
// Start up the library
sensors.begin();
// set the resolution to 10 bit (good enough?)
sensors.setResolution(sensor1, 10);
sensors.setResolution(sensor2, 10); //djash 1st cord single sensor
sensors.setResolution(sensor3, 10);
sensors.setResolution(sensor4, 10);
sensors.setResolution(sensor5, 10);
sensors.setResolution(sensor6, 10); //djash cord 2 2nd sensor (end)
sensors.setResolution(sensor7, 10); //djash cord 2 ist sensor (middle)
sensors.setResolution(sensor8, 10);
pinMode(13, OUTPUT);
}
void printTemperature(DeviceAddress deviceAddress)
{
float tempC = sensors.getTempC(deviceAddress);
if (tempC == -127.00) {
// djash these next two lines print if the sensor can't be read.
Serial.print("\r\n");
Serial.print("Sensor missing or unreadable");
}
else {
Serial.print(DallasTemperature::toFahrenheit(tempC));
}
}
void loop(void)
{
delay(mydelay); //1000 is 1 second
// djash Serial.print("Getting temperatures...\n\r");
sensors.requestTemperatures();
delay (3500);
float s1 = sensors.getTempC(sensor1);
float s2 = sensors.getTempC(sensor2);
float s3 = sensors.getTempC(sensor3);
float s4 = sensors.getTempC(sensor4);
float s5 = sensors.getTempC(sensor5);
float s6 = sensors.getTempC(sensor6);
float s7 = sensors.getTempC(sensor7);
float s8 = sensors.getTempC(sensor8);
if (s1 > 0)
{
// djash Serial.print("Sensor 1 temp is: ");
printTemperature(sensor1);
Serial.print(",");
}
if (s2 > 0)
{
// djash Serial.print("Sensor 2 temp is: ");
printTemperature(sensor2);
Serial.print(",");
}
if (s3 > 0)
{
// djash Serial.print("Sensor 3 temp is: ");
printTemperature(sensor3);
Serial.print(",");
}
if (s4 > 0)
{
// djash Serial.print("Sensor 4 temp is: ");
printTemperature(sensor4);
Serial.print(",");
}
if (s5 > 0)
{
// djash Serial.print("Sensor 5 temp is: ");
printTemperature(sensor5);
Serial.print(",");
}
if (s6 > 0)
{
// djash Serial.print("Sensor 6 temp is: ");
printTemperature(sensor6);
Serial.print(",");
}
if (s7 > 0)
{
// djash Serial.print("Sensor 7 temp is: ");
printTemperature(sensor7);
Serial.print(",");
}
if (s8 > 0)
{
// djash Serial.print("Sensor 8 temp is: ");
printTemperature(sensor8);
Serial.print(",");
}
Serial.print("\r\n");
// next line writes pin 13 to high (on) if sensor 6 is > 80.00 Deg F.
// an example of an alarm of sorts turns on output 13 (on board led) but can be whatever you want.
// if you write it like this it will be in degrees C. digitalWrite(13, s6 > 80);
digitalWrite(13, (DallasTemperature::toFahrenheit(s6) > 80));
}
Subscribe to:
Posts (Atom)