Organize and Share your Electronics the way you want. Sign-Up for a free account now. It takes only 30 seconds!

Let’s Build a Cool Linux Toy

Let’s Build a Cool Linux Toy

With a low-cost general purpose microcontroller like the PIC16F628, bits and pieces of cheap, commonly available electronics components, and LOTS of code, you can build many interesting `toys’ and hook them up to your Linux machine – a really great learning experience for the hardware hacker who wants to learn Linux, or the Linux hacker who wants to learn a bit of hardware. This article describes how I went about building my temperature-sensing project – amateur Linux/hardware hackers might find some of the ideas useful when they start building things on their own.
Get a PIC micro, and set it up to work with Linux.  Microchip PIC controllers are commonly available. If you are like me, working with a soldering iron for more than 10 minutes would drive you crazy – so you have to choose the right kind of PIC – the one that can be programmed with the simplest possible circuit (connected to the PC parallel port), preferably with a 5V supply. Look no further than the PIC16F628. This is a cool device that has lots of peripherals (except the ADC – but then, we can roll our own crude analog-to-digital converter with the comparator and pulse width modulation facilities offered by the PIC) and supports a `Low-Voltage Programming Mode’. I found a nice little circuit (the simplest circuit, and one that works perfectly, out of the dozens I have seen on the Net) designed by Jim Paris for a microcontroller programming laboratory at MIT. 

Jim Paris has designed a program (called `jimpic’) for burning machine code onto the flash memory of the microcontroller. It is available for download from here. I wrote a simple assembly language program, converted it into machine code with the help of the `gpasm’ assembler available as part of the GNU PIC Utilities Project and burned it onto the micro by running `jimpic’ with the `-b’ option.

A nice thing about the PIC is that, if you have some background in general microprocessor architecture and assembly language programming, you can become productive with it in just about one or two hours’ time. The instruction set is very compact (35 instructions) and sufficient for most simple bit-twiddling tasks. The PIC16F628 packs a decent 224 bytes of data memory with 2K of program (code) memory. The peripherals include general-purpose digital I/O ports, three timers, two analog comparators, on-chip voltage reference module, Universal Synchronous-Asynchronous Receiver Transmitter (for serial communication), and Capture-Compare-PWM module. Special CPU features include a watchdog timer, brown-out detect circuitry, and an internal RC oscillator (so that you won’t be needing an external crystal if you aren’t too concerned about precise timing).

The general purpose data RAM begins at address 0x20 (the locations below this are Special Function Registers – basically memory mapped I/O ports, control registers etc.). Here is an elementary assembly language program, which simply stores the value 0 into the accumulator (the `W’ register, in PIC terminology).

Visit Here for more.

 

More Articles to Read

Muxtronics open source 12V powerbank
Muxtronics open source 12V powerbank
TI’s Little Professor
TI’s Little Professor
App note: Testing inductors at application frequencies
App note: Testing inductors at application frequencies
1968 Princeton Reverb Repairs
1968 Princeton Reverb Repairs
Skill Sunday: Power Over Ethernet for Arduino
Skill Sunday: Power Over Ethernet for Arduino
More on Color TFT Displays ~ The Big Ones — 240 X 320
More on Color TFT Displays ~ The Big Ones — 240 X 320
Magnetic Rotary Encoder
Magnetic Rotary Encoder
Vertical Pole Climbing Robot
Vertical Pole Climbing Robot
ESP8266 Weather Station Projects
ESP8266 Weather Station Projects
Single tube Lethal Nixie clock
Single tube Lethal Nixie clock

Top




Shares