Tag Archives: Atmega168

Read multiple switches using ADC


by Les Hughson @ edn.com:

The ATMega168 is a great general purpose 8-bit AVR microcontroller from Atmel. It has 23 GPIO pins, but sometimes (as I have found) you can run out of I/O pins as your design grows. This happened to me recently when, of the 23 GPIO pins available, 2 were taken up by an external ceramic resonator, 1 for the reset line, 3 for serial coms, 14 for the LCD, and 3 for RGB LED control. This used all 23 GPIO pins, with none left for the four buttons I needed. What to do? This Design Idea has the solution.

A close look at the ATMega168 data sheet revealed that the I/O pins available on the 28-pin DIP package and on the 32-pin TQFP package are not all the same. On the TQFP package, there are an additional pair of VCC & GND pins and an additional two ADC input pins on top of the advertised 23 GPIOs. So if I could read my 4 buttons with these extra ADC inputs, all would be OK and the design would be saved.

Read multiple switches using ADC – [Link]

ATMEGA168 Weather Station


Pitt Meadows build a weather station based on ATMEL ATMega168 microcontroller. He writes:

The Small Weather Station is a battery-operated, wireless, weather station. I have been working on the project for almost a year now, and now I have an unshielded prototype that is partially functional. I say partially functional, because it does not have any wind/rain sensors installed, only the connections for them. So far it can log several things: temperature, humidity, atmospheric pressure, and battery voltage. However, the connectors for the rest of the sensors are functional; the only thing they require are several magnetic reed switches.

ATMEGA168 Weather Station – [Link]

IKEA Samtid mood-light upgrade


madworm writes:

Just wanting to share one of my latest projects, made possible by DirtyPCBs. I got a lot of good boards (actually 2 designs) and saved 25$ using this service. Very nice.
It’s a simple thing, just a micro (ATmega168) + a bunch of WS2812B LEDs. Main purpose: more colours :-)
It’s meant to fit nicely into IKEA Samtid lamps, runs with 5V DC and takes up to 2.75A. The control module is removable, so one doesn’t have to rip the lamp apart every time you change code. I used microMaTch connectors, as they’re somewhat low profile, at least compared to standard headers, and provide quite good mechanical support.


IKEA Samtid mood-light upgrade – [Link]

Thermostat V1.0 for energy saving fireplaces


Andrianakis Haris informed us about his latest project. It’s a digital Thermostat for energy saving fireplaces. He writes:

In the need of my new homemade energy saving fireplace (which boils water for the radiator) i designed and built a digital thermostat. The idea to design my own thermostat came when i came across with the following problem.

When i first fire the fireplace the water in the boiler around the fireplace is cool. After a few minutes the fireplace warms the water enough so that the water temp exceeds the thermostat limit. The thermostat changes state and drives an electric valve to move the water from the fireplace boiler to the radiators. The electric valve is slow enough and takes a few minutes to make a full turn. While the water is moving from the fireplace boiler to the radiators, circularly cool water is coming back in the fireplace boiler from the radiators. Τhe water temp in the fireplace boiler is getting cooler and after a few minutes falls under thermostat’s limit. The thermostat changes state and stops the valve from driving the water to radiators. This happens again and again until the whole amount of water in the radiators is get warm.

Thermostat V1.0 for energy saving fireplaces – [Link]

Arduino RFID Door Lock


pcmofo @ instructables.com writes:

I wanted to make an easy and secure way to enter my garage. RFID was the best way to unlock my door, even with my hands full I can unlock the door and push it open! I built a simple circuit with a basic ATMega 168 arduino chip and a ID-20 RFID reader to control an electronic door lock.

Arduino RFID Door Lock – [Link]

Scanalogic 2 Logic Analyzer and Signal Generator Review

Scanalogic-2 PRO is a 4 channel Logic Analyzer and Digital Signal Generator priced at 59€. At this cost it’s easy for a hobbyist to get one and make digital circuits debugging a breeze. It’s designed to capture, decode and analyze serial protocols like SPI, I2C, UART, 1-WIRE and CAN in a few clicks. Data is captured on PC using the free and efficient ScanaStudio software.


  • 20 Million Samples Per Second
  • 4 Input/Output channels
  • 256K Sample per channel
  • 2V, 2.8V, 3.3V, 3.6V and 5V logic levels support
  • Serial protocols decoders (SPI, I2C, 1-WIRE, UART, CAN, LIN,Manchester)
  • Various trigger options

> Download features PDF

What you can do with  Scanalogic 2

  • Capture and Analyze signals – Serial protocols sampling, decoding, debugging (UART, I2C, SPI, CAN, 1-WIRE, LIN, Manchester,…)
  • Save captured data and playback them later or on the other side of world!
  • Generate PWM, FM or UART signals
  • Capture images of your signals for demostration.
  • Digital PWM and FM signals analysis (FFT)
  • Compare captured signals.
  • Use “mixed”  mode to play a signal and record response on another channel (at the same time!)
  • Generate your own data (PWM, FM, Serial Data)
  • ScanaStudio PC software offers smooth scrolling and navigation options.

Continue reading Scanalogic 2 Logic Analyzer and Signal Generator Review

LED Display Over Bluetooth With Android

jbremnant writes:

I came across this neat bluetooth module called HC-06. It can be found as cheap as $6 on ebay, and gives you convenient UART access to bluetooth wireless capabilities.

My 3yr old has this home-made LED clock in his room. I thought it was time for an upgrade since the clock was very minimalistic. Its only function was to keep track of time and display it on the LED panel. And considering it was my first “completed

Magnetic Card Spoofer

Here’s an article that presents a rather innovative look at how to spoof magnetic card readers. The spoofer uses an atmega168 connected up to an electromagnet. The article has the source code, hardware schematic and action shots, don’t miss it! [via]

Magnetic Card Spoofer – [Link]

AVR Twinkle Twinkle Using PWM Project

ermicro.com writes:

Would be interesting if we could make our microcontroller to sing for us not just beeping or blinking; this project is all about using the powerful AVR ATmega168 16-bit PWM feature to produce accurate musical notes such as playing the child’s favorite Twinkle-Twinkle Little Star song or we could say beeping with style. The principal we learned here could be applied to other AVR microcontroller families that support 16-bit PWM.

AVR Twinkle Twinkle Using PWM Project – [Link]

Driving an Adafruit TFT Display with a Netduino

Fabien wrote a great tutorial on using the Adafruit TFT display with a Netduino. He writes: [via]

AdaFruit recently released a sweet little TFT display that I was dying to hook up to a netduino: the display features a resolution of 128*160 pixels, is capable of showing 18-bit colors and has a microSD card reader on the back of the breakout board. As usual, Limor wrote a nicely detailed Arduino tutorial showing how to connect the display and how to write sketches to drive it.

The Arduino driver relies on the ability of the Atmega168/368 to toggle digital lines extremely fast, which does not work well on the netduino due to the latency introduced by the .Net Micro Framework: even when configured to use hardware SPI, the Arduino driver constantly toggles a data/command output line, rspin below, which would be unbearably slow on the netduino if the same method were applied.

The netduino has one advantage over the Arduino: it has plenty of RAM. So, instead of toggling I/O lines slowly all the time and using next to zero RAM, the netduino driver allocates a 40K buffer corresponding to the resolution of the display in 12-bit depth colors (16 bits per pixel) and leaves the ST7735 in ‘data’ mode upon initialization.

Drawing always happens on the internal buffer first. Then, whenever the actual display needs refreshing, the display I/O operations are performed using hardware SPI, blasting the entire 40K buffer. It may sound crazy but using this method on the netduino is faster than refreshing a single pixel while toggling an I/O line!

Driving an Adafruit TFT Display with a Netduino – [Link]