Basic arduino questions.

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.

Eighty2Fifty1

Well-Known Member
Joined
Jun 27, 2011
Messages
129
Reaction score
9
Location
Oak Harbor
I was kicking around the idea of using Arduino to heat and possibly cool my fermentation chamber. It's 60 cf of space, so I was planning on using a pair of 100 watt light bulbs for heat. I think it would be pretty cool to have it hooked up to the internet and be able to control it remotely. Obviously, I'm going to have to learn all the programming, but I'm trying to figure out what hardware I need.

*Arduino Uno for the brains of the system.
*Relays to power the bulbs, since the Uno can't handle the current or voltage. (2-100W light bulbs draw 1.6A at 120VAC) I was looking at thesehttp://arduino-direct.com/sunshop/index.php?l=product_detail&p=155
*Temperature sensor, possibly more than one
*A wireless shield to allow the Uno to connect to my home router. http://arduino.cc/en/Main/ArduinoWirelessShield
*Light bulb fixtures

I was also wondering if I could use an old laptop in place of the wireless shield. That way, I could also hook up a webcam so I could watch my beer ferment.

Any input?
 
I'm using the Uno and / or Mega2560 along with the Ethernet Shield to monitor and display temperature readings using DS18B20 temp sensors. I use powerline adapters to use my house wiring as an intranet, but I'm also looking at the Copperhead WiFi shield, as it's standard 802.11b which allows encryption, instead of the ZigBee.

So far, I've hooked up 15 temp sensors on my breadboard, and can display them either as a text file:
TextScreen.png


or a Steel Canvas:


BCR_Canvas.png


There are also other parts available that can be used to control SSRs, etc.

I bought a buttload (ok, 50) of the DS18B20 sensors from china for less than a buck each, and am going to mate them to the hundreds of ethernet cables I have laying around, then use a modified patch panel to bring it all together.

My eventual plan is to have one for my brew stand, on for my fermentation chamber, and one for my storage fridges, and monitor them all via my intranet.
 
Very cool, I'm sure I'll have lots of questions for you when it comes to setting that up.

What is the difference between the Mega and the Uno? Is it just the number of I/O pins?
 
Hi

I think I'd vote for keeping things simple. The more boxes that are involved, the more that can go wrong.

Bob
 
Very cool, I'm sure I'll have lots of questions for you when it comes to setting that up.

What is the difference between the Mega and the Uno? Is it just the number of I/O pins?

The Mega has more codespace and ram available, and more inputs/outputs. The code running above uses most of the Uno codespace, but about a quarter of the Mega codespace.
 
Hi

I think I'd vote for keeping things simple. The more boxes that are involved, the more that can go wrong.

Bob

The great thing about the arduino is that you can make it as simple or as complex as you like.

I'm running the above on just two boards, the arduino and an ethernet shield. Everything else is part of my current household setup. I use powerline to transfer movies from my 5 terabyte media server to my home entertainment center, my zoneminder security cam system, as well as my homemade monster DVR, with 7 simultaneous recording channels and 8 terabytes of storage.

Yeah, I'm a nerd. :rockin:
 
The great thing about the arduino is that you can make it as simple or as complex as you like.

I'm running the above on just two boards, the arduino and an ethernet shield. Everything else is part of my current household setup. I use powerline to transfer movies from my 5 terabyte media server to my home entertainment center, my zoneminder security cam system, as well as my homemade monster DVR, with 7 simultaneous recording channels and 8 terabytes of storage.

Yeah, I'm a nerd. :rockin:

Hi

My concern was with the "include a laptop" comment in the earlier post. The more boxes you have ....

Bob
 
Hi

My concern was with the "include a laptop" comment in the earlier post. The more boxes you have ....

Bob

Well, you need some kind of computer to program the Arduino in the first place, so...

There's an entire thread on how to use an old laptop with linux to do the same thing. I happened to have an ancient compaq laptop (Pentium III, 348kb of ram, 20gb drive) that I resurrected, and put in a lightweight linux system that also works with the DS18B20, and runs a webserver, and could use a webcam, so it can be done in one box.

If you don't like "boxes", don't use them. Stick with tried and true bi-metallic thermometers that never fail :cross: , or glass thermometers that never break, or stick your finger in it.

I, on the other hand, like to experiment, tinker, and see what works best. :ban:
 
Hi

Ok, since this is gaining a life of it's own.

The original post included a question "can I use an old laptop in place of a wireless shield?" or something very close to that. My comment was in reply to that question. If you believe that replacing a wireless shield with an entire laptop is a good idea, go for it. I'd go for the shield.

Bob
 
Hi

Ok, since this is gaining a life of it's own.

The original post included a question "can I use an old laptop in place of a wireless shield?" or something very close to that. My comment was in reply to that question. If you believe that replacing a wireless shield with an entire laptop is a good idea, go for it. I'd go for the shield.

Bob

That was one of my questions, and I think you havve a good point. Come to think of it, my old laptop wasn't incredibly reliable, and the wireless shield is cheap. Am I on the right track with those relays I posted?
 
That was one of my questions, and I think you havve a good point. Come to think of it, my old laptop wasn't incredibly reliable, and the wireless shield is cheap. Am I on the right track with those relays I posted?

That should work just fine. You can also use solid state relays (SSR), which can be driven directly by the arduino.
 
Hi

Ok, since this is gaining a life of it's own.

The original post included a question "can I use an old laptop in place of a wireless shield?" or something very close to that. My comment was in reply to that question. If you believe that replacing a wireless shield with an entire laptop is a good idea, go for it. I'd go for the shield.

Bob

Never said it was a good idea, it's just another option. I tend to re-use and re-purpose as much as possible. I've resurrected older computers for people that wouldn't otherwise have been able to afford a new one (up until recently I had an old 486 system running as a file server). If he wanted to, he could use the laptop instead of the arduino and wireless shield and relay shield, so now it's one box instead of three.

I'm just providing other options.
 
That was one of my questions, and I think you havve a good point. Come to think of it, my old laptop wasn't incredibly reliable, and the wireless shield is cheap. Am I on the right track with those relays I posted?

Hi

The relays look fine for anything up to a hot water tank heater. With mechanical relays, be sure you have enough power supply current available to run them. They likely will pull more current than all the rest of the stuff in your system. Still not a lot of current, but it could nuke a tiny wall wart.

Bob
 
Hi

The relays look fine for anything up to a hot water tank heater. With mechanical relays, be sure you have enough power supply current available to run them. They likely will pull more current than all the rest of the stuff in your system. Still not a lot of current, but it could nuke a tiny wall wart.

Bob

I'll have to sit down and draw the schematic out, but I'm thinking my 110VAC power in will split off and go two places. One, to the wall wart power supply for the Arduino (7-12VDC); and two, to the input side of the relays (110VAC). It says that the relay brick needs +5VDC to power the coils, but I think it gets that power from the Arduino as well. The Arduino output sends a signal to a transistor that in turn energizes the relay coil.

Would I gain anything by using SSR's? Probably depends on the duty cycle of the lamps, but I doubt they would be turning on and off so rapidly to burn out a relay. In any case, I'd probably fry the lightbulb first.
 
I'll have to sit down and draw the schematic out, but I'm thinking my 110VAC power in will split off and go two places. One, to the wall wart power supply for the Arduino (7-12VDC); and two, to the input side of the relays (110VAC). It says that the relay brick needs +5VDC to power the coils, but I think it gets that power from the Arduino as well. The Arduino output sends a signal to a transistor that in turn energizes the relay coil.

Would I gain anything by using SSR's? Probably depends on the duty cycle of the lamps, but I doubt they would be turning on and off so rapidly to burn out a relay. In any case, I'd probably fry the lightbulb first.

Hi

The relays are likely rated for several million cycles. Unless you get really nutty with a PID you will never burn out a relay. The main advantage of SSR's is that they don't pull as much off of the 5V power supply. I haven't looked up the relays on the board but I would not be surprised if they each pulled 100 ma off of +5V.

Bob
 
They pull about 70 mA each. I'll probably get the shield wwith 2 relays, I'd only need one for a heat circuit and one for a cooling circuit. From what I've been reading, the relay coils get their power from the +5VDC regulated output pin on the Arduino board. I believe that pin is rated for 200 mA. So now my concern is to make sure the power supply that powers the Uno and then the board can handle the draw?
 
They pull about 70 mA each. I'll probably get the shield wwith 2 relays, I'd only need one for a heat circuit and one for a cooling circuit. From what I've been reading, the relay coils get their power from the +5VDC regulated output pin on the Arduino board. I believe that pin is rated for 200 mA. So now my concern is to make sure the power supply that powers the Uno and then the board can handle the draw?

Hi

The four relay board you started out seems very fairly priced at $11. I'd go for it. You never know when you might decide to switch another load. Fans, alarms, lights, pumps, valves .. who knows. There's always more stuff out there to fiddle with.

Yes, you are correct about the power supply. Since the whole thing runs off of +5, you need a supply that will handle the relays plus the Uno plus what ever else you are tacking on (wireless card, display etc). If you are going to buy a power supply, one in the 3A to 5A range should be dirt cheap (sub $10). My only worry is that you are trying to re-purpose a cell phone supply that might be in the 500 ma range.

Bob
 
I'll keep that in mind. I found a whole slew of the things on Mouser's website, but I'm sure I have one sitting in a drawer somewhere.
 
Hi

First choice is open frame or wall wart. A lot depends on how you are going to mount the gizmo. For wall wart's your junk box is the first place to look. For open frames I usaly check eBay and Mouser.

You never quite know where a project is going to wind up. If the final install will accomodate an open frame, I'd go with somethig that puts out +/- 12 V and +5. Something around an amp on the +12 and a few amps on the +5.

I like the +12/-12 for analog suff like op-amps. The +12 is good for a wide range of relays. +5 will get you all the digital stuff like +3.3, +2.5, +1.8 and +1.2.

Of course if the power supply starts to cost more than the rest of the setup, something is not quite right. I generaly don't spend over $10 or so on a supply.

Bob
 
Just placed an order for the 4-relay shield and 10 DS18B20's. (Doesn't hurt to have extras.) Now I'm off to Radio Shack to pick up an Uno and start playing with it.
 
Just placed an order for the 4-relay shield and 10 DS18B20's. (Doesn't hurt to have extras.) Now I'm off to Radio Shack to pick up an Uno and start playing with it.
Arduino, Picaxe, Picbasic, basic stamp and many others are readilly available nearly everywhere. They are a ton of fun to tinker with and program too. If you have a little time you might have a look at the All About Circuits site and see some of the cool stuff those guys are whipping up. Most of it is still above my skill level, but I am catching up, slowly but surely. Lots of great info in a huge well written text that will help you develop circuit reading and building skills as well as MCU and PIC programming. Have fun, Arduino is pretty neat and is also not too steep of a learning curve either.
Wheelchair Bob
 
Arduino, Picaxe, Picbasic, basic stamp and many others are readilly available nearly everywhere. They are a ton of fun to tinker with and program too. If you have a little time you might have a look at the All About Circuits site and see some of the cool stuff those guys are whipping up. Most of it is still above my skill level, but I am catching up, slowly but surely. Lots of great info in a huge well written text that will help you develop circuit reading and building skills as well as MCU and PIC programming. Have fun, Arduino is pretty neat and is also not too steep of a learning curve either.
Wheelchair Bob

Hi

I'd toss an Intel Atom motherboard into that list. Cost and power are a little higher, but not massively so. You wind you with major power to do what ever you want. No problem running a full blown OS and a high def TV for a display....

Bob
 
Hi Eighty2Fifty1

I recently completed a mechatronics project for school using an Arduino Uno to heat and cool a son of a fermentation chamber I built. The cooling is done with the usual fan/ice method.

My initial thought was to use lightbulbs for the heating portion, however, I found flexwatt from this site http://www.bigappleherp.com/Flex-Watt-Heat-Tape and think it works great. I think I purchased from a cheaper supplier. I can get the chamber and 5 gallons of liquid up to 100˚F from 65˚F overnight on full power. The PWM pins work great if you want to hit a specific temp and maintain it...little bit of trial and error with that. Great if you're in the basement/garage or using lacto cultures or something. I used one of the cheap Fotek SSRs for this, like $10 on amazon and cheaper on Ebay if you don't mind the wait. The flexwatt only pulls about 40W and like 3A so it is pretty energy efficient compared to the bulbs.

For temp sensing I used TMP36s which you can find at SparkFun and they are really inexpensive and easy to setup and get working. The project now stands alone and has buttons to increase and decrease the set temp and has and LCD display for read out of set and actual temp and whether the fan/heating element is on.

I knew nothing about microcontrollers before beginning on the project so I kept it pretty simple and added different components in stages. Sounds like you're doing a similar project with similar experience so let me know if you would like any help with code/setup/ideas etc. No ethernet yet, but that's my next step.

Just my $0.02. Best of luck and have fun!
 
Do you wrap the fermenters with the tape or just line the walls with it. I'm not 100% committed to a heat source yet, but I did buy my arduino uno yesterday and was able to blink the hell out of an LED.
 
If you can blink LED's your not far from temp control. Just a couple sensors, and an LCD or two and your good. Have fun.
Bob
 
Hi

If you have grown up after electronics stopped being a vacuum tube thing - be careful when working with power switching. I see a lot of people being a bit careless because all their working lives have been with stuff that won't "bite you".

Bob
 
Hi

If you have grown up after electronics stopped being a vacuum tube thing - be careful when working with power switching. I see a lot of people being a bit careless because all their working lives have been with stuff that won't "bite you".

Bob

No kidding...

I started off over 40 years ago working for a company that built commercial broadcast transmitters, we're talking tens and hundreds of kilowatts. One of my co-workers got just the tiniest bit careless, and it cost him his life. :(

Under the right conditions even "won't bite you" stuff will.
 
No kidding...

I started off over 40 years ago working for a company that built commercial broadcast transmitters, we're talking tens and hundreds of kilowatts. One of my co-workers got just the tiniest bit careless, and it cost him his life. :(

Under the right conditions even "won't bite you" stuff will.

Hi

Death from electricity used to be a pretty common issue with circuit designers. Most of us had stories just like that one...

Bob
 
I wrap it around the carboy for better/faster heating of the actual liquid. I do feel you could line your walls and control it more in an ambient fashion though just as successfully. Especially in a small insulated space.
 
So does anyone have a wiring schematic for how to hook up an arduino to power and the SSR's. Im looking to start building my new setup and instead of purchasing a BCS-460 I want to use an arduino cause I like to program and want to create a custom interface on android, so my tablet can control everything.
 
Adeering,
I dont't have any samples of what you are looking for, but several manufacturers offer a 2 or 4 relay shield board that will hook directly to arduino, picaxe and MCU's. They are 5 volt dc in and up to 150 VAC on the output side. I also found a seller on Ebay selling just the relays for about .50 each. I think I paid 4 bucks for the 4 relay board and hooked them directly to a developement board with some IDC connectors and ribbon cable. Heres a link to the relay boards on Ebay:
http://www.ebay.com/itm/270836814943?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2649
and the seperate relays are here:
http://www.ebay.com/itm/400244727175?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2649
Hook ups between the two can be done with plain 22 Ga wire and youre set for the hardware side of your controller. Hope that helps a bit.
WCB
 
Hi

If you have the right SSR's hookup is pretty easy. There are some out there that will run off of a 3V:

http://www.ebay.com/itm/SSR-25-DA-S...ltDomain_0&hash=item19d0d6463a#ht_2096wt_1353

You can pretty much drive them off of the same supply as your CPU. Most are sensitive enough that a normal i/o pin will trigger them.

This then gets into the "just because you can" sort of stuff. The SSR should isolate the CPU, so it's safe. A wiring error can / will nuke the cpu, so you should be careful.

Bob
 
Well I'm getting the feeling that I'm in over my head. I've been playing with the Uno and the temp sensors for a bit and I can make it display the temperature on my computer. My next question is how do I make it use the temperature it reads and energize and deenergize some relays? I'm guessing that I need to somehow convert the serial data into something else?
 
Well I'm getting the feeling that I'm in over my head. I've been playing with the Uno and the temp sensors for a bit and I can make it display the temperature on my computer. My next question is how do I make it use the temperature it reads and energize and deenergize some relays? I'm guessing that I need to somehow convert the serial data into something else?

There are a couple of easy ways to do this. Easiest would be to emulate a thermostat. Using IF statements you can place bounds on your read temperature and then turn wires on and off using digitalWrite().
so you would end up with something like

Code:
\\do something to setup temperature probes
int heatpin=2; \\pin where you connect your heating relay
int coolpin=3; \\pin where you connect your cooling relay
float temp; \\store current temp in this variable

void setup(){
\\do something to setup temperature probes, this will be different depending on what probes you are using

\\tell the program you are using these and digital out
pinmode(heatpin, OUTPUT); 
pinmode(coolpin, OUTPUT);
}

void loop(){

if (temp > 80){
digitalwrite(coolpin, HIGH);
digitalwrite(heatpin,LOW);
}

if (temp < 50){
digitalwrite(heatpin, HIGH);
digitalwrite(coolpin, LOW);
}

if (temp <= 80 && temp >= 50);
digitalwrite(coolpin, LOW);
digitalwrite(heatpin,LOW);
}
}

And then set your high and low setpoints where you want

If you want better controll you can start pulling out the PID library
 
Hi

More or less:

1) The data comes in from the sensor.
2) You get the data into a floating point format.
3) You qualify the data (does the value make any sense at all)
4) You often average the data
5) The data goes into a control formula. That could be a pid it could be a pair of IF statements.
6) Based on the formula decide if you want to energize the relay or not
7) You check to see if you are in a lockout mode. A cooling compressor timeout is one example.
8) You check to see if you are already energized (if so - energized to long?)
9) If you are not energized, how long ago were you energized (don't chatter the relay)
10) If you still think you need to energize - do it
11) Wait until your next time tick from the real time clock or what ever you are using for a world clock.
12) review switches and other inputs, set lockouts if needed, adjust temp targets if needed
13) back to step one.

That's one very basic way to do it. I followed the "energize" chain through most of it. There is a similar chain for "de-energize". You can get a lot more exotic. The control formula can (and often is) a set of formulas. Each one gets used at specific points in the process.

So much fun.

Bob
 
Well I'm getting the feeling that I'm in over my head. I've been playing with the Uno and the temp sensors for a bit and I can make it display the temperature on my computer. My next question is how do I make it use the temperature it reads and energize and deenergize some relays? I'm guessing that I need to somehow convert the serial data into something else?

The relays have no interaction at all with the serial output. The serial output is just an easy way for you to send text to your computer so you can see what's happening, which is particularly useful if things aren't working the way you expect them to be.

To control a relay, you need to have it plugged into one of your digital pins. When the temperature is above your setpoint, you turn on the relay that controls your cooling source. When the temperature is below your setpoint, you turn on the relay that controls your heating source. The code gets a bit more complicated if you want to prevent your heater/cooler from turning on and off very quickly, but the principle remains the same.

If you are uncomfortable with controlling high voltage electricity and therefore aren't sure that you can do it safely, consider using something like this: https://www.adafruit.com/products/268

Edit: Oops, carlisle_bob beat me to it!
 
Back
Top