Category Archives: Electronics

Arduino Remote Control Indoor Thermometer

Happy Holidays everyone, its been a while since my last post but i have been a bit busy over the past few months. I have been working on a Infrared remote control version of my indoor thermometer. It has a menu and displays the current temperature in Celsius, Fahrenheit, and Kelvin.

Before i go any further i need to credit   and more specifically his instructable  on IR remotes and Arduino. Also credit is due to Ken Shirriff for the original IR remote libraries located on Git Hub.

For this project i used the same set up as with my previously posted indoor thermometer with the added TSOP4838 IR receiver and IR remote. The first task was decoding the IR signals from the remote i had which was very easy thanks to the previously mentioned instructable. Each button sends out a different signal and once you have the signals its a matter of just coding what you want done when said signal is recognized.

Here is the code.

#include <IRremote.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(8,9,7,6,5,4);

float temp;
int tempPin = 0;
int IRpin = 11;
IRrecv irrecv(IRpin);
decode_results results;
boolean menu = true;
boolean submenu = true;

byte degree[8] = {
  0b01111,
  0b01001,
  0b01001,
  0b01111,
  0b00000,
  0b00000,
  0b00000,
  0b00000,
};

byte downArrow[8] = {
  0b00000,
  0b00000,
  0b00000,
  0b00100,
  0b00100,
  0b10101,
  0b01110,
  0b00100,
};

byte upArrow[8] = {
  0b00100,
  0b01110,
  0b10101,
  0b00100,
  0b00100,
  0b00000,
  0b00000,
  0b00000,
};



void setup() {
  Serial.begin(9600);
  irrecv.enableIRIn(); //Start the receiver
  
  lcd.createChar(0, degree);
  lcd.createChar(1, downArrow);
  lcd.createChar(2, upArrow);
  lcd.begin(16, 2);
  
 
 
  
}

void loop()
{
  
  temp = analogRead(tempPin);
  float tempK = (((temp/1023) * 5)*100); //calculate Kelvin
  float tempF = (((tempK - 273.15)*1.8) + 32); //calculate Farenheit
  float tempC = (tempK - 273.15); //calculate Celsius

  if(irrecv.decode(&results))
    {
      irrecv.resume();
    }
    
  if (menu == true || results.value == 16738455) //menu page 1
    {
        menu = true;
        submenu = true;
        lcd.clear();
        lcd.print("1:Farenheit"); //menu
        lcd.setCursor(0,1);
        lcd.print("2:Kelvin");
        lcd.setCursor(15,1);
        lcd.write(byte(1));
        delay(1000);               
    }
    
  if (submenu == true && results.value == 16769055) //display menu page 2 by pressing the minus button while on menu page 1
    {
        menu = false;
        lcd.clear();
        lcd.print("3:Celsius");
        lcd.setCursor(15,0);
        lcd.write(byte(2));
        delay(1000);
    }
    
  if (submenu == true && menu == false && results.value == 16754775) //display menu page 1 by pressing the plus button while on menu page 2
    {
        lcd.clear();
        lcd.print("1:Farenheit"); //menu
        lcd.setCursor(0,1);
        lcd.print("2:Kelvin");
        lcd.setCursor(15,1);
        lcd.write(byte(1));
        delay(1000);      
    }
    
  if (results.value == 16724175)
    {
        submenu = false;
        menu = false;
        results.value = 0;
        Serial.println(tempF); //display Farenheit
        lcd.clear();
        lcd.print(tempF);
        lcd.write(byte(0));
        lcd.print("F");
        delay(1000);           
    }
    
  if (results.value == 16718055)
    {
        submenu = false;
        menu = false;
        results.value = 0;
        Serial.println(tempK); //display Kelvin
        lcd.clear();
        lcd.print(tempK);
        lcd.write(byte(0));
        lcd.print("K");
        delay(1000);
     }
     
  if (results.value == 16743045)
    {
        submenu = false;
        menu = false;
        results.value = 0;
        Serial.println(tempC); //display Ceslsius
        lcd.clear();
        lcd.print(tempC);
        lcd.write(byte(0));
        lcd.print("C");
        delay(1000);
    }
              

}

The remote i used which you can see in the pictures below is small with few options so i used the + & – button as up and down for the menu, and 1 2 & 3 to select which unit of measurement to display also i used the 0 button to go back to the menu.  Here are the pictures and schematic.

IR Indoor Thermometer
IR Indoor Thermometer

Just as a side note as to not confuse anyone in my pictures the potentiometer to adjust the temperature sensor has been removed. I had previously adjusted it to the correct setting and there was no need to leave it on.

If theres any questions about this or any of my other projects feel free to post them here. Hopefully ill post again before the new year but if not then Merry Christmas and Happy New Year to you all.

Secret of Mana 3D Perler Lighted Cube

For my latest project i wanted to do a Perler Cube. We have quite a perler collection here but nothing done in 3D. I thought a simple cube would be the easiest, then thought it would be even better to make it lighted. Here are some pics.
IMG_20150313_175108

IMG_20150313_175116

IMG_20150313_175125

IMG_20150313_175134

IMG_20150313_175558

PerlerCube1

For those that don’t know the sprites on the cube, they are the icons for the different schools of magic in the Super Nintendo game Secret of Mana. Included on the cube are Undine, Salamando, Shade, Gnome, and Sylphid.

Here is a link to the sprite sheet i used from Spriters Resource. For the illumination i used 1 9volt, 1 resistor, a switch,     and 2 ultra bright LED’s. This is actually a few weeks old project, currently I have been working on an android app which hopefully will be completed in the next week or two.  Until then!!

Arduino Indoor Thermometer Revised

I actually did this right after the amp but have been too busy to post it, or lazy. This is just a revised thermometer with the extra pot to zero in on the correct voltage to get an accurate temp reading.  If that is confusing then ill explain.

Here is the sketch i use to get the temp in Fahrenheit.

/* Indoor temperature with LM335Z temp sensor and being displayed
on a 16x2 LCD
by Travis Compton
2/6/15
*/

#include <LiquidCrystal.h>
LiquidCrystal lcd(8,9,7,6,5,4);

float temp;
int tempPin = 0;

byte degree[8] = {
  0b01111,
  0b01001,
  0b01001,
  0b01111,
  0b00000,
  0b00000,
  0b00000,
  0b00000,
};



void setup() {
  Serial.begin(9600);
  
  lcd.createChar(0, degree);
  
  lcd.begin(16, 2);
  
}

void loop()
{
  
  temp = analogRead(tempPin);
  //calculate Kelvin
  float tempK = (((temp/1023) * 5)*100);
  //calculate Farenheit
  float tempF = (((tempK - 273.15)*1.8) + 32);
  
  Serial.println(tempF);
  lcd.clear();
  lcd.print(tempF);
  lcd.write(byte(0));
  lcd.print("F");
  delay(10000);
}

As you can see its quite simple. I first take the raw output from the temp sensor, convert it to Kelvin, then convert it to Fahrenheit. The reason we need that 3 pot is because of this formula in the sketch
tempK = (((temp/1023) * 5)*100)

We take the Analog read from the sensor and store it in temp, then divide that by 1023, then multiply that by 5, and lastly multiply that by 100 to get the temp in Kelvin. Whats important here is the multiply by 5 which is the voltage being fed to the sensor, which is not going to be a constant when using usb to power this project. If we where using a 9volt battery we would substitute the 5 for 9. So lets say we are only getting 4.6 volts from usb to power this project are temp will be off, here in lies the need for the 3 pot. Although with this method we would need another thermometer to verify are adjustments.

I hope i made this clear enough, if anyone has any questions just ask. Now for some pics.

Indoor thermometer w/ pot

And of course as always the fritzing schematic.

Indoor Temp with potentiometer_bb

Well thats it for this post. I have a lighted 3d cube im working on with some pictures from secret of mana on it, i would like to show this next, hopefully sometime this week.

Arduino Amp

For my next project i wanted to do a small amp. This project is very simple thanks to the LM386 IC.

OpAmp

Here are the parts required.

1 speaker

1 LM386

1 .1uf – .05uF Capacitor

1 220-250uF Electrolytic Capacitor

1 10 ohm resistor

1 10k Trimmer Potentiometer

1 audio plug based on how you wish to hook up your amp

For the audio plug as you can see in the picture i provided i used a 1/8th mono plug. You could use an RCA Plug or even a larger audio plug if you wanted based on need.  I would also like to point out that the schematic calls for a 10 ohm resistor, however I did not have a 10 ohm so i used the lowest i had which was a 220 ohm. A few days later i salvaged a 10 ohm resistor and stuck it in the breadboard. It is my opinion that the amp sounds better with the 220 than it did with the 10 ohm. The arduino is only being used to power the amp, you could just as easily use a 9 volt battery.

OpAmp_bb

Fritzing which is a wonderful program does not have many audio plug to choose from, this i why the black and red wire coming from pin 3 and pin 4 from the LM386 are not connected to anything in the breadboard schematic. But as you can see from my project picture these are running to my audio plug.

Arduino Indoor Thermometer

I wanted to do a simple project for my newly acquired 16×2 LCD display, and thought I should do an indoor thermometer. I searched around a bit online but couldn’t find exactly what i wanted to do, most projects where indoor/outdoor. I did however find this great tutorial here on hooking up the 16×2 LCD with 2 pots.

I added my LM335z temperature sensor, hooked up my arduino, made a little sketch to output the temp to the serial monitor. It was 3 degrees off and that could have easily been fixed with a another pot however i only have 2 and used them for the LCD display. Here is a diagram i made with fritzing.

Indoor Temp_bb

And here is a very poor photo of the finished project.

Arduino Indoor Temp

7 segment display schematics for T0D323BMRL / D12C04186R

The 7 segment display i used in my previous post has the part number T0D323BMRL and D12C04186R. I googled these numbers and came up with nothing, even at websites devoted to schematics and part numbers. Therefore i had to find out the pins myself, which wasn’t that hard but i thought i would post the info here in case someone else needs it as it is not a common diagram.

D12C04186R

Update

So its been about a month since my last post. I’ve grown bored with Python and development in general, however that does not mean I’ve been unproductive.

The micro controller Arduino has been my new obsession. Namely salvaging old lcd displays, and segment displays, and then getting them to work with Arduino. There is minor programming involved but not nearly as much as before so the small break is nice.

Pictured below is a 2 digit 7 segment display that i salvaged from an old radio shack cordless telephone (cat 43-3880). It came from the phone base, not the handset. It only has 9 pins, pin 2 was never installed and i assume it controls the decimal point seeing as that was the only segment i was unable to light up. Its common anode which are located on pin 5 and 10.

IMG_20150202_193927