Showing posts with label arduino. Show all posts
Showing posts with label arduino. Show all posts

Sunday, January 30, 2011

Android TV Remote - Failure one

, I decided my phone should also act like a TV remote. The first problem with that is the missing hardware. It doesn't have an IR emitter. After a brief search, I decided that Android Phone - IR Emitter integration didn't exist, and I proceeded to begin building my own.

 My first attempt was to buy a 20$ universal remote from radio shack and attempt to wire up the buttons so that I could invoke them digitally. I took apart the remote and discovered that it was essentially a single board with an IR emitter at the front. I glued wires to the button contacts and glued the wires to the board with hot melt glue so that the fragile wire-glue connections would not break.

I connected the wires to a breadboard and could push the buttons electronically with the digital out from an arduino. I could then hook the arduino up to a webservice and I would have the first iteration of a working android/web phone remote.

 But! Then I saw this product from Global-Cache GC-100. It allows serial, IR, and other devices to be hooked up to an ethernet network and accessed remotely. So, although wiring up a TV remote to an arduino was fun, challenging, and a useful trick to have in my arsenal, it also wasn't better than the existing commercial solution. I have abandoned this avenue of attack and ordered a GC-100.

Monday, November 1, 2010


This is a wireless thermometer. It transmits the temperature in the small greenhouse on my balcony to my computer. From there, I can email myself if the temperature in the greenhouse approaches freezing or just post the temperature on the web for fun.

There are three components here:

  1. An Arduino.
  2. An XBee wireless module.
  3. A Temperature sensor. 
The arduino is programmed to read the voltage from the temperature sensor, convert it to a text string, and then send it over the XBee transmitter to the XBee receiver which is connected to my computer's serial port. 

This is the arduino code:
#include <NewSoftSerial.h>

NewSoftSerial mySerial
= NewSoftSerial(2, 3);

void setup() {
// initialize the digital pin as an output.
// Pin 13 has an LED connected on most Arduino boards:
pinMode(13, OUTPUT);
Serial.begin(
9600);

Serial.println(
"Goodnight moon!");
// set the data rate for the SoftwareSerial port
mySerial.begin(9600);
mySerial.println(
"Hello, world");
}

void loop() {
float voltage = 5.0*analogRead(0)/1024;
float temperatureC = (voltage - 0.5) * 100;
float temperatureF = (temperatureC * 9 / 5) + 32;

Serial.print(temperatureF); Serial.println(
" degrees F ");

mySerial.print(temperatureF); mySerial.println(
" degrees F ");

delay(
1000);
}

The SoftSerial library is very useful. It enables serial communications on any two digital io pins.

The following powershell code reads the temperature from the XBee module and uploads it to a WebService:

$portName = "COM4"
$url = "http://ogresoft.com/Temperature/Home/SetTemperature?Temperature="
$delay = 60

$serialPort = New-Object "System.IO.Ports.SerialPort"
$serialPort.PortName = $portName
$serialPort.Open()

while($true) {
$temperature = $serialPort.ReadLine()
Write-Host $temperature
$request = [System.Net.HttpWebRequest]::Create($url + [DateTime]::Now.ToString() + " " + $temperature)
$response = $request.GetResponse()
Write-Host ([DateTime]::Now.ToString() + " " + $response.StatusCode)
Sleep $delay
}