Showing posts with label embedded. Show all posts
Showing posts with label embedded. Show all posts

Wednesday, March 26, 2008

Harvesting parts from an inkjet printer

external.jpgEver since I attended a workshop on stepper motors at Dural conducted by Peter VK2EMU I've been watching for the site of an inkjet printer by the side of the road and this morning there was a rather wet Canon calling me...

After about half an hour of messing about the device was a wreck but these printers sure are a treasure trove of useful parts for the home robot maker: cogs, rollers, pulleys, switches, sensors and motors. Regrettably, this model doesn't use stepper motors but rather they seem to be DC motors with a rotary encoder linked to each one.wreck.jpg

The encoder disk is amazingly fine and it passes through an optical reader which I guess is rather like the encoder in a mouse. The markings are 7120 G516 but so far I haven't found a data sheet for them. The board has 4 wires coming from it so there's not too many options.encoder.jpg

Anyhow, despite my disappointment about the lack of steppers, I did score four very nice DC motors that seem to run well on about 3 volts and will be suitable for computer control or making little robots like this.parts.jpg

It's truly amazing the amount of perfectly good electronics that are available for free at council junk collection times.

Saturday, March 08, 2008

Atmel Atmega8 ICSP on breadboard

icsp.jpgOver the past year, I've given up on the PIC micros and have been getting up to speed with the AVR ATMega processors. My favourite is the ATMega8 and 168 which come in a 28 pin DIL package and have loads of I/O.

I've purchased a few boards, made a reasonable one, but for prototyping I keep coming back to the breadboards.

First off I made a simple PC parallel port programmer which worked but was rather inconvenient for me and would stop the project running after programming. In the end I purchased the AVRISPMKII which is really excellent and works perfectly with my Mac. This device has some smarts which set it apart from the simpler devices out there. The multi-coloured LED tells you if it's seeing the voltage it expects to see for example.

The prototyping board is a really excellent on I bought from Parallax some time back called the "Professional Development Board #28138" it has on board switches, LEDs, audio amp and speaker, potentiometers, seven segment displays, serial port, real time clock etc etc. Of course it can be used with any CPU.

Anyhow, the news here is that I've made up a little adapter board that converts the 6 pin In Circuit Serial Programming into both the 10 pin version, my own in-line version and now a plug with fly leads as shown above that I can plug directly in to a proto board.

The objective of all this madness is to build some ham applications of which there are many.

I'm using:


So far I've got useful things going such as reading a value from an analog to digital input and writing it out via serial to an LCD display.

I notice that the ATMega8s come set to run at 1MHz with the internal RC oscillator, this works just fine but I turn them up to 8MHz internal and find this accurate enough to do serial at 9600 baud.

Wednesday, January 02, 2008

Getting started with Atmel ATMEGA8-16

I mentioned in a previous post that I've been interested in learning about the Atmel AVR microcontrollers.

To get started I purchased an already constructed Arduino board and had a good experience using it's USB/Serial programming from my Mac.

I don't feel satisfied until a controller board has been built from components, here's what I did.
  • Purchased an ATMEGA8-16 from the local Jaycar for AU$19.95
  • Built a minimal circuit based on the Arduino but without the USB stuff.
    • I kept the power LED and bypass capacitors but that's all
  • Built a simple PC Parallel port programmer based on this circuit (yes, just two resistors!)
  • On a Fedora 8 machine, did "yum install avr-gcc avr-libc avrdude"
  • Add your user to /etc/groups under the lp group so you can access the parallel port
  • I followed the excellent instructions by The Real Elliot here to get a sample program going and make a Makefile.
One thing that caught me for a while is that while plugged in to the programmer, the chip doesn't run. I'm sure I can fix that by adjusting the reset line or something.

I've also changed the fuses on a chip so that I now get "avrdude: AVR device not responding", still trying to figure out how to get out of that issue.. All good fun.

Thursday, December 20, 2007

Arduino controller board on a Mac

Having played with PIC microprocessors for many years and had good times with the 16f628, it's been hard for me to jettison that knowledge and move to another chip even though it looks much better.

The Atmel AVR chips are low cost but designed for running code generated by "normal" compilers like good old gcc, rather than the PIC chips that need hacked c or basic compilers that know how to use that banked memory.

I use a Mac and always feel like a second class citizen when it comes to software and hardware for embedded systems. Make magazine featured a little board called Arduino that carries an ATMega168 chip.

It's the fastest "greet postie" to "das blinken lights" joy I've ever experienced.

Here's my list of observations so far:
  • The Arduino is open source so you can make your own
  • I bought the Diecimila for AU$37.50 with it's USB connection
  • Chip programmed with a boot loader so it is re-programmed via serial (over USB)
    • The boot loader is freely available so you can burn it into your own chips
  • There is an IDE for Windows, Linux and the Mac that works really well
  • The IDE for Mac comes with the driver you need for the USB interface
  • IDE has gcc-avr built in
    • It links against AVR Libc
    • Language is most of c
    • Syntax colouring
    • Seems actually to use a c++ compiler
    • Has some useful built in functions for doing i/o
    • Comes with libraries for things like printing to serial (and you can do serial comms to the board in the IDE so that's how you debug)
    • There are third party libraries available for stuff like digital servo control
    • Libraries are installed by simply dragging them in to a folder
  • The board can be powered by USB or a separate supply 6-12V
  • When you compile your source the output, including the intel hex file is dropped into a folder with the source so you can even burn it to another chip with your own programmer
What held me back from trying the Atmel AVR chips is the fact that there's so many of them! Where to start? Well, it seems like the ATMega8 is a good start. All the tools are free and if you have a PC with a parallel port you can make a really simple programmer.

Incidentally, I ordered my Arduino from Little Bird Electronics here in NSW on 9-December and it only turned up today 20-December. I think that's a little slow.