HomeArticlesProjectsBlogContact
Articles
Sky Writer
Colin Mitchell
Colin Mitchell
November 03, 2007
Make sure to subscribe to our newsletter and be the first to know the news.

Table Of Contents

01
THE INERTIA SWITCH
02
ON-OFF SWITCH
03
THE CIRCUIT
04
THE PROGRAM
05
CONSTRUCTION
06
GOING FURTHER
07
PARTS LIST

An educational project using a PIC chip
This is a future article for Elektor Magazine
To place an order, click: [Sky Writer kit](mailto:colin@elechelp.com?Subject=Buying Sky Writer kit&Body=Please e-mail the cost of sending Sky Writer Kit by air mail to my country:****___**** and send details of how I can pay for it. My name is:____)

updated 7-8-2006


We have seen many projects using a set of LEDs to produce words “in the air,” but none have the feature of an inertia switch to provide registration.
One of the biggest problems with waving a display to produce writing in the air is maintaining the same position for the letters as it is moved back and forth. If the words are jumping or shown in reverse, they are difficult to read.
Our project overcomes this by adding an inertia switch.

THE INERTIA SWITCH

This switch is made by winding 5 turns around the shaft of a small screwdriver to make a very springy contact. A small resistor is soldered to the end to act as a weight. The other contact is a length of tinned copper wire. These contacts are connecting to input pin 4 on the microcontroller.
You can check the operation of this switch by connecting a LED and resistor to the supply and waving the PC board. You will find the LED illuminates at almost the exact same place “in space” making it an ideal registration-mark for aligning the words.
Once you have a reliable starting-point for creating the display, you can make almost any effect using the 5 LEDs. There are almost no limits as the display can be 100 pixels long, and 5 pixels wide.
The project comes with a pre-programmed chip and contains a game similar the “decision making” game called 8-ball.
For those who need a little extra persuasion in daily decision-making, all you have to do is shake the project in a broad arc and it will tell you to: “Forget it,”
“Do it now,” or a number of other things.
The chip is completely re-programmable and the second part of this project (on the internet) goes into writing the program to create other things for the display.
This is a very big section and is covered on talkingelectronics.com website.
That’s the advantage of the internet. It can complement the magazine market by elaborating on a small article with lots more pages, without the need for cutting down trees.
The programming section covers writing a program for the simplest chip in the PIC series - the PIC12F629 and takes the place of the PIC12C508 and ‘509.
The 12F629 is an 8 pin device with 5 input/output lines and one input only pin. The other two pins connect to the supply.
It is re-programmable up to 1,000 times and has 12222 EEPROM locations to store data. This data can be changed up to one million times. The data is not lost when the power is removed.
The program area has 1024 spaces and each space will store a single instruction (or data in the form of a table).
The program we have written occupies about 250 spaces and the remainder of the memory is taken up with data for the alphabet.

Within the chip is a “micro-computer” that acts on each instruction at the rate of one million instructions per second, when the internal 4MHz oscillator (called a clock) is used.
An instruction can be a simple task such as placing a number (called a literal) in the “working register” called register “W” or it can be a more-complex task such as testing a bit in a file and jumping over the next instruction if the bit is set.
The program for this project has been written by hand using the set of 35 instructions for the chip.
These instructions consists of letters and numbers, with each letter taken from the first letter of a word such as Shift Left File (SLF) or Bit Test File XX Skip if Set (BTFSS), etc.
Each instruction is called a mnemonic. These are “half-computer,” “half-English” instructions that both the human and micro understands.
These instructions are assembled by an assembler called MPASM. The result is a list of hex numbers that are “burnt” into the chip using a “burner.” All these programs and the burner are covered on the authors website: talkingelectronics.com
A program for a PIC chip may look unusual at first, but the website explains the terminology and takes you through each stage in the development of an idea.

When learning to program a PIC chip, it is most important to go to a website that covers the exact type you are programming as each variety has different features. For instance, the code from a PIC12C508A cannot be burnt into a PIC12F69 as the first file in a ‘508A is xxx whereas it is 20h in a ‘628.
There are other differences and that’s why any programming course must deal with the exact same device.

Inside the 8 pin 12F629, there are thousands of transistors, diodes and resistors.
To make things simple, we can consider it to have 5 main things:
Firstly a column of 1024 locations where the program is stored. This program is written by you and is called the Program Area.
Another area has a column of 64 files capable of being loaded with a 8 bits of information. These files are used by you to store information during the running of the program and are called the User Files.
The third area consists of files that have a special function such as holding bits of information such as overflow from an addition and are called Special Function Registers. (FSR’s)
There is one file in this list with a surprising feature. It is the input output port. It is file 00005. It has a number of driver transistors that connect to pins 2 to 7. These pins can be configured as input or output lines with the capability of delivering 25mA to the outside world, with Pin 4 an input only line.
Then there is a microscopic computer that reads each instruction in the program and carries out the task. Finally there is a working register, called “W,” that gets loaded with a value (called a literal). It is the transport medium to transfer values from one place to another.
There a lots more things inside the chip such as the program that allows the chip to be “burnt” (flashed), the program that reads the instructions in the Program Area and more, but let’s keep things simple.
The program you produce by hand is called assembly language and is written in mnemonics. This produces a .asm file. This is assembled by an assembler (MPASM - by Microchip) and produces a .hex file. This file is used by a program called a “Programmer.” The Programmer has a piece of equipment connected to one of the ports of the computer called a “Burner.” The burner has a socket and the chip is fitted to the socket and “Burnt” or more-accurately “flashed - in the case of the 12F629. The 1024 spaces we mentioned above are filled with your program and when the chip is placed in a project and turned on, the program is read at the rate of one million instructions per second by the internal “microscopic computer.”
The memory size may seem small by modern standards but you will find it is capable of taking the place of quite a number of “old-style” gating chips and once you see what can be done, you will be designing almost entirely around a microcontroller.
One of the advantages of using a PIC microcontroller is the ability to protect the program by “Code Protecting” the chip. By doing this, no-one can read or copy the chip.
This gives you some hold over the contents and a project can be marketable.
If you like this concept, you are ready to start programming.
Writing a program is like writing a novel. You can do anything within the capability of the chip, and to get some ideas, you can visit the authors website for a list of projects created with a PIC12F628.

The next stage is to go to the website, look at the program for the Sky Writer and study the sub-routines. Each sub-routine does a small task and by calling them in quick succession the result can be very impressive.
The programming course starts at the beginning with a number of programs that perform a simple task such as blinking a LED, detecting a switch, producing a tone and more.
By simply copying and pasting them into your program, you can build up your own project.
It shows how to lay out a program, beginning with SetUp, then tables, sub-routines in alphabetical order and finally Main.
Keeping to this layout allows easy location of each sub-routine as a 1024 line program is quite long.

ON-OFF SWITCH

The project does not have an on-off switch.
We are using one of the features of the microcontroller to eliminate the switch.
The program is designed to turn off the micro after 10 seconds of non-use.
The micro is xxxx tuned into an condition called “sleep” where it is shut down to a point where it consumes only about 3 microamps. During this time it can be woken by changes on its input lines and we take advantage of this by connecting the inertia switch to an input.

This project offers three areas for experimentation. It shows how interface external devices to a microcontroller. It employs surface-mount technology and covers writing a program for the simplest chip in the PIC series, the PIC12F629.

If you have ever wanted to start writing your own programs for a microcontroller, this is the place to start. The PIC has been chosen as it has enormous back-up on the internet.

THE CIRCUIT

The circuit is very simple but there are 5 things we need to cover. The 10k resistor is needed to fully

THE PROGRAM

Each letter or number to be displayed is made up of a matrix of dots. All characters are five dots high and can be one dot wide or up to 7 or more. Each column requires one byte (one location in memory) so some letters require 7 bytes.
The program has two tables, called Character and Sentence.
The complete alphabet and all the numbers are stored in a table called Character, with a separating value of 08 between each character. This has been chosen as it does not correspond a display value, as GP3 is not an output.

The Main routine goes to a table, called Sentence, containing the starting point for each letter in the Character table.
Each byte in Character table produces one column of dots.
Each column is displayed for a short period, then the next byte is fetched and displayed. In this way a word or sentence is shown on the display.
The chip comes pre-programmed with a number of sentences that are randomly displayed. Since it is very difficult to produce a random number with a micro, we increment a number in the EEPROM and this looks at a third table for the starting address for the characters that will be displayed.
We cannot cover any of the details of the program in this article due to the limitation of space.
Our intention is to get you excited about the concept of programming.
Once you can see it is a like a writer producing a novel, you can go to the authors website and the course associated with this chip.

It shows how to add more futures or produce more words or entirely different effects, such icons or pictures. It also starts you at the beginning by blinking a single LED and showing the effect.
So, even if you have never programmed before, you will be able to produce amazing things with this simple project. Without a microcontroller, this project would require more than 30 “old-style” chips!

CONSTRUCTION

A full kit of components is available from the author. It contains the pre-programmed chip and surface mount components as well as through-hole components.
At the moment, surface mount components are not available individually from electronics supplies and a kit is the best way to get into this area of construction.
The first components to fit are the surface-mount resistors. The kit comes with a length of very fine solder and this will make soldering very easy provided you have a fine tipped soldering iron.
Tin one of the square lands with a very small amount of solder and place a resistor in position. Hold it in place with a small Jeweler’s screwdriver, by pushing down firmly. Heat up the end that has been pre-tinned and the resistor will sit on the board.
Now solder the other end very quickly. Let the resistor cool and go back to the first end.
Repeat this will all the other resistors and the 100n capacitor.
Push the LEDs through the holes until they touch the PC board. Make sure the shorter lead goes to the negative rail.
Solder the leads very quickly as LEDs are temperature-sensitive.
Fit the IC socket and electrolytic.
The three button cells are fitted to the board by fabricating battery holders from very fine tinned copper wire contained in the kit.
Firstly solder the two negative contacts by looping the wire through the board and soldering one end. Now pull the wire with pliers and solder the other end. Loop the positive wire through the board and solder one end. Fit the cell under the wire, so it touches the negative wires on the board, pull the loop tight with pliers and solder the other end. Solder the other positive wire and the cell will be kept in position. Repeat the process for the other two cells.

Finally, make the inertia switch by winding 5 turns around a small screwdriver and flattening them to make a very springy contact. Solder it to the PC board. The other contact is a short length of thick tinned copper wire.
Move the contacts together so they are separated by a very small gap.
Fit the microcontroller to the socket and the project is complete.
Move the project quickly in a broad arc and a message will appear “in the air.”

GOING FURTHER

This project could be incorporated into a birthday card or “Get Well” card and include a simple game or message that displays randomly each time the card is “waved.”
The inertia switch can be made as a sealed unit with a spring and ball.
The project can then be converted to fully surface mount and finally the micro can be a COB (Chip On Board) - as seen as a tiny mound of resin on some projects.
This is just one idea for a range of cards that are “different from the rest.”
The author has designed a combination-lock game, a counter and a ladder game that will make buying a birthday card a worthwhile choice.
The PIC micro gets an idea “off the ground” and can get your ideas into production.
It’s the starting point we have always wanted and this may be the starting point for you.

PARTS LIST

au $59.50 plus $4.50 post
us $47.50 plus US$6.50 post
[Order kit](mailto:colin@elechelp.com?subject=Buying an PIR Camera kit&Body=Please e-mail the cost of sending kit by air mail to my country: **___**** and send details of how I can pay for it. My name is: ”)**

  • 5 - 120R surface-mount resistors “121”
  • 1 - 10k surface-mount resistor “103”
  • 1 - 100n surface mount capacitor
  • 5 - 3mm red LEDs
  • 1 - 47u electrolytic
  • 1 - 8 pin IC socket
  • 1 - pre-programmed PIC12F629 IC “SKY”
  • 1 - 5cm thick tinned copper wire
  • 1 - 40cm thin tinned copper wire
  • 3 - button cells from 12v lighter battery
  • 1 - 1m very fine solder
  • 1 - Sky Writer PCB

Tags

#elektor
Colin Mitchell

Colin Mitchell

Expertise

electronics
writing
PIC-Chips

Social Media

instagramtwitterwebsite

Related Posts

TODO
PIC Elmer 160
March 06, 2012
© 2021, All Rights Reserved.

Quick Links

Advertise with usAbout UsContact Us

Social Media