Testing a Peltier cooler with a 100W solar panel using two BME280 sensors, an ESP8266, a DS18B20 temperature sensor and Google Charts
I’ve had an interest in thermoelectric cooling with Peltier devices for years. When electricity is supplied to these devices, one side gets hot and the other gets cold. I’ve created this experiment to see how effective a 100W solar panel powering a Peltier cooler is in cooling air to make a mini air conditioner. The efficiency of a Peltier is much lower than other methods of cooling such as the refrigerant-based modern air conditioning units.
For my testing I used two sensors to take measurements of air temperature and humidity before and after the air has passed through the fins of a heat sink connected to the Peltier. A third temperature sensor measures the temperature of this heat sink. The speed the air travels through the heat sink is controlled by a fan.
Sensor readings and fan speed control are managed by an ESP8266 microcontroller. This also sends the sensor readings to a web server to be displayed in a web-browser.
To replicate this experiment you will need the following items…
… and some sort of plastic Tupperware style box.
This project uses the ESP8266 to control the speed of the PC fan based on the temperature of the Peltier. You can see more details on this method here Temperature Controlled Fan. In this experiment I wanted to prevent the heat sink dropping below 0 degrees because at ~0 C it takes energy to turn water on the heat sink into ice without actually changing the temperature.
For more information about using two BME280 sensors you can see this project Two BME280 Sensors Over SPI
Before starting to assemble the items I connected the solar panel to the step down module and set the output to 12 volts. The motor controller in this experiment outputs 5 volts when 12v is supplied to the input. I used this to power the ESP8266 via the 5v rail. I also checked this as below.
First Test
To make sure everything was working before assembling I wired everything together on the bench and pushed the DS18B20 temperature sensor into the fins of the Peltier heat sink
I used Google’s free charting software https://developers.google.com/chart/ to create live charts from the values coming from sensors. Below you can see the temperature of the Peltier dropping and the speed of the fan increasing when I switch on the power from the solar panel. The animation is about 5x speed.
Assembly
I used a plastic food container because I wanted to use something transparent so all the parts of the project were all visible. The first image shows the project mostly assembled with a few wires not connected and the Peltier cooler not in place. The PC case fan sucks air out of the plastic container.
This image shows the project with the Peltier cooler in place and all the wires connected.
This image shows the insides of the project. The first BME280 is reading the ambient temperature and humidity. The second BME280 on the right is reading the temperature and humidity after the air has been sucked through the fins of the Peltier heat sink. The DS18B20 is reading the temperature of the heat sink.
Results
I knew that one 100W solar panel combined with the inefficiency of a Peltier cooler was not going to produce a lot of cold air but I was a little disappointed with the results. Below are two charts. The first one shows the Peltier temperature and the fan speed after the power is connected. The second shows the two readings from the two BME280s. On this experiment the temperature difference is only about 5C with the fan running at only 60% so not much cool air!
I took a reading of the amps being used by the Peltier device and it was 3.4A. It’s sold as a 6A device so I tried a few other things such as connecting the Peltier alone to the solar panel and also using batteries for the Peltier but the amps were still below 4A so maybe it’s just a 4A device.
I also tried another test of disconnecting the PC fan so there was no airflow over the heatsink to see how this affected the temperature.
Note that in the graph below the fan speed shown is the fan speed the code is requesting from the motor controller. The fan is disconnected so is at 0%
Arduino Sketch
The code is a combination of the code from the two BME280 sensors over SPI project and the fan control with temperature sensor project.
The Sketch starts by including all the necessary libraries, assigning pins on the ESP8266 and setting up some variables. The main function void loop() has two parts. The first takes a reading of the Peltier heat sink temperature and adjusts the case fan speed based on the this. The second part runs every two seconds and calls the function connectToWebAndSendData which collects information from the various sensors and sends this to the web server along with the current fan speed.
On the web server this data is converted into a JSON formatted text file by this PHP script – https://pastebin.com/BpcuA0sZ
A line from this JSON text file looks something like this:
{"peltier":{"peltier_temp":2.00,"fan_speed":20},"sensor_temp":{"air_temp":30.08,"processed_temp":24.63},"sensor_humidity":{"air_humidity":51.88,"processed_humidity":49.62}}
This line is used by Google Charts code in an HTML page to create the dynamically updating graphs. Code here – https://pastebin.com/KdP2M5Xd
The Arduino code looks like this:
#include <ESP8266WiFi.h> #include <ESP8266HTTPClient.h> #include <Wire.h> #include <SPI.h> #include <Adafruit_Sensor.h> #include <Adafruit_BME280.h> #include <OneWire.h> #include <DallasTemperature.h> // assign the ESP8266 pins to Arduino pins #define D1 5 #define D2 4 #define D3 0 #define D4 2 #define D5 14 // assign the SPI bus to pins #define BME_SCK D1 #define BME_MISO D5 #define BME_MOSI D2 #define BME1_CS D3 #define BME2_CS D4 #define SEALEVELPRESSURE_HPA (1013.25) #define D7 13 // fan PWM #define D8 15 // fan on #define ONE_WIRE_BUS 12 // Peltier thermometer sensor int fanPinPwm = 13; int fanPinOn = 15; int dutyCycle = 0; // Setup a oneWire instance to communicate with OneWire device OneWire oneWire(ONE_WIRE_BUS); // Pass our oneWire reference to Dallas Temperature. DallasTemperature sensors(&oneWire); Adafruit_BME280 bme1(BME1_CS, BME_MOSI, BME_MISO, BME_SCK); // software SPI Adafruit_BME280 bme2(BME2_CS, BME_MOSI, BME_MISO, BME_SCK); // software SPI long previousMillis = 0; // store last time sensor data uploaded long interval = 2000; // interval at which to send data const char *ssid = "YOUR WIFI SSD"; const char *password = "your wifi password"; String actionUrl = "http://yoururl.com/path/php-action-file.php"; void setup() { Serial.begin(115200); delay(10); // Explicitly set the ESP8266 to be a WiFi-client WiFi.mode(WIFI_STA); WiFi.begin(ssid, password); // peltier temp sensor sensors.begin(); pinMode(fanPinPwm, OUTPUT); // sets the pin as output: pinMode(fanPinOn, OUTPUT); // sets the pin as output: analogWriteRange(100); // to have a range 1 - 100 for the fan analogWriteFreq(10000); // PWM // BME temp and humidity sensors bool status; status = bme1.begin(); if (!status) { Serial.println("Could not find a valid BME280 sensor 1 , check wiring!"); } status = bme2.begin(); if (!status) { Serial.println("Could not find a valid BME280 sensor 2 , check wiring!"); } } void loop() { // This part controls the fan speed based on the temperature of the Peltier float peltierTemp = readPeltierTemp(); // Request sensor value peltierTemp = constrain(peltierTemp, 0, 30); // constrain the peltier temp reading between 0 and 30 int fanSpeedPercent = map(peltierTemp, 0, 30, 100, 10); // invert the fan speed and make a percent controlFanSpeed (fanSpeedPercent); // Update fan speed // Only send data to server every 2 seconds unsigned long currentMillis = millis(); if (currentMillis - previousMillis > interval) { previousMillis = currentMillis; connectToWebAndSendData(fanSpeedPercent); } } // sends data from three sensors and fan speed void connectToWebAndSendData (int fanSpeedPercent) { if (WiFi.status() == WL_CONNECTED) { //Check WiFi connection status HTTPClient http; String actionUrlWithQueryString = actionUrl; actionUrlWithQueryString.concat(getPeltierTempAsQueryString()); //add the peltier temp actionUrlWithQueryString.concat(getBMEValuesAsQueryString()); // add the BME data actionUrlWithQueryString.concat("&fan_speed="); // add the fan speed actionUrlWithQueryString.concat(fanSpeedPercent); Serial.println(actionUrlWithQueryString); http.begin(actionUrlWithQueryString); //Specify destination for HTTP request int httpCode = http.GET(); if (httpCode > 0) { // file found at server if (httpCode == HTTP_CODE_OK) { String payload = http.getString(); Serial.println(payload); } http.end(); } } } float readPeltierTemp () { sensors.requestTemperatures(); // Send the command to get temperatures Serial.print("Temperature: "); Serial.println(sensors.getTempCByIndex(0)); return sensors.getTempCByIndex(0); } String getPeltierTempAsQueryString() { String queryString = "?peltier_temp="; queryString.concat(readPeltierTemp ()); Serial.println(queryString); return queryString; } String getBMEValuesAsQueryString() { String queryString = "&air_temp="; queryString.concat(bme1.readTemperature()); queryString.concat("&air_humidity="); queryString.concat(bme1.readHumidity()); queryString.concat("&processed_temp="); queryString.concat(bme2.readTemperature()); queryString.concat("&processed_humidity="); queryString.concat(bme2.readHumidity()); Serial.println(queryString); return queryString; } void controlFanSpeed (int fanSpeedPercent) { Serial.print("Fan Speed: "); Serial.print(fanSpeedPercent); Serial.println("%"); digitalWrite(fanPinOn, HIGH); // set the motor controller pin on analogWrite(fanPinPwm, fanSpeedPercent); // set the fan speed via PWM }
Conclusion
The low power of a single solar panel and poor cooling efficiency of the Peltier were never going to make an effective air conditioner. In the future I may run another experiment for drying and heating air. I’ve also since discovered that the Peltiers work much better when they aren’t driven hard. This video explains it – https://youtu.be/YWUhwmmZa7A?t=1186
Buy Me A Coffee
If you found something useful above please say thanks by buying me a coffee here...
Shouldn’t you be dumping the heat from the hot side of the peltier somewhere?
The hot side is outside the box with the two fans attached to it.
Very interesting data!
I suspected peltier cells are not optimal for air conditioning, but what about a portable cooler for a six-pack of beer cans?
Yep.. probably just enough to cool drinks cans with some good insulation.