I use the new HyperDuino+R Robotics Motor Controller Shield by Roger Wagner with an Arduino UNO to program and maintain near-constant, cool temperatures in a home brewing fermentation vessel. Home brewing is just one example of many applications. I'll bet you can think of others. Here's a basic demonstration (without the beer) to show how this device can make it simple to control temperatures.
The HyperDuino+R shield has everything we need to connect digital thermometers and pump motors in a tidy, compact package without a breadboard.
This Instructable includes both how use the shield with an Arduino to read a DS18B20 digital thermometer and how to operate a submersible pump.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Gather the Components
Roger Wagner's HyperDuino+R robotics shield, available online at the HyperDuino Store.
DS18B20 submersible thermometer, available many places, including here.
Arduino Uno microcontroller, or compatible board having Uno-style pinouts, widely available.
Submersible water pump, available many places. The one I used came from here.
External power supplies
9 volt for the Arduino, such as this one.
12 volt for the pump. It is convenient to select one that includes an adapter for connecting wires, such as this one.
Step 2: Connect the Pump to the HyperDuino+R Shield
The pump has two wires: black for ground and red for power. It attaches directly to the motor controller on the HyperDuino+R shield. Push the red wire into the B02 port and push the black wire into the adjacent Gnd port on the motor controller. If your pump will be located at a distance from the HyperDuino, you may need to extend the wires. I used solder to connect the wires. There an Instructable for that available by another author.
Step 3: Connect the 12-volt Power to the HyperDuino+R Shield
The pump we selected uses 12-volt direct current. The motor controller on the HyperDuino can handle up to 15 volts, so we're OK in the voltage department. Push the positive wire from the 12-volt power supply into the +VM quick-connector on the Motor Power post of the HyperDuino+R shield. Push the ground wire from the power supply into the Gnd quick-connector right beside it.
IMPORTANT: Do not reverse the polarity of the external power source, in other words, do not connect the positive (usually red or white) wire to GND and the negative (usually black) to +VM. Doing so will cause a short circuit through the motor controller that could damage the HyperDuino+R, your power supply, or both.
Step 4: Connect the DS18B20 Thermometer to the A0 Pin Position on the HyperDuino
The DS18B20 digital thermometer has three wires: black for ground, red for power, and yellow (or white) for "signal" (that is, data.) Connect these wires to the corresponding posts on the HyperDuino +R shield for an available I/O pin. Avoid using pins 3 through 9, as those are used to operate the motor controller.
Note that the DS18B20 thermometer is a digital device designed to work on a digital pin of the Arduino. We could have put the thermometer on digital pins 2 or 10 through 13. The so-called "analog" pins A0 through A5 are also digital pins; they are different only by having an additional ability to read and write analog data. We selected pin A0 for this project, for no particular reason.
One other little detail: documentation for the DS18B20 device calls for including a pull-up resistor in the circuit. To our joy, the Arduino has pull-up resistors built-in and available for optional use on any I/O pin. As you will see in the sketch, to enable the pull-up hardware on pin A0 we set the pinMode to "INPUT_PULLUP".
Step 5: Optionally, Directly Connect LEDs to the HyperDuino+R Shield to Indicate Status
Everyone who has played with LEDs on an Arduino knows you have to put a resistor in the circuit to protect the LED, which has always meant wiring up a breadboard. Not any more. All models of the HyperDuino shields provide pins for directly connecting LEDs, with the resistors built into the board. Now you can just plug-n-play with LEDs for school projects or just about anything that you want to light up with LEDs. This is normally done with jumper wires. We used some really short ones to add lights that tell us when things are happening with the pumps. They're nice to have, but not necessary.
Step 6: Get the Digital Thermometer Libraries
The HyperDuino takes care of connecting to the outside world. The Arduino controller's job is to read the digital thermometer and take appropriate action with the pump. The example in this Instructable activates the pump when the thermometer reads a temperature above 65.5 degrees. It deactivates the pump when the temperature is below 65.0.
The sketch reports pump activation events and periodic temperature readings, including a timestamp, using the Arduino's serial port. Optionally, these reports can be logged to a file on an attached computer. The sketch runs jut fine without a computer connection, of course.
Reading the thermometer involves using two special-purpose development libraries: OneWire; and DallasTemperature. These libraries did not come standard with my copy of the Arduino IDE. I downloaded and placed them in the Libraries directory inside the Sketchbook folder. The location of the Sketchbook folder can be seen (and managed) in the Preferences window of the Arduino IDE. For example, on my Mac it's located at "/Users/yours_truly/Documents/Arduino." Create a separate subfolder in there for each of the following libraries. The online resource locations and the necessary Library files to be downloaded are as follows:
Make a folder named "OneWire" in your local Libraries folder, then go to the link given above and download into that subfolder at least these two files:
You will probably want to download the other files and folders on the OneWire site also, especially including the helpful examples. They are educationally beneficial, and you may be able to use some of the code in future projects of your own.
Make a subfolder named "DallasTemperature" in your local Libraries folder, then go to the link given above and download into that subfolder at least these two files:
Again, you will find it helpful to download the other files at the Dallas Temperature site, especially including the examples.
Step 7: Understanding the Motor Controller
Activating the pump is a simple matter of setting certain digital pins on the Arduino that operate the motor controller on the HyperDuino+R shield. This device deserves a closer look.
There are four pairs of ports on the motor controller. Each pair is for one motor. The pair labeled B02/Gnd was used to power the pump in this project. Notice that the other pairs are labeled B01/Gnd, A02/Gnd, and A01/Gnd.
The ports are named that way because the motor controller has an "A" side and a "B" side. It can activate one motor on each side -- one "B" motor and one "A" motor -- and both can be running at the same time. So, when I want to run a second pump I connect it to one of the "A-side" controllers.
The controller can handle up to 15 volts, up to 1.2 amps of current per side. Be aware that it's a transistor-switched, H-bridge device, not a relay, so exceeding the limitations could damage the device. That's not a problem for this project.
The motor used in this project draws less than 0.5 amp, well within the capacity of the device. That's all the power I needed. These little pumps are mightier than they look. The one used here moves a gallon per minute (240 liters/hour) which is plenty for the purpose. For example, that rate of flow can cool my 10-gallon beer fermenter by 2 degrees in about 40 seconds.
Of course this versatile shield can control up to four of these pumps. The project just needs to be designed so it works OK having just one motor on each side running at any one time. That's an advanced application that we don't cover in this Instructable.
Briefly going off-topic: Why does the motor controller have four motor ports but only two sides, A and B? Remember, this shield is also ideal for controlling robots. Robotics enthusiasts will use the four ports to connect two, bi-directional motors. The "01" and "02" ports on each side of the controller then work for "forward" and "backward." You can even adjust the motor speeds independently to make the robot go around in circles. We hope to show how this works in another Instructable.
Step 8: The Sketch
Four Arduino pins need to be set a certain way to turn on the pump connected to B02 on the HyperDuino+R shield. Note that pins 4 and 5 work together to control the B-side of the motor controller. Pin 4 controls the B02 motor port, so we will pin 4 HIGH or LOW to turn the pump on or off, respectively. Pin 5 has to be kept LOW for this to work. Pin 3 determines the speed of the motor; we set it to 255 for maximum speed. Pin 6 is the motor controller master switch. Here is how the pins are set when the pump is turned on:
Pin 3 = PWM setting of 255
Pin 4 = HIGH
Pin 5 = LOW
Pin 6 = HIGH
We leave pins 3, 5, and 6 unchanged all the time this controller is running. We turn the pump on and off with pin 4.
Step 9: Test It!
The thermometer in the upper photo is in a glass of ice water. The temperature displayed on the Serial Monitor of the Arduino IDE is below 65. The green LED connected to pin 6 is glowing, indicating that the motor controller is active. The blue LED connected to pin 4 is off, indicating that the pump is off.
The thermometer is in my hand in the lower photo. I'm happy to say I'm still warmer than 65.5 degrees! The pump is on, shooting a little fountain up from the bowl. The blue LED on pin 4 is illuminated now, because the sketch set pin 4 to HIGH to turn on the pump.
Step 10: Use It!
Here is a view of the HyperDuino at work in the brewery. It is controlling temperatures independently, at different temperatures in two, different fermenters. With a bit of plumbing, the pumps sit in a reservoir of chilled water and deliver a cooling flow to heat exchangers in the two fermenters. The system expands easily to four.
We use the HyperDuino not only to ferment but also to cold-condition our brews over extended lengths of time. We also log temperature data and pump activation events to a computer file via the USB connector. The Arduino's primary power source is external, using the round plug, allowing us to attach or detach the computer without interrupting the program. We intend to cover how we do that in a future Instructable.
A pump could sit in a reservoir of warm water and supply heat to a radiator, also. Be sure to consult the specifications of whichever pump you choose to learn the minimum and maximum temperatures it is able to handle.
That's it! Now you see how easy it is to use a thermometer and a water pump with an Arduino to control temperatures in a home brewery, thanks to Roger Wagner's HyperDuino +R Robotics shield.
I get excited thinking of all the different ways people might find to use this capable, new, Robotics shield from Roger Wagner for Arduino. (Roger tells me it will soon work with the micro:bit also.)
Every situation is different, and we cannot possibly cover every detail here. We leave the specifics of different projects in the capable hands of our readers, based on the unique circumstances and needs of different applications. What can you think of to make with the HyperDuino+R Robotics shield?
Happy temperature controlling to you!