Go Down

Topic: Homebrewery (Learning Arduino) (Read 2123 times) previous topic - next topic

markpeace

Hi all,

I'm currently learning Arduino - automating the beer brewing lab I've got in the loft as a test. Eventually, the project will do the following...

1. Monitor temperature (using thermistors) at mashtun output and boiler output.
2. Activate and de-activate kettle elements in the boiler to maintain temperature.
3. Vary the voltage to a pump in order to change its flow
4. Activate solenoids at various points to redirect the flow or wort and water.
5. Interface with the internet so that I can control everything via a website

At the moment, I'm starting simple - as I've learnt to play with switches, I'll start there; just an array of switches (to be mounted on the front of a cliplock box which contains all the electrics) which will eventually be used to manually control the solenoids (#4) and pump (#5) - and override any web commands (#5).

How does the following look as a circuit plan? I'm guestimating a little bit here, and trying to work out theory whilst planning it.


MarkT

You might want to switch to 0V so Arduino internal pull-ups can be used.  The LED/resistor chains then run from switch terminal to +5V.  Note that an LED isn't a good pull-down in your circuit as it won't conduct below its turn on voltage.

The analog input circuit doesn't make sense - the wiper of the pot goes to the analog input pin, the other pins to 0V and +5V. The LED isn't useful there.
[ I won't respond to messages, use the forum please ]

cyclegadget


  Markpeace, is your intention to have the LEDs that are on the inputs light up to show when you are pushing the buttons? Or are you wanting them to stay lit up to indicate a status?

If you have a little more detail on your pumps and solenoids, some people here may be able to recommend a shield or shields that may work for you.


Mark
Good links: Eagle tutorial= http://www.youtube.com/playlist?list=PLDE1858BD83D19C70
General Arduion tutorials = http://tronixstuff.wordpress.com
http://www.gammon.com.au/forum/bbshowpost.php?bbtopic_id=123

markpeace

Thanks guys. I really don't know much about all this, so replies like this are really useful in pointing me in directions for learning the next step of stuff (I've worked through some tutorials, but I think working on an actual project might work better for me). I'm off to find out more about pull up and push down resistors now, and will post back with an update soon.

In regards to the other questions...

- the LEDs were originally just to show the switch was on, but now I'm thinking about it, maybe I want a separate status array, so that the LEDs can report on solenoids, etc when it's eventually Internet controlled.

- the pump is this one http://goo.gl/xI51p (it'll be the 14 watt option)

- I was thinking of these solenoids http://goo.gl/XvvBT

Cheers,
Mark

markpeace

Ok, I've done some reading and learning on pull-up resistors. Before I go ahead and redesign, does the following look right to you? I'm trying to build the switches above, but using the internal pullup as suggested above.



The resistor labelled pin31 is the internal pullup resistor (the software I'm using will emulate current flow etc. for me if I do it this way) - and I'm using the following code:

Code: [Select]

void setup()
{
 pinMode(31,INPUT);
 digitalWrite(31,HIGH);
 Serial.begin(9600);
}
void loop()
{
 Serial.println(digitalRead(31));
}

Coding Badly


On the output pins, you could easily end up with using pull-up resistors in some places and pull-down resistors in other places.

Quote
2. Activate and de-activate kettle elements in the boiler to maintain temperature.
3. Vary the voltage to a pump in order to change its flow
4. Activate solenoids at various points to redirect the flow or wort and water.


...have potential safety issues.  I'll use #2 as an example.  If the Arduino loses power, the kettle elements should automatically turn off.  If the kettle element is controlled by a digital pin where HIGH is "make heat" and LOW is off then you would use a pull-down resistor.

markpeace

#6
Jul 28, 2011, 09:56 pm Last Edit: Jul 28, 2011, 10:01 pm by markpeace Reason: 1
Thanks, that's useful - so to paraphrase, and check I understand, anything that controls an external solenoid, element, etc should be on a circuit that uses a pull-down resistor, rather than the internal pull-up resistor. That way, if the arduino dies  - and the voltage reverts to low - it will close/turn off.

I've now redesigned by control panel (doesn't do anything except take switch input and light up LEDs for now). Once I'm confident with it, I'll be building it on a strip board.

Can you see anything I've done wrong?



Coding Badly

Thanks, that's useful - so to paraphrase, and check I understand, anything that controls an external solenoid, element, etc should be on a circuit that uses a pull-down resistor, rather than the internal pull-up resistor.


Yes.

Quote
That way, if the arduino dies  - and the voltage reverts to low - it will close/turn off.


Yes.  "Fail safe".  For some control points it may not matter.  For others (like a heater) it is very important.

Quote
Can you see anything I've done wrong?


For the Boiler / Fill LED, where is pin 37 connected?

markpeace

Quote


For the Boiler / Fill LED, where is pin 37 connected?



Sorry, I'm being thick, don't quite understand. Pin 37 is the pin on the arduino mega - isn't it the same as the other LED circuits. I'm probably not noticing something though!

Coding Badly


I'm picking on pin 37 not because there is something special about it but because using a single LED line as an example makes the discussion a bit easier.

Along the "pin 37 line", you have +5, the label "pin 37", a 100 ohm resistor, an LED, and then a line with a ground symbol.  Where along that line is pin 37 connected?

markpeace

Ah, ok.

My intention was that the +5v would be the actual Pin, written to HIGH to switch the led on. So from there to the 100 ohm resistor, and onwards to the LED and back to ground. Is this wrong?

(In the case of the switches, I've paired the 20K resistor alongside the +5 to signify a pin with its internal pull-up resistor on).

I'm thinking, though, that I could use pins more efficiently; I'm going to be using them to turn solenoids on and off eventually - I guess the high/low that is sent to trigger an NPN transistor could also branch off and light an LED on the monitor panel.

M.

Coding Badly

My intention was that the +5v would be the actual Pin, written to HIGH to switch the led on. So from there to the 100 ohm resistor, and onwards to the LED and back to ground. Is this wrong?


No, not wrong.

If you use red LEDs, the current will be 32 milliamps per LED.  With 11 LEDs all on, the total is 352 milliamps.  The total or the various combinations may exceed the maximum allowed for the processor.  In addition, 32 milliamps may exceed the maximum value for your LEDs.  You may need to use bigger resistors to limit the total current and the individual current.

What I do ... connect the LED to a potentiometer and a small but reasonably valued resistor.  Adjust the potentiometer to larger values until I can just tell that the LED got dimmer.  Or, go the other way.  Make the LEDs brighter until they reach a level that is clearly visible.  For the red LEDs I use, 220 ohms seems to be the "magic spot".

Quote
(In the case of the switches, I've paired the 20K resistor alongside the +5 to signify a pin with its internal pull-up resistor on).


How did you choose 20 K?

Quote
I'm thinking, though, that I could use pins more efficiently; I'm going to be using them to turn solenoids on and off eventually - I guess the high/low that is sent to trigger an NPN transistor could also branch off and light an LED on the monitor panel.


Yes.  Which helps when troubleshooting.

markpeace

Thanks for that, these replies are really useful in making making me think things through.

I read (possibly misread) somewhere that the internal pull up resistors were the equivalent of 20k - not right?

I'll do the potentiometer thing - hypothetically, what happens if the load is too high?

Coding Badly

Thanks for that, these replies are really useful in making making me think things through.


You are welcome.

Quote
I read (possibly misread) somewhere that the internal pull up resistors were the equivalent of 20k - not right?


20 K to 50 K.  But, the internal pull-up is considered "weak".  In general, 10 K is a good starting point.

Quote
hypothetically, what happens if the load is too high?


The processor will be damaged.

markpeace

#14
Aug 02, 2011, 12:41 pm Last Edit: Aug 02, 2011, 01:49 pm by markpeace Reason: 1
Woo, that doesn't sound fun. I've not been paying attention to the load that's being pulled from the Arduino; I guess that a good practice would be to just keep a running total of amps being pulled per pin, and overall.

I'm also thinking it might be an idea to develop more iteratively; the solenoid valves will be a much later addition - so maybe I should leave all that out for now.

The core functionality (the stuff I really need to get working to make the existing setup loads better) is effectively a PID controller. So I need to be able to ....


  • Measure temperature at boiler out and Mash Tun

  • Activate the pump

  • Activate two independent kettle elements to control balance of heat



Now, I'm thinking solid-state relay switches for the elements (and ensuring that they're off in when no power is supplied!), but I'm not sure which I need. The elements are 240v / 2.2kW each - so I'm calculating that I need them to cope with 10amps? Not finding much in the way of these which can be activated from a 5v feed from the arduino though. I guess, at a push, I'll be running 12v in anyway to supply the pump, so I could run the 240 volt relays off that. Any suggestions?

M

Go Up