Calculation of Heat Pumped by Peltier

Peltier units are simply heat pumping devices and have really low COP compared to conventional vapor compression cycle based units. To estimate, how much amount of heat is pumped, I did a simple experiment. I bought a simple Peltier unit from Adafruit and glued it to a heat sink with thermal tape.

I put the heat sink in the measured amount of water (160 gm) and recorded temperature with TMP 35 sensor. Initial temperature of water was 31 deg C and final temperature after 300 seconds was 44 deg C.

Resistance of the Peltier was around 3.1 ohm from the current (2.6 A) and voltage (9.6 V) measurement.

  1. Amount of total energy energy dissipated (Qd) in water is 8706 J from m*Cp*(Tf-Ti)
  2. Energy supplied (E) over the 300 seconds was found to be 7488 J from V*I*t
  3. Heat generated to resistance (Qr) is small 21.9 J from I^2*R loss.
  4. Amount of heat removed from cold side = Qd – Qe – Qr = 1197 J or about 4 W
  5. This comes to COP = 4 W/(2.6 A*9.6 V) = 0.16

This calculation is rough estimate of the COP as thermocouple was +/- 2 deg C accuracy. Also this test does not indicate the performance of peltier in other operating conditions. It was done just to know how good is the peltier performance.

Advertisements

Peltier Cooling and Heating with Arduino

Cooling with Peltier

I used a Peltier fan heat sink unit sold by Adafruit for this work. Small plate connected to this Peltier unit cools to a really low temperature of -7 deg C almost instantly due to its small size. I used Arduino UNO with N-channel MOSFET to control the Peltier unit. Program and Arduino circuit used came from this work on garagelab.com.

N-Chnnel MOSFET
Peltier with fan heat sink unit

Heating and Cooling a Peltier

I was working with a friend to explore option of simultaneous heating and cooling for neonatal care in India (http://www.palav.org/). I could not find easily an option for simultaneous heating and cooling with Peltier. There are many posts for cooling control. Several people mentioned using H bridge for reversing currents on Arduino forums. Still it was difficult to find which one will work with Peltier unit that I have. This is just an attempt to know that it is possible to use H bridge for this purposes. It gives precise control over temperature required with both heating and cooling. Ultimately I found it is possible but costly option for amount of heating and cooling required.

For simultaneous heating and cooling H-bridge is needed. I used Pololu simple high power motor controller for this work and used sample program from Pololu with Arduino. Software serial library is also needed with this, which is available on Arduino website. Change input to setMotorSpeed from -3200 to 3200 to control the cooling and heating respectively. This works great for the Peltier fan heat sink unit.

Connecting Pololu is easy with image from the H-bridge user guide.

Connect Arduino digital pin 4 to Simple Motor Controller RX and Arduino GND to Simple Motor Controller GND.

#include 
#define rxPin 3  // pin 3 connects to smcSerial TX  
#define txPin 4  // pin 4 connects to smcSerial RX
SoftwareSerial smcSerial = SoftwareSerial(rxPin, txPin);
 
// required to allow motors to move
// must be called when controller restarts and after any error
void exitSafeStart()
{
  smcSerial.write(0x83);
}
 
// speed should be a number from -3200 to 3200
void setMotorSpeed(int speed)
{
  if (speed < 0)   
{     
smcSerial.write(0x86);  // motor reverse command     
speed = -speed;  // make speed positive   
}   
  else   
{     
smcSerial.write(0x85);  // motor forward command   
} 
  
smcSerial.write(speed & 0x1F);   
smcSerial.write(speed >> 5);
}
 
void setup()
{
  // initialize software serial object with baud rate of 19.2 kbps
  smcSerial.begin(19200);
 
 // the Simple Motor Controller must be running for at least 1 ms
 // before we try to send serial data, so we delay here for 5 ms
 delay(5);
 
 // if the Simple Motor Controller has automatic baud detection
 // enabled, we first need to send it the byte 0xAA (170 in decimal)
 // so that it can learn the baud rate

 smcSerial.write(0xAA);  // send baud-indicator byte
 
 // next we need to send the Exit Safe Start command, which
 // clears the safe-start violation and lets the motor run
 exitSafeStart();  // clear the safe-start violation and let the motor run
}
 
void loop()
{
 setMotorSpeed(-2800);  // full-speed forward
 delay(10000);
 // setMotorSpeed(3200);  // full-speed reverse 
 // delay(1000);
}

Gauges for Arduino on Android

indicator

Sensor reading from Arduino can be read on your Android device with Bluetooth module. You can display this sensor data on the beautiful gauges. We need some software and hardware carpentry to pull this through. Here is the screenshot of the temperature reading measured using the Arduino UNO on the Samsung 10.2 tablet. You can have multiple sensors and display using gauges on Android device.

 

 

 

Things You Need

A JY-MCU bluetooth module

JY

A temperature sensor (TMP 35)

sensor

Arduino UNO

ArduinoUno_r2_front450px

Connections on Breadboard

sketch_bb2

 

Arduino Sketch

Open the Arduino and copy the following code into it.
Create a new sketch and copy the following code.

const int temperaturePin = A0; 

void setup()
{ 
Serial.begin(9600); 
} 

void loop() 
{ 
float voltage, degreesC ; 
char message; 

voltage = getVoltage(temperaturePin); 
degreesC = (voltage - 0.5) * 100.0; 

while (Serial.available() == 0); 
message = Serial.read(); 
if(message=='T'){ 
Serial.print(degreesC); 
} 
Serial.flush(); 
} 

float getVoltage(int pin) 
{  
return (analogRead(pin) * 0.004882814); 
}

Explanation of the above code is like this.

For JY-MCU Bluetooth module, we need to setup the baud rate of 9600. Remainder of the code is setting up the temperature sensor on A0 pin and reading voltage. Voltage is further converted to the temperature in degree Celsius. When message is received from the Android device, android sends the temperature value over the serial.

When a message to read temperature is received from the Android device, Arduino sends the temperature value over the serial port to Android. Connect Arduino to your machine and upload the sketch to it.

Android Setup
We will be using Eclipse and Windows platform to create the app for your Android device. Before getting started become familiar with “Hello World” tutorial of the Android. This tutorial will also help to install Eclipse, Android device driver and Android installation on your Windows machine.

For Bluetooth communication between Android devices Arduino we will use tBlue library from Arduino Bots and Gadgets book from Make. TBlue library is available from here.

Connecting to Arduino from Android

With tBlue library connecting from android is very easy with command,

tBlue=new TBlue("XX:XX:XX:XX:XX:XX");

where Bluetooth address of the Bluetooth module is provided in the quotes. Easiest way to get MAC address of your Bluetooth module is to power up Arduino, enable Bluetooth mode from Android and connect to it with default password provided by manufacturer. Install the BluetoothScanner app from Google play store on Android to know the MAC address of the paired Bluetooth module.

Once Bluetooth module on Arduino is connected to the Android device, reading the data with tBlue is very easy with this command.

String s = tBlue.read();

Sensor data received in the string is further converted to a number and displayed in the gauge with the GaugeView library. Sending data to Arduino over Bluetooth can be done with command

 tBlue.write();

 

GaugeView Library for Android
Download the GaugeView Library with demo project from Github. In next step we will customize this project.

Customizing GaugeView Demo Project in Eclipse
Open Eclipse and go to File > Import > Android > Existing Android Code into Workspace option. Click Next and select GaugeView Demo project as root directory.

Open the src folder in GaugeView Library, copy GaugeView.java file and paste into src.org.codeandmagic.android.gauge.demo folder of the demo project.

Correct the package name in the library as,

package org.codeandmagic.android.gauge.demo;

Create a new class TBlue.java and paste code from tBlue library from here. Expand res folder and copy the images from drawable folder of the GaugeView library to drawable folder of demo project. Similarly copy the arrays.xml and attrs.xml files containing color ranges to values folder from the GaugeView Library.

 

Modify the Default GUI in GaugeView Library
Open the activity_main.xml file in layout folder and add a button tag in layout file to measure the temperature form Arduino. Paste the following lines inside the button.

<Button
android:id=”@+id/button1″
style=”android:attr/buttonStyleSmall
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:onClick=”onButtonMeasure”
android:text=”Measure” />

Also write to create a text box to indicate the message when Bluetooth module is connected to Android.

<TextView
android:id=”@+id/textView1″
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:text=”Small Text”
android:textAppearance=”?android:attr/textAppearanceSmall” />

Also change the unit in layout file to the desired one by using a string variable.

gauge:textUnit="@string/tempUnit" 

Here we used degree Celsius for temperature. To do this add a string variable in string.xml file values folder.

<string name=”tempUnit”><sup><small>o</small></sup>C</string>

Modifying the GauageView Demo Project
Open the MainActivity.java and import the additional packages for textView and View

import android.widget.TextView;
import android.view.View;

Also add the following variables

TextView messagesTv;  
TBlue tBlue;  

In the oncreate method, provide the id of the gauge1, gauge2 and text message viewer same as your layout file. Also provide the id of the Bluetooth module and exception handing code which prints messages in LogCat window of Eclipse.

mGaugeView1 = (GaugeView) findViewById(R.id.gauge_view1);
mGaugeView2 = (GaugeView) findViewById(R.id.gauge_view2);
messagesTv =  (TextView)findViewById(R.id.textView1);  

tBlue = new TBlue("xx:xx:xx:xx:xx:xx");  
		if (tBlue.streaming()) {  
            messagesTv.setText("Sensor Connected successfully! ");  
        } else {  
            messagesTv.setText("Error: Sensor Failed to connect. ");  
        } 
		tBlue.write("T");  

Also remove the timer code

mTimer.start();

Permissions for Bluetooth Communication
androidmanifes

Open the AndroidManifest.xml file and add the following two lines to allow Bluetooth communication as highlighted in the screenshot.

<uses-permissionandroid:name="android.permission.BLUETOOTH"/>
"android.permission.BLUETOOTH_ADMIN"/>

 

Running the Android App

Follow these steps to install and run

  • Power up the Arduino with Bluetooth module and also enable Bluetooth on your Android device
  • Connect to Bluetooth module from Android by entering the password provided by the Bluetooth module manufacturer
  • Connect your Android device to Windows machine
  • Go to Run > Run configuration > Target tab to run the app on connection device instead of Dalvik Virtual Machine
  • Run the project to install and launch the application on the Android
  • Click on measure button to display the temperature in the room on gauge

Get completed project from here.