Showing posts with label AVR. Show all posts
Showing posts with label AVR. Show all posts

3 January 2015

A PC Watchdog


Project Features

  • Automatically resets a crashed, frozen Linux PC
  • Simple
  • Uses a cheap USB-to-serial adapter

Introduction
For several years I have been using a MythTV Linux server to record television shows. It works very well and I like it a lot. It has one major problem though: Sometimes it locks up. I suspect that this happens when it changes channels and signals are weak (e.g. due to bad weather). It seems the drivers for my DVB-S receiver cards don't like that.

This is annoying, because it remains in that state until the PC is reset manually. No recordings are made in that state. It gets particularly annoying when I am on holiday, because then the recordings of a week or more can be lost. The box needs to be reset via the reset button. Not even ctrl-alt-del will work.

The aim of this project was to automate the process with an external watchdog. The idea was that the PC had to send a "heartbeat signal", i.e. a fixed character via a USB-to-serial adapter regularly. If it doesn't do so, the watchdog resets the PC after five minutes.

Since this is a Linux box, a simple cron job can be used to create such a heartbeat signal. If the signal is there, this means that the operating system is alive, the cron daemon is working and the USB driver is good.

22 December 2014

A MythTV Remote Control without LIRC



Features
  • Relatively easy to build
  • Emulates a keyboard, so it needs no driver
  • Costs around 10 €
  • Is easy to configure, in under one minute
  • Works with most remote controls
  • Can easily be customised for other HTPC software
Introduction

I was always very fascinated with Objective Development's software implementation of a USB driver for Atmel controllers called V-USB. On their web site, they have a nice list of really interesting projects using this driver.

There are a few projects that translate IR remote control signals into USB HID key strokes. This has one huge advantage: You don't need any driver or software on the PC. I had use for this, since I am using a PC with MythTV to watch TV. The standard means to control it is an IR remote with LIRC.

But with LIRC I had some mixed results . It is quite a universal and versatile tool. This means you need to do a lot of configuring. You have to edit several files and it is not straightforward. And the teaching phase has always been trial and error for me.

With a microcontroller decoding the IR protocol, one part of the bothersome configuration is eliminated. And the second part can be relatively easy, as only a simple IR to key stroke assignment is needed.

31 October 2014

The Eyes - A Last Minute Halloween Effect

Introduction
Halloween is a rather new tradition in our part of the world, but my family is very enthusiastic about it. Tombstones are built, bones are scattered in our front garden and a fog machine is kept in the basement for just this one day of the year. This time I thought that I could contribute a little LED effect. My idea was to use a couple of red LEDs to create a red-glowing eye effect, like some evil little monsters lurking in the dark.

6 February 2014

The Morse Thermometer - Part 3

Putting it all together
In part 1 and part 2 of this posts I investigated and designed the components for a solar-powered Morse thermometer. In part 3 everything gets connected.

In order to get the most out of the collected sunlight it is important to use as little power as possible. A red LED is a good choice here, because it only has a forward voltage of 1.7 Volts. So it will consume only about half the power of a white LED with a forward voltage of about 3.3 Volts.

Perhaps you remember that I had found out that even when the LED is not lit, the boost circuit from the solar lamp draws about 7mA. So it was important to switch it off during the time the thermometer is in stand-by.

Let's have a look at the original lamp circuit again.

24 May 2013

How to Do ISP Programming – Part 4: Fuses and Troubleshooting


Setting Fuses
 
As mentioned before, fuses are used to set a couple of things that might need to be set before the actual software starts to run. As a beginner you should not tinker with most of those settings, because it is possible to lock yourself out of in-system programming.

How to Do ISP Programming – Part 3: Software Usage


Installing the Software
As mentioned, there are many options when it comes to software. One standard program, which is available for many operating systems is avrdude. Unfortunately, it is a command line tool, which makes it less than ideal for beginners. But there are GUI frontends available. I decided to use AVRDUDESS for this tutorial. And it is quite easy to use.

23 May 2013

How to Do ISP Programming – Part 2: Hardware Considerations


What Hardware do I need?
Obviously you need the controller. This can be any Atmel ATtiny or ATMega. You need a circuit board to put the controller in (the "target board") and you need an ISP programmer. Since ISP uses a serial format, the programmer can be rather compact.

20 May 2013

How to Do ISP Programming – Part 1: The Theory


Introduction
Many of my projects use AVR controllers from Atmel. And they need to be "programmed". This means that the software needs to get written into their internal program memory.
 
For beginners, this can be a major stumbling block in any project. And I do get lots of questions in connection with programming. So I decided to write this tutorial. But my intention is not just to give a list of buttons you have to press. Instead I want you to understand what you are doing.
 
This tutorial assumes you have a Windows PC and use an USBasp programmer. They are available from your favourite auction website (very cheap, ready made, from China). Alternatively you can support their creator Thomas Fischl and buy his kit.

10 April 2013

Connecting an ISP Programmer to an ATMega8

Several people asked me how you connect an ISP programmer to an ATMega8. It never occured to me that this could be a problem for anyone. But anyway, here is a schematic.

Over time, I will write a tutorial on how to program AVR controllers.

Please note that the header shows Atmel's standard pinout for the 10-pin ISP header. Most programmers use that same pinout. But to be safe you should check your ISP programmer's manual.

I hope this is useful for someone!

15 July 2012

The Morse Thermometer - Part 2

Reverse Engineering a Solar Lamp
Part 1 of this post is a write-up of my project for a thermometer with Morse code output. But I was not satisfied with the relatively high power consumption of the circuit, so I decided to use a solar cell to supply the circuit.

A cheap source of solar cells these days are solar garden lamps. You get them for very little money in garden centres and DIY shops. So I went and bought one. The general idea was that such a lamp would not only give me the solar cell, but also a water-tight enclosure, a rechargeable battery and a boost circuit so that all aspects of the power supply would be covered.

And the supply should be more that sufficient for my purposes, since in my thermometer, the LED would only switch on a fraction of the time. By setting the display cycle time carefully, it should be possible to supply the thermometer for 24h per day.

23 May 2012

The Morse Thermometer - Part 1


Project Features
  • Extremely simple hardware
  • Low-Cost
  • Uses the internal temperature sensor of the ATtiny25 
Introduction
I used to have one of those electronic thermometers with an outdoor sensor. That sensor transmits its readings through an RF link. Except that it didn't really work. Every now and then I had to reset the thermometer so that it would re-connect to the sensor. This annoyed me and I thought maybe I could make something that actually works.

Well, that was my excuse for this project...

7 April 2012

A USB/ISP Programmer (Part 2)

Programming Software for the USBasp

There are several interesting options, how to use the USBasp programmer. The LCSoft variant was sold with the option to download a program called ProgISP V1.72 from the vendors site. Also, a schematic was available as well as the drivers for Windows. Installation was no problem. I found no user manual in English, but usage of the software is fairly straight forward.

6 April 2012

A USB/ISP Programmer (Part 1)


Introduction

When I started this blog I meant to do so mainly in order to document my own projects. I found that when I wanted to re-use parts of one of my projects I sometimes couldn't remember why I had made certain decisions. So I needed to document my work. And if anyone else could benefit from it, why not publish all in a blog?

But I never intended to bore anybody with my opinions on anything. This post is an exception, because I think I came across someone's project (or product) I really like. It is open source, so you don't have to buy anything. Also, I won't post any links to a store, etc.

How I flash my Firmware on 8-bit Atmel Controllers

I made my first steps in the old days, when PCs used to have a serial port. And my first programmer was a ponyprog serial programmer. It worked well, but some time later I decided to buy the STK500 from Atmel. This allowed me to use all existing programming modes and to directly flash from the AVR Studio. For a very long time, this was my main development tool. And it still sits on my desk. But it has disadvantages. It isn't really mobile. It needs a mains power supply. And nowadays you need a USB-to-serial converter to connect it.

I sometimes write programs on my netbook. So the way to go these days is to use a USB based programmer. There are lots on offer. But I found one that suits my needs really well. It is based on the USBasp project. This is an open source USB programmer, which is small and simple. It gets powered and controlled by the USB port. It uses standard components (e.g. an ATmega8), so you can build it yourself. A piece of perf board will do, really. Although various optimised layouts are available for download, if you want to make a PCB. Kits are available, too.

But what really surprised me was the fact that some Chinese companies manufacture USBasp compatible hardware. They are sold through the well known channels. And you can get them for almost no money. I bought two different devices for under 3 € each. And this includes shipping!


I don't know how they can sell them at such a low price. As an end user I would pay more than 4 € for the components, let alone shipping. This was an offer I could not resist, so I ordered two different versions, apparently from different manufacturers.

The Hardware

And this is what I got after waiting for a couple of weeks:

(top view)

11 June 2009

The Nano POV

The Micro POV was about making a really small POV display. I wanted it to be as small as I possibly could make it. And it is small. But when I wrote my post about it, a thought struck me: It can be even smaller. I had used a AVR tiny24 controller, which only has 14 pins. But I could also have used a tiny25, which only has 8 pins (including VCC, GND and reset) and still could control 8 LEDs. How is that possible? Simple: By combining the current saving technique from the Micro POV with the LED multiplexing technique of the matrix display I made. To operate the Micro POV I had used a scheme were always only one LED gets activated at a time. This makes the device perfectly suitable for using charlieplexing. And since I wanted to control 8 LEDs I needed only four I/O ports to do this. This was the birth of the Nano POV.

28 May 2009

The Micro POV

Electronics design in my opinion is the art of finding the best compromise. And this can be quite a complex art. There are many different and sometimes contradicting requirements to a project: Cost, time, space, weight, power, technology, market, availability of materials and tools, knowledge. This is why the all singing all dancing solution isn't always a good solution. Sometimes less is more. And I don't know why that is, but I have a special affection for minimalistic solutions.

I know, there are POV projects on the net in abundance. And most of them are some kind of propeller clock. There are a few really nice examples and I wanted to have one. I even started to build such a work of art and it was going to be really great with lots of colour and such. But very soon I gave up, because I just don't have the skills or equipment to build more complicated mechanical objects.

I realised that I had to reduce my expectations - a lot. And looking at various projects that I found on the net, I decided that maybe I should go for something really ... compact. And so the idea for a micro POV was born.

The name is of course a reference to the open source project MiniPOV by ladyada. But I wanted to go one step smaller - something to wear e.g. on the wrist. Of course that generates a few problems, which is just what made the whole thing the more interesting. Every component for this project needs special attention.

22 April 2009

Musings on Charlieplexing

Some time ago I stumbled over an article about charlieplexing on hackaday.com. Charlieplexing is basically a method to control n * (n-1) LEDs using only n I/O ports of a microcontroller. Say you have 5 I/O ports, then you can control 5 x 4 = 20 LEDs independently! Find more details in Wikipedia. I was fascinated, because I had never thought it was possible to control so many LEDs with so little hardware.

But it seems that charlieplexing comes with a few drawbacks. While this is certainly true, some of these drawbacks are in my opinion over-emphasised, especially when compared to "conventional" LED multiplexing. So I set out to explore the issue, just for the fun of it.