How to program a AVR (arduino) with another arduino using atmega168 microcontroller

This instructables is usefull if:
* you’ve got your arduino with atmega168 and you bought an atmega328 at you local electronics store. It doesn’t have an arduino bootloader
* you want to make a project that doesn’t use arduino – just a regular AVR chip (like the USBTinyISP) – you have a clean attiny2313/attiny48 etc that you want to burn firmware on.
Normally  you would have to have an ISP (In System Programmer) like USBTinyISP to program your new chip.  Having the arduino you can teach it to be a programmer thank to a great work done by Randall Bohn. He created Mega-ISP – an arduino sketch that works like a programmer.

Step: 1 What do you need ?

 

* a working Arduino (or a clone – i’m using the BBB – BareBonesBoard and a RBBB – RealBareBonesBoard by ModernDevices)
* a chip that you want to program (tested with atmega8,atmega168,atmega368, attiny2313, attiny13)
* a breadboard or a board with ISP header
* 3 leds + 3 resistors
* breadboard wires

Step: 2 Making the mega-isp programmer on a breadboard

 

There are two ways to connect your Arduino to program a chip.
You can plug your avr chip to a breadboard and connect 5v and GND to the respective pins (check the datasheet!) + a pullup resistor to reset and wire pins from you arduino to the chip.
These are the lines on Arduino and their function
13 – SCK
12 – MISO
11 – MOSI
10 – RST (Reset)
Or you can make a 2x3pin ISP header that you can plug into a board that provides one (another arduino board).
The pinout for the ISP header is on the third image
There are 3 leds to indicate the status of the programmer.
pin 9 – blue led – its the hearbeat of the programmer.
pin 8 – red led – indicates an error
pin 7 – green led – indicates that the programming is taking place
(i was lazy so i didn’t match the colors in my setup)
Here are the drawings made in Fritzing
You can alsa make a MEGA-isp shield. Yaroslav Osadchyy designed the shield in eagle. You can get the eagle files on his site:  http://drug123.org.ua/mega-isp-shield/

Step: 3 Uploading the sketch

Download the sketch from mega-isp google code.(avrisp.03.zip at the time of writing).
Unpack it and run arduino ide and open avrisp.pde.
Upload it to your arduino board.
Heartbeat led should start beating.
For more detail, Click here...

 

 

Singing Pumpkins/ Arduino using microcontroller

Lets start off by saying that I am a noob to micro controllers like Arduino. After looking through instructables for a while I saw the things that arduino could do. That is when I realized that I had to get one and learn the whole process of programming. So having said that I will now move onto my first instructable build.
UPDATE!!   IF YOU HAVE UPGRADED TO ARDUINO 1.0 THE WAVE LIBRARY WILL NOT WORK!!! I AM CURRENTLY LOOKING FOR A FIX TO THIS. IN THE MEAN TIME PLEASE USE THE OLDER VERSION OF ARDUINO SOFTWARE OR IF YOU CAN HELP WITH THE FIX PLEASE POST!!
I decided to create a singing pumpkin display for Halloween. I got the idea from http://www.instructables.com/id/Singing-PumpkinsParallel-Port-Relay-Box/ I did’t have a parallel port but I had an arduino, sound shield and lots of patience. I used the song “This is Halloween” from Nightmare Before Christmas, wrote the code and built a relay board. I will go over how I did this later. Even though it took a lot of work the final result is well worth it! Video is posted in last step.

THIS PROJECT DEALS WITH HIGH VOLTAGE. IF YOU ARE NOT CAREFUL YOU COULD GET SERIOUSLY INJURED.
IF YOU ARE NOT COMFORTABLE WITH THAT PORTION OF THE PROJECT, PLEASE GET SOMEONE TO HELP.

Step: 1 Things you will need

 

Things you will need:
Tools:
Drill
Dremel
Solder Iron
Solder
Screwdriver
Utility Knife
Supplies:
Arduino ( I used the uno with smd chip)
Wave shield
8 pumpkins with light socket and cord( the more styles the better )
flicker bulb set ( available at HD Christmas isle)
5 outlets
relays
wire ( low voltage, electrical cord )
Preff board
9 diodes- Vr/50v Io/1A T/R. Mfg P/N: 1N4001
9 10k OHM 5% 1/4W carbon film resistors
9 330 OHM 1/6W carbon film resistors
9 transistors- 600mA 75V NPN ON Semi Bipolar Small Signal Mfg P/N; P2N2222AG
9 leds 3v
Plastic box ( for relay board and outlets )
Small plastic box ( protection for arduino and sound shield )
Masking Tape
Electrical tape
9v wall wart (adapter)
For the relay board set up I needed 9 relays that control 110v. That ‘s 8 for the pumpkins and 1 for the flicker bulbs that will run In standby mode. The relays I used are 5v input and 110v 12a output. The relays are wired to be controlled by the arduino but they are powered by a wall wart ( transistors are perfect for using a low voltage to control a higher voltage ). The circuit is simple( as you will see in upcoming steps). The arduino sends a signal to the 10k resistor which is connected to the center pin of the transistor. This will use the transistor as a switch to connect the negative from the wall wart to the relay pin by switching the ground.

Step: 2 Relay board 1

For this step I laid out my relays so I could get an Idea of how I wanted it to be. The relay I used had the load pin in the middle and it did not fit into the preff board so some drilling was needed ( see pic ). Now it’s time to place relays and solder them. Once the relays are all soldered we can now move on to placing the other parts. I started with the diode. Even though relays have no polarity the diode will change that ( diodes let the juice flow one direction ) and that will keep the voltage from bouncing back where it shouldn’t be.

Step: 3 Relay board 2

 

At this point I added the transistor and first resistor (10k). Since the transistor switched a ground or negative I placed it so the output pin is connected to the diode negative or ground side. ( side without stripe ). The resistor is connected to the signal pin of the transistor this pin is used to control the internal switch.
In the next picture I added the second resistor (330k). This is used to limit or resist the voltage to the led. In the picture it looks like it connects to the transistor but it is not. The side of the resistor that is facing away from the transistor will be soldered together.
By now the solder connections are as follows. Solder relay to the board. solder diode so that each pin is soldered to the relay signal pins. Place transistor and solder one pin to the negative side of the diode and relay. Solder the 10k resistor to the middle pin of the transistor. Solder the 330ohm resistor so that both resistors are connected opposite of that transistor.

Step: 4 Relay board 3

In this step add the led. Leds have a flat edge on one side this is the negative( – ) or cathode. This will be soldered to the last pin of the transistor. The other pin of the led the anode will be soldered to the 330k resistor. You may notice in the second picture the layout is slightly different then the first and that is because things got a bit tight for soldering. However the circuit remains the same. (See pic).
The next pic show the jumper wires used to connect the positive( + ). This will feed power to all relays with a wall wart. The jumper wires are soldered to the stripe end of each diode. It’s now a good time to add the signal wires. The wall wart negative (-) ground connects to the ground buss bar and arduino ground.
Now to the bottom of the relay board for some major work ( see pic ). I know the solder isn’t pretty but, hey,  it’s my first major solder project. Solder a buss bar to all load pins on the relays. Solder either a buss bar or jumper wires to all negative ( – ) connections. The negative connections need to connect to the ground on the arduino and to the negative on the wall wart. The only thing left to solder is the line wire from a male plug and the output load wires to each relay that will connect to your outlets.
For more detail, Click here...

Bluetooth Based Smart Home using atmega8 microcontroller

This project is used to automate the home appliances through Bluetooth enabled PC. You can use the USB Bluetooth at the PC side and an Serail Bluetooth converter is used at the microcontroller side. The sparkfun bluetooth module is used here, but you can use any serial bluetooth module which supports SPP profile. Atmega8 microcontroller is used in this project
The PC application software was written using visual basic and the microcontroller coding was done through Bascom Basic. The project had the following features
  • 2 Temperature sensor (1 Indoor & 1 Outdoor)
  • High resolution temperature sensors are used (0.06deg)
  • 1 Light sensor with help of LDR
  • 1 PIR motion sensor
  • 5 Devices can be controlled
  • LCD & LED interface to display the status

Post your doubts on the Forum

Circuit Diagram

 

PC Screenshot


For more detail, Click here...

 

Simple calculator using Atmega16 microcontroller

Here’s a simple calculator with the Atmega16 microcontroller. It have an LCD display and a 4×4 keypad.
You can also download the proteus simulation file on the downloads


Bascom Code


$regfile = “m16def.dat”
$crystal = 1000000
Config Kbd = Portd , Debounce = 30
Config Lcd = 16 * 2
Config Lcdpin = Pin , Db4 = Portb.4 , Db5 = Portb.5 , Db6 = Portb.6 , Db7 = Portb.7 , Rs = Portb.3 , E = Portb.2
Dim A As Byte
Dim B As Byte
Dim Key As Byte
Dim C As Byte
Dim D As Byte
Dim E As Byte
Dim F As Byte

Cls
Cursor Off
Locate 2 , 1
Lcd “avrprojects.info”
E = 0
B = 0
Q:
Waitms 200
‘B = 0
A = Getkbd()
If A > 15 Then
Goto Q
Else
Key = Lookup(a , Dta)
If Key <= 9 Then
D = 0
B = 10 * B
B = B + Key
If E = 0 Then C = B
If E = 1 Then D = B
Cls : Lcd B
Elseif Key = 10 Then
Cls
F = 1
E = 1
B = 0
Elseif Key = 11 Then
Cls
E = 1
F = 2
B = 0
Elseif Key = 12 Then
Cls
E = 1
F = 3
B = 0
Elseif Key = 15 Then
Cls
E = 1
F = 4
B = 0
Elseif Key = 13 Then
Cls
E = 0
B = 0
Elseif Key = 14 Then
If E = 1 Then
Cls
Select Case F
Case 1 :
B = C / D
Case 2:
B = C * D
Case 3:
B = C – D
Case 4:
B = C + D
End Select
Lcd B
End If
End If
End If
Locate 2 , 1
Lcd “avrprojects.info”
Goto Q
End
Dta:
Data 7 , 8 , 9 , 10 , 4 , 5 , 6 , 11 , 1 , 2 , 3 , 12 , 13 , 0 , 14 , 15
For more detail, Click here...

Measure negative temperature with Lm35

LM35 can measure temperatures from -55deg to 150deg and we need negative supply voltage for measuring this negative temperature.
This circuit eliminates the negative voltage power supply and this project can measure the negative temperature
Download the protesu file to simulate the project on your desktop



Bascom Code

$regfile = "m16def.dat"
$crystal = 1000000

Config Lcd = 16 * 2
Config Lcdpin = Pin , Db4 = Portd.4 , Db5 = Portd.5 , Db6 = Portd.6 ,
Db7 = Portd.7 , E = Portd.0 , Rs = Portd.1
Config Adc = Single , Prescaler = Auto , Reference = Internal

Deflcdchar 0 , 12 , 18 , 18 , 12 , 32 , 32 , 32 , 32
Deflcdchar 1 , 32 , 4 , 12 , 28 , 28 , 32 , 32 , 32
Deflcdchar 2 , 32 , 4 , 14 , 31 , 31 , 32 , 32 , 32
Deflcdchar 3 , 32 , 4 , 14 , 31 , 31 , 7 , 6 , 4
Deflcdchar 4 , 32 , 4 , 14 , 31 , 31 , 31 , 14 , 4
Deflcdchar 5 , 32 , 32 , 32 , 32 , 32 , 32 , 32 , 32

Dim A As Word
Dim B As Word
Dim C As Single
Dim D As Byte

D = 1
Start Adc

Cursor Off
Cls
Locate 2 , 1
Lcd "avrprojects.info"

Do

A = Getadc(3)
B = Getadc(4)
C = A - B
C = C / 4
Locate 1 , 1
Lcd "Temp =" ; C ; Chr(0) ; "c   "
Locate 1 , 16
Lcd Chr(d)
Waitms 500
Incr D
If D > 6 Then D = 1

Loop

End
For more detail, Click here...