Real Time Online Fermentation Temperature Monitor for ~$60

Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum

Help Support Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

FuzzeWuzze

I Love DIY
Joined
Jun 19, 2012
Messages
3,144
Reaction score
460
Location
Newberg
Updated Build Info @ http://fuzzelogicbrewing.blogspot.com

So, after making this project i figure i would spend a bit of time documenting the process incase any one else was interested. It uses an Arduino and an ethernet shield to push data to the COSM service which is free, they handle all of the data and graphing for you automatically.

At the end of this project you will have a project that should output the data to COSM and be capable of creating graphs like this real time COSM graph of my Fermentation and Ambient temperatures. COSM is a very powerful tool for free, you can use it to get real time data of your temperatures anywhere you have internet access, and can even set up triggers to tweet/email you when certain things happen. For example i have it setup to email me if my fermentation temperatures ever get less than the yeast im using or too hot, which allows me to fix the problem ASAP. Also side note, it should tweet/email me should my house catch fire and the ambient gets > 110 lol, or if i leave my door open or something and it gets < 50F.

Note: This is REAL time, the image is built by COSM when you request it. The image you are seeing is what my setup is reading as of when you loaded this web page and the image loaded. If you reload the page it will give you a new graph with the updated data. The graphs are currently showing the last 24 hour period.
This is the feed you can also view
https://cosm.com/feeds/83208

Ambient.png

FermSensor1.png



Equipment Needed

  • Arduino Uno
  • Wiznet 5100 Ethernet Shield
  • 2 x DS18B20 Temperature Sensors
  • Wire
  • Solder
  • 2 x 4.7K Resistors
  • 5V Power Supply OR SmartPhone USB Wall Charger(come with most smart phones now)

A good place to get the UNO and Wiznet Ethernet shield is DealExtreme, for those not familiar with it, they produce cheap chinese knockoffs off stuff. But because Arduino is an open source project revolving around a single chip, there should be no fear in buying from them. The only downside is it can take upwards of 3-4+ weeks from ordering to get your products in the US. Take that into consideration, you can get the Uno and Wiznet Ethernet shield from other outlets, but at a much higher cost. Some people may be against the idea of supporting Chinese manufacturing, or just dont want to wait over a month to get everything...just make sure you get the Wiznet 5100 and not another Ethernet shield or the code here wont work.

Arduino UNO - $15.20
sku_120464_5.jpg

http://dx.com/p/arduino-uno-rev3-development-board-120464

Wiznet 5100 Ethernet Shield - $13.99
sku_118061_1.jpg

http://dx.com/p/ethernet-shield-with-wiznet-w5100-ethernet-chip-tf-slot-118061

2 x Maxim DS18B20+ Temperature Sensors - ~$4.50 each.
You can find these at sites like Digikey or other electronics stores online, hunt around and you can find them at decent rates. I bought a bundle of 10 off Ebay for $20 dollars.
TO-92-3(StandardBody),TO-226_straightlead_sml.jpg


Wire
I bought some cheap 4 wire flexible thermostat wire from Lowes for 33c/foot. Its nice and thin and will fit down a thermowell but yet remain flexible...you can use any wiring you want as long as it will fit in your thermowell.

Thermowell - $14
You can use any you want, just make sure its not too long to fit into your bucket or carboy but to get a fair ways into your wort when its at the 5G marker.
http://www.brewershardware.com/16-Stainless-Steel-Thermowell.html

2x 4.7k Resistors - Cheap?
The DS18B20's require that you have a 4.7k resistor between the Data and Power pins in order to function.

5V Power supply - $1-2 dollars at any Goodwill/Salvation army, free if you have extra wall warts laying around that are 5V.
Phone charger USB connectors work as well, such as the standard one that comes with the iPhone or the Android versions
oem-apple-usb-charger-adapter-for-apple-iphone-3g-3g-s-white-a1265-.jpg

The USB connectors allow you to plug right into the USB port of the Arduino to get power. Otherwise for the 5v connector you need to plug in the jack, or cut the supply and solder it directly into the 5V and Ground connections on the Arduino, this allows you to pass their voltage regulator which IMO gets too hot for my liking.

Build

Start by wiring up the DS18B0's to your length of Thermostat or other wiring.
ds18b20.jpg

You need to wire your 4.7k resistor across the Data and Gnd pins, i usually do this at the end of the wire that goes into the arduino. A few inches above where im going to be plugging into the Arduino i strip/melt with soldering iron the wire jacket on both wires and solder the resistor between them.
Because the DS18B20's use OneWire, you need to ensure that both of your 'sensor cables' are soldered together in some fashion. The Gnd to Gnd, Power to Power, and Data to data. I found just twisting the two ends together with a third piece of wire(thats going to plug into the Arduino) and soldering them together worked quite well. You could probably even get away with cable twist connectors if your wire gauge is thick enough. Once you have the cables with sensors on them, its a good idea to somehow protect the DS18B20 leads so they dont touch. I found using a bit of hot glue works great, not to mention if you coat the sensor itself in a small layer of hot glue you can essentially make it water proof. Just dont put so much on you cant get it into your thermowell!

Install the Arduino development software off of their site, and connect your arduino via the supplied USB cable to your computer and make sure it all gets detected and installed properly.

Hook your probe(s) up as follows to the Arduino
DS18B20 - Arduino
Data(Pin 2) - Digital Pin 3
Power(Pin 3) - 5V
Ground(Pin 1) - GND

Now close the Arduino software and download the Onewire Library here
http://www.hacktronics.com/code/OneWire.zip
And the DallasTemperature Library
http://www.hacktronics.com/code/DallasTemperature.zip
And the COSM Client
https://github.com/cosm/cosm-arduino/archive/master.zip

Extract these into the Arduino/Libraries folder..so you should have a Arduino/Libraries/OneWire, etc.

Next open the arduino software, in the settings make sure you set the Serial port the Uno USB drivers installed onto(Check device manager) and the device type to the Arduino UNO.

Copy and paste this code into the window
Code:
// This sketch looks for 1-wire devices and
// prints their addresses (serial number) to
// the UART, in a format that is useful in Arduino sketches
// Tutorial: 
// http://www.hacktronics.com/Tutorials/arduino-1-wire-address-finder.html

#include <OneWire.h>

OneWire  ds(3);  // Connect your 1-wire device to pin 3

void setup(void) {
  Serial.begin(9600);
  discoverOneWireDevices();
}

void discoverOneWireDevices(void) {
  byte i;
  byte present = 0;
  byte data[12];
  byte addr[8];
  
  Serial.print("Looking for 1-Wire devices...\n\r");
  while(ds.search(addr)) {
    Serial.print("\n\rFound \'1-Wire\' device with address:\n\r");
    for( i = 0; i < 8; i++) {
      Serial.print("0x");
      if (addr[i] < 16) {
        Serial.print('0');
      }
      Serial.print(addr[i], HEX);
      if (i < 7) {
        Serial.print(", ");
      }
    }
    if ( OneWire::crc8( addr, 7) != addr[7]) {
        Serial.print("CRC is not valid!\n");
        return;
    }
  }
  Serial.print("\n\r\n\rThat's it.\r\n");
  ds.reset_search();
  return;
}

void loop(void) {
  // nothing to see here
}

Save it, and wth your Arduino all plugged in with sensors and lit up, hit upload and make sure that it gets uploaded properly with no compile errors.

When it is complete, from the dropdown menu in the Arduino software select the Serial Monitor option. A new window will pop up and within a second or two it should print some text containing the Address's for any Sensors that are plugged in. If it pops up and shows no addresses, your sensors are not plugged in properly. Ensure all connections on both sides are right, use a Multimeter to help debug if you have one. Because the DS18B20's leads are so small it can be a pain to get them soldered without briding between leads.

Write down the addresses it gives you, these are the addresses you need to use in the later program for it to address your sensors on the onewire bus.

Next create a new program in arduino, and paste in this
Code:
#include <Cosm.h>
#include <CosmClient.h>
#include <CosmDatastream.h>
#include <CosmFeed.h>
#include <CountingStream.h>

#include <b64.h>
#include <HttpClient.h>

#include <OneWire.h>
#include <DallasTemperature.h>
#include <SPI.h>
#include <Ethernet.h>

//Defines for DS18B20
#define ONE_WIRE_BUS 3
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
DeviceAddress Sensor1 = {
0x28, 0xA9, 0x31, 0x98, 0x03, 0x00, 0x00, 0x84};
DeviceAddress Sensor2 = {
0x28, 0xA8, 0xE5, 0x97, 0x03, 0x00, 0x00, 0x68};
//End Defines for DS18B20

//Defines for COSM Ethernet
char cosmKey[] = "ENTER YOUR COSM KEY HERE";
byte mac[] = { 
  0x00, 0x1D, 0x0D, 0x2C, 0x55, 0x3D};

EthernetClient client;
CosmClient cosmclient(client);

//End Defines for COSM Ethernet
double s1 = 0;
double s2 = 0;


#define MYDELAY 5000
char sensor1Id[] = "FermSensor1";
char sensor2Id[] = "Ambient";

CosmDatastream datastreams[] = {
  CosmDatastream(sensor1Id, strlen(sensor1Id), DATASTREAM_FLOAT),
  CosmDatastream(sensor2Id, strlen(sensor2Id), DATASTREAM_FLOAT)};

CosmFeed feed(<INSERT FEED ID HERE>, datastreams, 2);

void setup(void)
{
  // start serial port
  Serial.begin(9600);
  SetupSensors();

  while (Ethernet.begin(mac) != 1)
  {
    Serial.println("Error getting IP address via DHCP, trying again...");
    delay(15000);
  }
}

void SetupSensors()
{
  sensors.begin();
  // set the resolution to 10 bit (good enough?)
  sensors.setResolution(Sensor1, 12);
  sensors.setResolution(Sensor2, 12);
}



float getTemperature(DeviceAddress deviceAddress)
{
  //Get temperature, convert to Fahrenheit, and return
  return DallasTemperature::toFahrenheit(sensors.getTempC(deviceAddress)); 
}

void loop(void)
{
  SensorLoopAndSend();
} 


void SensorLoopAndSend()
{
  sensors.requestTemperatures();
  s1 = getTemperature(Sensor1);
  s2 = getTemperature(Sensor2);
  Serial.print("S1: ");
  Serial.println(s1);
  Serial.print("S2: ");
  Serial.println(s2);
  datastreams[0].setFloat(s1);
  datastreams[1].setFloat(s2);
  int ret = cosmclient.put(feed, cosmKey);
  delay(MYDELAY);
}

I think the code is pretty easy to read and straight forward
First replace your Device Addresses with the ones i have in my code, you can add more sensors if you wish as well.
Next make an account on COSM and when logged on COSM create a Feed, in your Keys section(top right) you should be given an API Key, place that in the COSMKey variable
Next i dont think its necessary but not a bad idea, when the ethernet plugged into the arduino and linked, log into your router and find the mac address of your Wiznet module. It should be fine to use my MAC address, but using your own wouldnt hurt if you knew how.
Next name your Sensors, mine are just Ambient and FermSensor1, these names will be pushed to COSM automatically with your data so you dont need to make them within the COSM webpage. Dont use spaces, and some special characters might not work so stick to basic
Finally on this line
CosmFeed feed(<INSERT FEED HERE>, datastreams, 2);
Replace your Feed Number, and the last number is how many feeds you are pushing. So if you are using more than 2 sensors increase this number.

That should be everything! Save it and upload it and make sure it compiles, fix any errors you have or ask here if you have no clue what your doing.

You can check the Serial Monitor to see if its reading your probes properly, if it is you should be seeing data on your COSM feed!
If you are not seeing data, use the Debug area(Top right menu) on COSM. It will show you how many requests they are getting from you. By default this code should have about 20 updates per minute which is well under their maximum of 100. 5 Seconds is already way fast for updates

Thats it! Feel free to post questions here if you have any ill do my best to help!
 
I'll sub, this is something I've been looking to do since I already have an UNO sitting around. I look forward to seeing the rest of the build
 
Subscribed. Thanks for the write up. This looks doable for a welterweight tech person like me.

Can this support multiple zones easily?

Are you controlling temps with a relay and the arduino too?
 
subscribed. I was looking for exactly this a month ago, someone gave me something similar that i was going to build soon, but this is perfect.
 
I've been thinking about doing exactly this lately, great writeup!
 
Might want to look here. I've done most of the work, including the COSM, and a little more.

it's your post that inspired this :) but I was looking for the bare minimum to do it to just see temperatures and not have to host my own webserver and have to worry about maintaining that whole thing :) after years of hosting game servers, I'm a bit tired of the extra work, so I let cosm do it for me.

I'm out this weekend,so won't have time to finish this until Monday :) while writing it I realized there was still a lot to explain :)
 
Already built mine last year. Running same equipment above at feed:
https://cosm.com/feeds/70075

Here is my Arduino code:

// acefaser's beer code

#include <OneWire.h>
#include <DallasTemperature.h>
#include <SPI.h>
#include <Ethernet.h>

byte mac[] = { YOUR BITE MAC };
byte ip[] = { YOUR IP };

char server[] = "api.cosm.com"; // name address for Cosm API

EthernetClient client;

char strURL[150]; //define strURL
int t1,t2,t3; // variables for temps

// Data wire is plugged into pin 3 on the Arduino
#define ONE_WIRE_BUS 3
// cosm acct info
#define APIKEY "enter your key here" // replace your Cosm api key here
#define FEEDID 70075 // replace your feed ID
#define USERAGENT "Temp" // user agent is the project name

// 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 insideThermometer = { 0x28, 0x02, 0x3D, 0xAF, 0x03, 0x00, 0x00, 0xCF };
DeviceAddress outsideThermometer = { 0x28, 0x13, 0x35, 0xAF, 0x03, 0x00, 0x00, 0x9D };
DeviceAddress dogHouseThermometer = { 0x28, 0x07, 0x32, 0xAF, 0x03, 0x00, 0x00, 0x4B };


void setup() {
// start serial port:
Serial.begin(9600);
// give the ethernet module time to boot up:
delay(1000);
// start the Ethernet connection:
Ethernet.begin(mac, ip);


// Start up the library
sensors.begin();
// set the resolution to 10 bit (good enough?)
sensors.setResolution(1Thermometer, 10);
sensors.setResolution(2Thermometer, 10);
sensors.setResolution(3Thermometer, 10);
}

void printTemperature(DeviceAddress deviceAddress)
{
float tempC = sensors.getTempC(deviceAddress);
if (tempC == -127.00) {
Serial.print("Error getting temperature");
} else {

Serial.print(" F: ");
Serial.print(DallasTemperature::toFahrenheit(tempC));

}
}


void loop()
{

sensors.requestTemperatures();

if (!client.connected()) {
Serial.begin(9600);
// give the ethernet module time to boot up:
delay(1000);
Ethernet.begin(mac, ip);
}

float tempC1 = sensors.getTempC(1Thermometer);
float tempF1 = (tempC1 * 9.0 / 5.0) + 32.0;
int t1 = tempF1;
Serial.print(tempF1);
Serial.print("\n");

float tempC2 = sensors.getTempC(2Thermometer);
float tempF2 = (tempC2 * 9.0 / 5.0) + 32.0;
int t2 = tempF2;
Serial.print(tempF2);
Serial.print("\n");

float tempC3 = sensors.getTempC(3Thermometer);
float tempF3 = (tempC3 * 9.0 / 5.0) + 32.0;
int t3 = tempF3;
Serial.print(tempF3);
Serial.print("\n");

// string the data together
String dataString = "1,";
dataString += t1;
dataString += "\n2,";
dataString += t2;
dataString += "\n3,";
dataString += t3;

sendData(dataString);
}


// this method makes a HTTP connection to the server:
void sendData(String thisData) {
// if there's a successful connection:
if (client.connect(server, 80)) {
Serial.println("connecting...");
// send the HTTP PUT request:
client.print("PUT /v2/feeds/");
client.print(FEEDID);
client.println(".csv HTTP/1.1");
client.println("Host: api.cosm.com");
client.print("X-ApiKey: ");
client.println(APIKEY);
client.print("User-Agent: ");
client.println(USERAGENT);
client.print("Content-Length: ");
client.println(thisData.length());

// last pieces of the HTTP PUT request:
client.println("Content-Type: text/csv");
client.println("Connection: close");
client.println();

// here's the actual content of the PUT request:
client.println(thisData);
Serial.println(thisData);
Serial.println("Temps Uploaded Successfully");

delay(30000);
}
else {
// if you couldn't make a connection:
Serial.println("connection failed");
Serial.println();
Serial.println("disconnecting.");
client.stop();
}
}

// end
 
Cool write up! Thanks for the info, I'm definitely interesting in doing this myself.

Are the temperature spikes at ambient just your thermostat kicking in your HVAC or do you have a fermentation chamber that is cycling off and on? Not that those are big swings, I just find it interesting how consistent they are.
 
Cool write up! Thanks for the info, I'm definitely interesting in doing this myself.

Are the temperature spikes at ambient just your thermostat kicking in your HVAC or do you have a fermentation chamber that is cycling off and on? Not that those are big swings, I just find it interesting how consistent they are.

that is my home heat turning on and off, it's just sitting on top of the bucket
 
Updated the main post with the rest of the information.

Feel free to ask any questions or problems while setting it up ill be glad to help
 
This is awesome! Fantastic write up and very much appreciated. Am I correct in assuming that one could add on two SSR's, a peltier cooler (or similar), and a heat source and upgrade this into a fermentation controller?
 
I dont see why not with the right SSR. It would be pretty straight forward to turn on/off an Arduino pin to control the SSR.
If you were to go that route you would probably need some sort of LCD Screen and Knob so you could set the temperature points.
The cheaper option is just to edit the variables and reprogram the Arduino every time you start a new brew and need new fermentation temperatures since that only takes 15 seconds.
 
subscribed. looks like fun project for whatever u build. Fermentor in the planning stages. This will blow the brew friends away. Thanks for the posting.:rockin:
 
subscribed. looks like fun project for whatever u build. Fermentor in the planning stages. This will blow the brew friends away. Thanks for the posting.:rockin:


Yea its pretty easy to put together once you have everything. Only takes an hour or two depending on how quick you are at soldering :)
 
Alright, I'm doing this. I wonder how long of a run I could get away with for the temp probes. I won't be using a thermowell, so ethernet will work fine for me. I'm curious if I can get away with 20-50ft before the resistance starts to mess with the temp readings.

To be continued. For now, I'm buying parts.
 
Alright, I'm doing this. I wonder how long of a run I could get away with for the temp probes. I won't be using a thermowell, so ethernet will work fine for me. I'm curious if I can get away with 20-50ft before the resistance starts to mess with the temp readings.

To be continued. For now, I'm buying parts.

You should have no issues, a lot of people use the one wire devices in 'networks' using Cat5 up to like 80 meters or more from what ive read...

Found one guy who used them w/ 5V and 12 meters with no issues so you should be fine.

When your going that long though you'll need to use it in powered mode not its parasitic mode, my document has it in the powered mode using the arduinos 5v.

The nice part about using Cat5 or cat3 cables are that you can use RJ45 jacks and make really nice enclosures for your arduino where you can have a wall plate with 2-4 RJ45 ports on it that you just plug sensors directly into. That's my end goal, problem is its been in use almost non stop since i made it!

That said, your success is likely mostly related to the quality of your cable...if you can use some cat3 or cat5 cable you should be fine at such short distances...
 
I've got a ton of cat5e laying around, so I should be set there. And ya, ease of use was the goal with using ethernet; it's nice to be able to terminate with RJ45.

I bought the uno, ethershield, and temp sensors on DE yesterday. I'll post some updates once they arrive and I start slapping everything together. Thanks again!
 
I just realized that I never came back here and posted my success: https://cosm.com/feeds/97319
I'm so pleased with this little project that I ordered 2 120V relays from DealExtreme to turn this $50 fermentation monitor into a $54 online dual-channel fermentation PID controller.
 
By the way, after running an update every 7 seconds for a few days all of a sudden my W5100 lost its connection to the outside world and only a reset of the boards fixed it. I stumbled across an INSANELY long thread where a few folks were actually trying to debug the W5100's source code itself to trace down the problem. In the end it surfaced that the best means of preventing a problem is to disable the microSD reader by setting the appropriate digital pin. Below is my Void Setup with these 2 lines of code added:

Code:
void setup() {
  // start serial port:
  //Serial.begin(9600);
  
  pinMode(4,OUTPUT);
  digitalWrite(4,HIGH);
  
 // start the Ethernet connection:
  if (Ethernet.begin(mac) == 0) {
    //Serial.println("Failed to configure Ethernet using DHCP");
    // DHCP failed, so use a fixed IP address:
    Ethernet.begin(mac, ip);
    
    // Start up the library
sensors.begin();

  }
}

I've commented out my serial monitor code since I'm done debugging this project. It has been running flawlessly for several weeks now at one update every 7 seconds.
 
Epic win!! I'm gonna build similar setup soon:) Thanks !!!!

scottland said:
I bought the uno, ethershield, and temp sensors on DE yesterday. I'll post some updates once they arrive and I start slapping everything together. Thanks again!

Do you mind pointing me, which temp sensors you've ordered?

PS. Guys. About SSRs. I'd like to hookup my fridge and freezer, as well. Which ones could do the job?
 
Epic win!! I'm gonna build similar setup soon:) Thanks !!!!



Do you mind pointing me, which temp sensors you've ordered?

PS. Guys. About SSRs. I'd like to hookup my fridge and freezer, as well. Which ones could do the job?

The code itself here uses Maxim DS18B20's, which use a OneWire library to talk to their sensors.

As for SSR's im sure ChemE has can chime in, ill be interested as well as im looking to make some sort of Fermentation chamber at some point in the near future.
 
These are what I got from DealExtreme: Arduino 5V Relay Module - Blue + Black
sku_121354_1.jpg


I went ahead and got 3 so they were only $1.88 each! I am not a patient man and waiting 4+ weeks for insanely slow Chinese post kills me but I do like getting these things on the cheap. Eventually these will show up and I can give them a lash and report back as to how they work.
 
Yeah, DX and Lightake as well, they got some nice multi-channel relays.
Damn, I'm struggling to wrap my head around it :smack: . Especially, that I got some 60W tubular heater inside my fridge too.
 
These are what I got from DealExtreme: Arduino 5V Relay Module - Blue + Black
sku_121354_1.jpg


I went ahead and got 3 so they were only $1.88 each! I am not a patient man and waiting 4+ weeks for insanely slow Chinese post kills me but I do like getting these things on the cheap. Eventually these will show up and I can give them a lash and report back as to how they work.

Yea i always have mixed emotions buying cheap Chinese stuff, but the stuff is so incredibly cheap...:mug:

Brewing beer already isnt necessarily the cheapest hobby, it quickly grows in cost! :)

Ill look at those relays for sure...
 
I've been wanting to do this with a raspberry pi for a while. It would be around the same price and you would have a much powerful controller capable of running its own webserver.
 
@thomashp Look here: https://www.homebrewtalk.com/f235/raspberry-pi-temp-controller-344529/
Only for temps monitoring, RasPi is perfect. But for 'something' more (controlling fridge, heater, burners etc) some other hardware is needed(1wire setup, additional shields, ssr's). I'm hesitating between Arduino and Teensy (in fact, where I live 2nd option is more expensive-unfortunately).
 
I've been wanting to do this with a raspberry pi for a while. It would be around the same price and you would have a much powerful controller capable of running its own webserver.

The problem is also that Raspberry Pi's are hard to get a hold of, atleast in the US there is upwards of a 6+ week wait ...or your stuck paying $50 or more for people online gouging people with the ones they have.

You can get an Arduino anywhere ...that said it would work if you already have one!
 
I've been wanting to do this with a raspberry pi for a while. It would be around the same price and you would have a much powerful controller capable of running its own webserver.

I'm still learning but I do believe that Arduinos are capable of running their own web server as well.
 
Relays finally showed up yesterday and it was very easy and straightforward to get it up and running. For the moment I'm just switching my desk lamp on and off so I can't yet say whether or not it can handle a chest freezer. I've got some cheap 11" wide heat tape on the way so soon enough it will be switching that on and off as I piece things together. These relays are mechanical so there is a distinct clicking sound as they switch. That is irrelevant to me but for those who plan on rapid switching or require silence, you'll need to spend 10x as much to get a solid state relay + heatsink.
 
So i cant even get my own project back in working condition lol, not sure what im missing.

Basically set it up to have 2 sensors on a cat5 cable, seemed straight forward.

Make 2 sets of 2 wires, string a 4.7k resistor between them, solder them to the arduinos 5v and data pin 3, then the other ends into a cat5e jack, and same for 2 wires to the arduino gnd.

Cat5 Jack - Arduino Pin - Sensor Pin
Pin 1 - +5V - Sensor 1 Pwr
Pin 2 - Digital 3 - Sensor 1 Data
Pin 3 - Ground - Sensor 1 Gnd
Pin 4 - +5V - Sensor 2 Pwr
Pin 5 - Digital 3 - Sensor 2 Data
Pin 6 - Ground - Sensor 2 Gnd

Then i have my 2 sensor cables spliced/soldered onto the end of a cat5 cable i snipped matching the above pinouts..

Problem is, if both of my sensors are hooked up my arduino turns off after 2-5 seconds, which i assume means there is a short some where...but ive checked and double checked...if i unhook one of the sensors everything works, but both at the same time and it doesnt...

I cant help but wonder if i only need one 4.7k resistor? But i know how i had it before with one per sensor and it worked as i expected...

2013-03-01%2019.00.01.jpg

2013-03-01%2019.14.32.jpg


And yes i know horrible solder job my iron is a ghetto radio shack...theres no solder bridges between the arduino pins, as it it works fine with 1 hooked up.
 
I used one 4.7k on each of my sensors as well Fuzze. I later learned that I just need one per grouping but my project has been working just fine with one per DS18B20.

By the way, I'm working on compacting sketch size and SRAM usage by stuffing just those parts of DallasTemperature.cpp and DallasTemperature.h into my sketch that I actually need. I know the compiler is supposed to remove unreferenced code but so far I was able to shave almost 2k off my sketch size just be deep sixing Dallas. I may give the same treatment to OneWire later this week if I'm feeling ambitious. This is my very simple code to read a 12 bit temperature off a DS18B20 and spit it to the serial monitor in F.

Code:
#include <OneWire.h>

// Data wire is plugged into pin 3 on the Arduino
#define ONE_WIRE_BUS 3
#define STARTCONVO      0x44  // Tells device to take a temperature reading and put it on the scratchpad
#define READSCRATCH     0xBE  // Read EEPROM
#define TEMP_LSB        0
#define TEMP_MSB        1
uint8_t testTherm[8]= { 0x28, 0x83, 0xF5, 0x83, 0x04, 0x00, 0x00, 0x16 };
uint8_t scratchPad[8];

// Setup a oneWire instance to communicate with any OneWire devices
OneWire oneWire(ONE_WIRE_BUS);

void setup()
{
  // This code will only run once, after each powerup or reset of the board
  Serial.begin(9600);
  Serial.print("Setup");
}

void loop() {
 
  // Request temperatures function from Dallas
  //Serial.print("Requesting\n");
  oneWire.reset();
  oneWire.skip();
  oneWire.write(STARTCONVO, false);
  
  // Read the temperature from the DS18B20
  delay(750);  // Wait 750ms to allow for a 12-bit precision temperature reading to be taken by the DS18B20
  //Serial.print("Reading\n");
  oneWire.reset();
  oneWire.select(testTherm);
  oneWire.write(READSCRATCH);
  scratchPad[TEMP_LSB] = oneWire.read();
  scratchPad[TEMP_MSB] = oneWire.read();
  oneWire.reset();
  int16_t rawTemperature = (((int16_t)scratchPad[TEMP_MSB]) << 8) | scratchPad[TEMP_LSB];
  Serial.print( (float)rawTemperature * 0.0625*1.8+32,4);
  Serial.write(176);
  Serial.print("F\n");
  delay(5000);

}

I'm going through this trouble because DallasTemperature is way bigger than what we need it to be and I want to have plenty of room on my chip for doing cooler stuff like output to an LCD and controlling stuff. Of course this sketch would be a heck of a lot smaller if I wasn't using the Serial monitor. With that commented out the sketch size is 1,738 bytes and uses 39 bytes of SRAM!
 
Yea i havent worked on condensing it, because there was still so much space on the Uno even with the extra libraries :)

Ill try messing with it and just use 1 resistor tommorrow..
 
Back
Top