Temperature and Solar Sensor Using Arduinos

279

8

2

Published

Introduction: Temperature and Solar Sensor Using Arduinos

These temperature and solar sensors are specifically designed to be used in the classroom. They are built using Arduinos, dallas temperature sensors, and homemade solar sensors produced by the QESST program at ASU.

Step 1: Gather Supplies

TUSA
Cost Analysis

1. An Arduino (the nano was used for this project) \$19.99/5 = \$4.00

2. A breadboard \$5.99/6 = \$1.00

3. A 4.7K ohm resistor \$6.50/100 = \$0.067

4. A 2.2 ohm resistor \$6/100 = \$0.06

5. Two (2) RCA cables \$6/3 = \$4.00

6. A dallas temperature probe \$19.99/10 = \$2.00

7. A solar sensor\$1.40/1 = \$1.40

8. Solder iron and solder n/a

9. Wire cutters n/a

Total \$12.53

In order to make it look more similar to this project, You will also need:

1. Black box \$8.45/10 = \$0.85

2. 22 awg wire \$10.35/100’ = \$0.11/1 foot

3. Two (2) RCA female inputs \$8.18/30 = \$0.54

4. Drill and size 6 bit n/a

5. Dremel n/a

Total \$1.50

Grand Total \$14.03

Because K-12 students are expected to be using these sensors, it's helpful to have all the wiring in a box that can be enclosed. One side of the box has a larger hole for the feed to the computer, and the other has two holes for the RCA female inputs. Use a size 6 drill bit to drill the holes for the RCA inputs. Before screwing them in, use the dremel to create a hole in the opposite side of the case. Make sure your breadboard and Arduino can be comfortably plugged in. Once this is accomplished, you can screw in your RCA inputs. Remember to use personal protective equipment when using power tools!

Solder a lead from the ground and the input. It also works to pinch the wires around the inputs, but a solder will result in a better hold. Electrical tape also works well for this!

Step 4: Construct Your Temperature Sensor

Cut off the end of a RCA cable (leaving the output piece attached), and strip the wires to separate the ground and lead wires. Slide a piece of heat shrink around each of the wires. Push the outside wires of the temperature probe back, and the inside probe forward. Twist the outside probes together, and wrap the ground wire around the outside probes.Solder together Use heat shrink to cover the wires. Repeat the process with the singular inside probe and the lead wire from the VGA cable. Use heat shrink to cover all the wires.

Step 5: Wire Your Temperature Sensor

Be sure to press your Arduino all the way into your breadboard, with one row of pins on either side of the breadboard. On this model, the temperature sensor is in the left RCA input. Since the wires need to get plugged into the left (digital) side, it's just easier to use that side for the temperature.

1. Connect a 4.7k ohm resistor from the 5V pin to the D2 pin on the breadboard (you can see where these are on the Arduino, but they're getting plugged into the breadboard).

2. On the D2 pin, also plug in the wire that leads to the RCA female input. Remember that you want to flow of energy to go across the resistor first, so be sure to plug in the lead wire second.

3. Connect your ground wire from the RCA female input into the ground (gnd) pin next to D2.

Step 6: Build Your Solar Sensor

Sensors used in this project were developed from full size solar cells that were cut down to 2x2 inch squares, soldered, and laminated with a Teflon cover. However, theoretically solar cells could be pulled from cheaper materials (solar power toys are a possibility) and used. Solder a resistor of 2.2 ohms across the leads for the solar sensor. Cut and strip the end of a male RCA cord to separate the ground and lead wires, making sure to leave the male output attached. The ground wire should be hooked up to the front of the solar cell, and the lead wire should be hooked up to the back of the cell. Wrap the wire from the cord around the solar sensor's lead, and solder them together. Note that the resistor is in parallel here.

Step 7: Wire Your Solar Sensor

On this model, the solar sensor is wired for the right RCA female input. Again, this is just because the pins needed are on the right (analog) side.

1. Hook up your RCA input lead to the Arduino A5 pin.

2. Connect your ground lead to the ground (GND) pin on the analog side (all of the pins on this side of the Arduino start with A).

One note: if you finish this project and the solar sensor is reading 0 volts, try switching your ground and lead wires. If the sensor was soldered incorrectly, these might be switched.

This is the code used in this project. It outputs voltage in volts and temperature in Celsius using the serial monitor. You'll need to download the Dallas Temperature (https://github.com/milesburton/Arduino-Temperature-Control-Library) and the One Wire (https://github.com/PaulStoffregen/OneWire) libraries and include them in your arduino program.

const int sunPin = A5; // connector to use on the Arduino board

float sunValue = 0; //declare the variable

float avgMeasure(int pin, float scale, int num) { analogRead(pin); //discard first value delay(2); float x = 0; for (int count = 0; count < num; count++) { x = x + analogRead(pin); //delay(5); } x = x / num; return (x * scale); }

#include #include // Data wire is plugged into pin 2 on the Arduino #define ONE_WIRE_BUS 2 // Setup a oneWire instance to communicate with any OneWire devices // (not just Maxim/Dallas temperature ICs) OneWire oneWire(ONE_WIRE_BUS); // Pass our oneWire reference to Dallas Temperature. DallasTemperature sensors(&oneWire); void setup() { analogReference(INTERNAL); //use the 1.1 V reference Serial.begin(115200); // communicate at 115200. Faster than the standard of 9600 Serial.print("Voltage"); //Title for the voltage Serial.print(" "); //spacer Serial.print("Temperature"); //Title for the temperature sensor

// Start up the library sensors.begin();}

void loop() { sunValue = avgMeasure(sunPin, 1.0, 100); //call the subroutine to take 100 measurements an average sunValue = sunValue * 1.07422; //Converts the Arduino's counts to voltage, since there are 1024 counts and 1.1V. sensors.requestTemperatures(); // Send the command to get temperatures Serial.println(""); //begin new line Serial.print(sunValue); //outputs the voltage Serial.print(" "); //spacer Serial.print(sensors.getTempCByIndex(0)); //outputs the temperature delay(1000); //reads the data once every second.

}

Recommendations

• Arduino Class

69,895 Enrolled

• Make it Move Contest

We have a be nice policy.