Wednesday 31 January 2018



LCD display is great way to display output from your arduino when it not connected to your computer. The common display used in arduino projects is 16×2 parallel LCD display which compatible with the Hitachi HD44780 driver. It can easily recognize with it 16 pin interface.

This sketch will print out text message “hello, world” and time in second since last reset.

Parts List;
1) 1x 16×2 parallel LCD display (compatible with Hitachi HD44780 driver)
2) 1x Arduino
3) 1x 10kΩ potentiometer
4) Jumper wire

Instruction;
1) Connect all jumper wire as shown in diagram.


2) Plug in 10kΩ potentiometer on breadboard. This potentiometer use for adjusting the contrast of the LCD character.

3) Plug in LCD display on breadboard.

Upload this code to your arduino
/*
  LiquidCrystal Library - Hello World
 
 Demonstrates the use a 16x2 LCD display.  The LiquidCrystal
 library works with all LCD displays that are compatible with the 
 Hitachi HD44780 driver. There are many of them out there, and you
 can usually tell them by the 16-pin interface.
 
 This sketch prints "Hello World!" to the LCD
 and shows the time.
 
  The circuit:
 * LCD RS pin to digital pin 7
 * LCD Enable pin to digital pin 8
 * LCD D4 pin to digital pin 9
 * LCD D5 pin to digital pin 10
 * LCD D6 pin to digital pin 11
 * LCD D7 pin to digital pin 12
 * LCD R/W pin to ground
 * 10K resistor:
 * ends to +5V and ground
 * wiper to LCD VO pin (pin 3)
 
 Library originally added 18 Apr 2008
 by David A. Mellis
 library modified 5 Jul 2009
 by Limor Fried (http://www.ladyada.net)
 example added 9 Jul 2009
 by Tom Igoe
 modified 22 Nov 2010
 by Tom Igoe
 
 This example code is in the public domain.

 http://www.arduino.cc/en/Tutorial/LiquidCrystal
 
 Code hosted at: arduinoprojects101.com
 */

// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);

void setup() {
  // set up the LCD's number of columns and rows: 
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("hello, world!");
}

void loop() {
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  // print the number of seconds since reset:
  lcd.print(millis()/1000);
}

#include <LiquidCrystal.h>
this will load LCD display library.

LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
define LCD interface pin

lcd.begin(16, 2);
define columns and rows of lcd display

lcd.print(“hello, world!”);
print to lcd text message “hello, world!”

Super Amazing Button using Arduino

Hello Everyone.
This is my very first Instructable so please go easy on me. This was more or less a test project to see if my new arduino board worked. Any friendly advice will be greatly appreciated so my future posts can be even better. I am going to show you how to create the best device on earth. Well i mean if you brought this back to the 1600s then it would be the best device on earth. Anyways lets get started.

I don't take full credit for this project as i set out on a witch hunt on the web in search of guidance. If i could remember where half of the info i learned came from i would point you to it, but unfortunately i have looked at so many things involving arduino and easy buttons and LEDs it just all blended together.

Step 1: Materials

So Here is the list of materials i used mostly from things i had lying around the house.

Easy button
1 Red LED
1 Arduino Uno
1 Box
Speaker wire
Electrical tape
1 9 volt battery
1 9 volt battery adapter
1 2.1mm center-positive plug
1 Phillips head screwdriver
heat shrink tubing (optional)

Step 2: Preparing the Easy Button

I had this hacked easy button from a previous project. the the pictures are scarce in this department but don't fret it is quite easy.

Start by unscrewing the four screws in the bottom of the easy button. This should enable you to take the top part off.
Then cut the wires to the speaker and the battery casing, you wont need either.
Then solder one piece of wire ( i used speaker wire because it was all i had lying around) to the positive spot n the picture
Then solder another piece of wire to the ground spot in the picture
take the battery compartment door off the easy button and run the wires through the hole and out the battery compartment door.
Reassemble the easy button *side note: there is a little groove in the outside ring part that has to line up with the button part.

Step 3: Make the Power Supply

take the 9 volt battery adapter and strip the wires
do the same for the 2.1mm jack
connect them together

all i did was twist the wires together and used heat shrink tubing to secure them.

Step 4: Prepare the Box

Feel free to use any box imaginable for this project. i just happen to have this box laying around. You can use any thing from cereal boxes to wooden box or even an invisible box if you feel like it.

Cut a hole for the LED and cut a hole for the easy button wire
Done

Step 5: Preparing the LED

There are far better ways to wire an LED than the way i did it but i was excited and rigged it up as quick as i could

long end of your led is positive, short end is ground

I attached a piece of wire to each and taped it down.

I should have probable used a resistor but i didnt have one and everything seems to be ok. The world is still standing.

Step 6: Connecting All the Wires

OK here we go.

connect the positive wire from the easy button to the number 2 on you arduino board
connect the ground of the easy button to a ground on the arduino board

connect the positive end of the LED to the number 8 on your arduino board
connect the ground end of the LED to a ground on the arduino board

connect the power supply the the power jack on the arduino board

wait to connect the battery till the end

Step 7: Set Up Arduino With Code

im going to assume (i know i know... assuming makes an......) that your arduino is set up with computer and all the drivers and whatnot are working and that you have the arduino IDE

anyways plug the arduino in your computer and fire up the ide
ether this code and upload it to the arduino

int buttonInput = 2;
int lightOutput = 8;
int buttonState = 0;

void setup() {
    pinMode(lightOutput, OUTPUT);
    pinMode(buttonInput, INPUT);
    digitalWrite(buttonInput, HIGH);
}

void loop() {
    buttonState = digitalRead(buttonInput);
    if (buttonState == HIGH) {
        digitalWrite(lightOutput, LOW);
    } else {
        digitalWrite(lightOutput, HIGH);
    }
}

Step 8:

stuff everything inside your box ( of course this step is going to differ from box to box) and seal it up

PUSH THE BUTTON!

Congratz! you have wasted probably a good couple hours on making this amazing contraption

seriously though this can be just a starting point for the most amazing device the world has ever seen, and it has limitless potential. Think about it what if you were to connect 2 LEDs. *gasp*

Thanks for taking the time to check out my first Instructable and any advice like i said in the beginning would be greatly appreciated.

Hacking a Powerglove using Arduino



























First of all lets get this out of the way... It's so bad

This is going to be showing how to hack the Nintendo Powerglove. By hack I mean tap into the flex sensors and use the buttons and d pad and add anything you want. In my case I added an accelerometer. 

I got mine from Ebay for around $40. These gloves have 4 flex sensors similar to these: http://www.sparkfun.com/products/8606
Now these are $12 a piece, it's way cheaper to buy a Powerglove for 4 sensors and get a bunch of other awesome things then buy 4 of these.

Step 1: Materials

Materials:
Screwdriver
Wire
microcontroller (i used Arduino)
USB cable
4 - 10k resistors

Optional:
ABS sheets
Nuts and bolts
Accelerometer or whatever sensor
Xbee with shield
9v Battery

I also have an Ardumoto shield with a vibrating motor for a feedback system

Step 2: Take It Apart




























This is kind of tricky if you don't know where the screws are. Don't loose them either!

Just fallow the pictures:

Step 3: Flex Sensors

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Show All 7 Items
Now its time to tap into the flex sensors. Flex sensors are variable resistors which mean the more you flex the more the resistance. You can then read that and map that value to anything you want. There are two wires coming from each sensors so we have 8 wires.

This website shows a good wiring diagram and explanation for it all: http://www.makingthings.com/teleo/teleo/cookbook/bendsensor.htm

We want to open up the palm to expose the board. Once we have that find where the sensors attach to the board. There will be 4 diodes by there. We are going to desolder the diodes and replace those with the 10k resistors. We will be attaching the positive to one of the two wires of each sensor. We well then attach ground to the resistors and attach wires from the second sensor wire. Pictures will help explain this a lot better.

Step 4: Attach Arduino (optional)


































I made a custom extension coming off the glove to hold the arduino. I did this with an ABS sheet and a heat gun. Pretty much heat it up and form it around your arm to get the shape. Then drill holes and attach to the glove with some nuts and bolts. I also made a custom 9v battery holder out of this stuff too.

Step 5: Wire Management

I tried to make this look as nice as I could. What I did was run the wires from the palm board to the forearm board then out of that to the arduino. This worked the best for me and it was easy.

 

Step 6: Buttons [Extra]

I haven't tapped into the buttons yet but its just like any other button. Two wires and an on or off signal. There are plenty of tutorials out there for buttons with arduino. D-pad is the same way, Just four buttons.

Step 7: Code

All the code is is just analog read. From here you can map it to whatever to control servos or whatever you want

int Finger1 = 2;
int Finger2 = 3;
int Finger3 = 4;
int Finger4 = 5;
int Rotation =  0;

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

void loop()
{  
   int FingerV1 = analogRead(Finger1);
   int FingerV2 = analogRead(Finger2);
   int FingerV3 = analogRead(Finger3);
   int FingerV4 = analogRead(Finger4);
   int RotationV1 = analogRead(Rotation);
 
   if (FingerV1 < 30) FingerV1 = 30;
   else if (FingerV1 > 80) FingerV1 = 80;
 
   if (FingerV2 < 45) FingerV2 = 45;
   else if (FingerV2 > 69) FingerV2 = 69;
 
   if (FingerV3 < 22) FingerV3 = 22;
   else if (FingerV3 > 87) FingerV3 = 87;
 
   if (FingerV4 < 12) FingerV4 = 12;
   else if (FingerV4 > 62) FingerV4 = 62;
 
   if (RotationV1 < 300) RotationV1 = 300;
   else if (RotationV1 > 600) RotationV1 = 600;

   int middle = map(FingerV1,30, 80, 0, 255);//middle
   int thumb = map(FingerV2,69, 45, 0, 100);//thumb
   int ring = map(FingerV3,87, 22, 0, 255);//ring
   int pointer = map(FingerV4,12, 62, 0, 255);//pointer
   int rotation = map(RotationV1,300, 600, 0, 255);//Rotation
 
   Serial.println(middle);
   Serial.println(thumb);
   Serial.println(ring);
   Serial.println(pointer);
   Serial.println(rotation);
 
   delay(10);
}




 For more detail: Hacking a Powerglove using Arduino


Arduino Solar Cell Tester

When I'm building Solar Shrubs and other solar-powered creations, I often scavenge cells from various off-the-shelf devices such as solar garden or security lights. But these cells are rarely labeled as to their voltage, current, and power output.

So it's off to my bread-boarding station. First, I put each cell under a lamp and connect it to my multimeter to get the volts. Then I build an I-R curve by measuring the voltage across a series of different sized resistors. This takes a lot of time and effort and I still don't know what the values are in sunlight. I could drag the multimeter, breadboard, and all associated components outside, but that would be a hassle and it's still very time consuming if I have a lot of cells to test.

My solution was to build an Arduino-based, handheld Solar Cell Tester. This tester can read up to 15 Volts at 1 Amp. Now I can carry one device outside, attach a single solar cell or a group of cells in series or parallel, and read voltage, current, and power quickly and accurately!

Here's how you can build one too!

NOTE: At first glance this device looks very similar to Ladyada's impressive Portable Solar Charging Tracker, But mine is actually more limited; only testing the cells, not lithium batteries and charging circuits. I used Adafruit's enclosure and protoshield for this project, but the calculations, circuits, and program are all mine (except for the excellent help, as always, from the Arduino on-line community!)


Step 1: Materials & Tools Needed

 

 

 

 

 

 

 

 

 

 

 

Materials Used:


(1) Arduino Uno
(1) Arduino Proto Shield (Adafruit #51)
(1) White Enclosure for Arduino (Adafruit #271)
(1) Parallax Serial LCD Panel (Parallax #27977)
(2) 10 ohm 10W Power Resistors (for current sensing circuit) (Radio Shack #271-132)
(1) 2K ohm resistor (for voltage sensing circuit)
(1) 1K ohm resistor (for voltage sensing circuit)
(1) DPDT Sub-Mini Toggle Switch (Radio Shack #275-614)
(1) SPDT Slide Switch (Radio Shack #275-409)
(1) 1/8" Phone Jack (Radio Shack #274-251)
(1) 1/8" Phone Plug (Radio Shack #274-284)
(2) 14" Insulated Test Leads (Radio Shack #278-1156)
(2) AAA Battery Holders (2 cell holder) (Radio Shack #270-413)

Tools Needed:


Soldering Iron
Solder
Helping Hands
Wire strippers
Side cutters
Dremel

Step 2: The Circuits

A DPDT toggle switch (SW1) serves as the on-off control which disconnects the 4-AAA batteries from the Arduino as well as the "Cell Under Test" from the sensing circuits. The cell under test is connected via red and black test leads attached to a phone plug and plugged into a 1/8" phone jack on top of the tester.

The tester includes two sensing circuits; one for measuring voltage and one for measuring current. A SPDT toggle switch (SW2) connects the cell under test to these circuits individually.

The Voltage Circuit: The Arduino analogRead command reads voltage up to +5V and returns an integer between 0 and 1023. In order for the tester to read up to 15V, you'll create a voltage divider that consists of a 2K (R3) and 1K (R4) resistor. The voltage across R4 is one-third the source voltage so it can read 0-15V. (NOTE: You can use any two resistors with a 2 to 1 ratio).

The Current Circuit: Since the analogRead command returns a value of 0-1023 (for a max of 5V), each unit is 5 divided by 1024 or 4.9mV. And from Ohms law, we know that the voltage drop across a resistor is equal to the current times the resistance. So the voltage drop across a 4.9 ohm resistor with 1mA of current is 4.9mV. This means we can effectively read the current across a 4.9 ohm resistor using the actual value returned by the analogRead command. There are at least two problems with this strategy.

(1) Because of it's low resistance, this circuit can produce a high current and consequently too much power for standard 1/4 or 1/2 Watt resistors. They would become dangerously hot very fast. So I recommend using Power resistors with at least a 5W rating.

(2) I looked high and low and couldn't find a 4.9 ohm power resistor.

The Solution?  Connect two 10 ohm resistors in parallel, which will give you approximately 5 ohms (close enough for this project). The power resistors I used are rated at 10W so they'll stay nice and cool in this circuit.

The voltage, current, and power readings will be displayed on a 2x16 character serial LCD panel. You can use any LCD panel, but the wiring and program may need to be modified to accommodate it.

Step 3: Preparing the Enclosure

























Adafruit's Arduino enclosure is perfect for projects like this. It comes with all the knockouts and screws you need to make a nice, neat, professional looking device.

First, you'll have to pull the knockouts apart and trim all of the access plastic using a razor knife or dremel tool. Then, drill holes in the top knockout panel for the two switches and the phone jack.

The bottom knockout panel includes openings for the Arduino power and USB ports. This is great for testing and updating your Arduino sketch.

Step 4: Wiring It Up

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 Show All 18 Items
1. I used an Arduino Proto Shield from AdaFruit to wire up the circuits and connect them to the Arduino, but any prototyping board will do. All you'll use are the board and bottom pins, so there's no need to attach the headers, LEDs, resistors, or switch that come with the shield.

2. The 10W power resistors are really big and take up most of the circuit board. Solder one end of each resistor to a GND pad and the other to a row of individual holes that can also accommodate the wires connected to SW2 and A2 pin of the Aruduino.

3. Next, solder in the 1K and 2K resistors (along with the SW1 lead and ground connection) for the voltage divider circuit.

4. The Serial LCD panel includes a 3-pin connector with 5V, GND, and Rx. Cut off one end of the 3 jumper wires and solder to 5V, GND, and digital pin D3 on the proto board.

5. Use ordinary hookup wire for the switches, battery holders, and phone jack. Make sure you wire the two battery holders in series (negative to positive) so you'll get the 6 Volts needed to power the Arduino. BTW, I used two 2xAAA holders specifially because that's what will fit into the enclosure.

6. Mount the switches and phone jack to the top knockout.

7. Mount the Arduino and LCD panel. They should fit neatly inside the enclosure. The screw holes line up perfectly!

NOTE: If you use the same serial LCD panel I did, you will find that the jumper connectors stick up a little too high for the enclosure. So you'll have to bend the pins to accommodate.

8. Once everything is wired up and screwed in, it's time to close the case. It will be really crowded in there, so be careful to bend your wires around components and screw holes and get everything lined up before putting in the final case screws.

9. Label the switches  "ON - OFF" and "V - A". (My label making skills are weak as you can see.)

10. And finally, solder the ends of red and black jumper wires to the phone plug making a nice little plug-in jumper cable.

Step 5: The Program

The sketch is very simple. I'm basically reading analog values on A1 and A2 and updating the LCD via D3.

/*
  Solar Cell Tester 15V-1A
  by Mike Soniat
  September 8, 2012

*/
const int RxPin = 3;

#include <SoftwareSerial.h>
SoftwareSerial lcdPanel = SoftwareSerial(255, RxPin);

int voltPin = 1;
int ampPin = 2;
int readVolts = 0;
int readAmps = 0;
int maxVolts = 15; //Must match voltage circuit resistors
float voltageFactor = 0;
float voltage = 0;
float current = 0;
float power = 0;
const int clearIt = 12;
const int cr = 13;
const int backLightOn = 17;
const int backLightOff = 18;

void setup() {
  
  pinMode(RxPin, OUTPUT);
  digitalWrite(RxPin, HIGH);
  lcdPanel.begin(9600);
  startUp();
}

void loop()
{
  //measure voltage
  readVolts = analogRead(voltPin);
  if (readVolts > 0)
  {
    while (readVolts > 0)
    {
      readVolts = analogRead(voltPin);
      if (readVolts > 0)
      {
        voltageFactor = 1024 / maxVolts;
        voltage = readVolts / voltageFactor;
        clearLCD();
        lcdPanel.print("Reading ");
        lcdPanel.print(voltage);
        lcdPanel.print("V");
        lcdPanel.write(cr);
        lcdPanel.print("Move Switch to A");
      }
      delay(1000);
    }
  }
  else
  {
    startUp();
  }

  //switch to current circuit
  readAmps = analogRead(ampPin);
  while (readAmps > 0)
  {
    if (voltage > 0)
    {
      readAmps = analogRead(ampPin);
      current = readAmps;
      power = voltage * current;
      clearLCD();
      lcdPanel.print(voltage);
      lcdPanel.print("V ");  
      //lcdPanel.print("I = ");
      lcdPanel.print(current);
      lcdPanel.print("mA");
      lcdPanel.write(cr);
      lcdPanel.print(power);
      lcdPanel.print("mW");   
      delay(1000);
    }
    else{
      readAmps = analogRead(ampPin);
    }
  }
  delay(1000);
}
void clearLCD()
{
  lcdPanel.write(clearIt);            // Clear
  delay(5);
}

void startUp()
{
  clearLCD();
  lcdPanel.write(backLightOn);
  lcdPanel.print("15V - 1A Solar");
  lcdPanel.write(cr);
  lcdPanel.print("Cell Tester");
  delay(3000);
  clearLCD();
  lcdPanel.print("Move Switch to V");
  lcdPanel.print("and Connect Cell");
  delay(2000);
}

Step 6: Trying It Out

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Show All 7 Items

Here's how it's supposed to work:


When you turn the power on, the LCD will toggle between: "15V - 1A Solar Cell Tester" and "Move Switch to V and Connect Cell". As soon as the tester senses voltage, the LCD changes to: "Reading " and the voltage in Volts, followed by, "Move Switch to A"'
When you move the slide switch to "A", the LCD will display voltage in Volts, current in mA, and power in mW.

NOTE: If the reading is less than 1mA, the tester will assume no cell is connected and display the initial "15V - 1A Solar Cell Tester" message.


Field Testing!


Before I took it outside, I had to add the finishing touch; an Instructables Robot Sticker!

Then, I grabbed a variety of solar cells from my workbench and went outside to test. You'll see the results in the photos!

Success!!!

For more detail: Arduino Solar Cell Tester