3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

LED Sunrise Alarm Clock with Customizable Song Alarm

Step 3Hooking up the ATMega168 and Building the Prototype

Hooking up the ATMega168 and Building the Prototype
«
  • PinOut.jpg
  • PinOutFInal.JPG
  • Block.bmp
  • Completed Wiring.jpg
Hooking up the ATMega168

There are only a few pins that need to be connected for the ATMega168 to run. I found this pinout of the ATMega168 at http://www.moderndevice.com/Docs/RBBB_Instructions_05.pdf connections are as follows:

To Vcc
-Pin 1 to Vcc with a 10k resistor.
-Pin 7 and Pin 20 to Vcc
To Ground
-Pin 8 and Pin 22 to Ground
-Pin 21 to Ground with a .1uF electrolytic capacitor
Input
-Pin 4 (Digital pin 2) is connected to my alarm wire
Output
-Pin 15 to NEGATIVE Lead of piezoelectric speaker
-Pin 16 to the input of the LED driver circuit
Clock
-16Mhz Crystal - One leg to Pin 9 the other leg to Pin 10

--11 Connections in all--

Note: I believe I could have hooked up some caps to the legs of the crystal but since my program does not need a highly accurate clock, I left it as is. I used the alarm's input digital pin at random, any other digital pin should work. The piezoelectric speaker and LEDs must be connected to a Digital PWM Pin or they will not work. Also, I couldn't find a good model in Eagle for the 28 pin model so I just MS painted it all together :D Sorry if it looks confusing. Ask questions if you need to! I made a block diagram as well to help with understanding where everything goes or comes from.

Building the Prototype

---Parts List---

Alarm Output Circuit
-LM317T Adjustable Positive Voltage Regulator (You could use a 5v regulator, i just had this one)
-1k Ohm Resistor
-3.8k Ohm Resistor
-470uF Electrolytic Capacitor

Power Supply
-UA7805C 5v Regulator
-100uF Electrolytic Capacitor
-10uF Electrolytic Capacitor

LED Driver Circuit
-2N3904
-150 Ohm (You can experiment with lower or higher resistor values depending on your LEDs)
-1k Ohm Resistor

Microcontroller
-28 Pin Socket (Optional but I reprogrammed my ATMega168 numerous times with my Arduino)
-ATMega168
-.1uF Electrolytic Capacitor
-16 MHz Crystal
-10k Ohm Resistor

Misc. Supplies
-Prototyping Perf Board
-Prototyping Board Legs and Screws
-Wire

When I prototyped my circuit I built each section on a breadboard, tested it, and transferred it to the perf board. I started with the alarm output circuit and made sure it worked correctly. I then moved on to the power supply portion, then the LED driver, and finished with the microcontroller circuit. But, seeing as you don't have to test the circuit and make sure the concepts work, since I've already done that, you can just build the whole circuit. Make sure you get the right voltages at the right places. 0v at the output of the alarm output circuit when the alarm is off and 5v when it's on. 5v at the output of the power supply circuit. Don't stick the ATMega168 in the socket just yet, it needs to be programmed.

I could have used a smaller perf board or cut mine down but I decided to leave it alone. It's not extremely large. After the circuit has been prototyped, the construction of the LED bulb can start.

« Previous StepDownload PDFView All StepsNext Step »
2 comments
Nov 19, 2009. 9:58 PMDJ898 says:
 Is there a way I could get the larger version of both wiring diagrams?

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
40
Followers
7
Author:Dandeman321