Tuesday, May 29, 2012

0 PICAXE Project 1 - Whazzup People!


This project uses the PICAXE - 08M2 processor which is the cheapest, smallest, and most easy to use standalone microprocessor. You should have interfaced the processor to you mac or PC if you have followed my post (wait for the link) correctly. Whazzup People! is a BASIC (yes its very basic!) program for the circuit to show its first movements that is blinking its eye, or the LED.
To start with the project, you should have :

  • PICAXE AXE027 Programming cable
  • Breadboard 400 points
  • Jumper Wires 
  • 3 AA battery holder with switch and batteries
  • Capacitor 0.1uF
  • LED, resistorized
  • Resistor 10k, 22k both 1/4 watt
  • Mini stereo jack - 3.5 mm low profile
  • PICAXE - 08M2
  • Header, male, 10 pin, reverse mountable
  • Stripboard, small

Step 1 - Constructing the mini stereo jack adapter

This component will be used to connect the processor to your PC or Mac. The male header pins should be 0.32 inches in length to compensate for the thickness of stripboard. Here are the steps to make the adapter :

  • Snap the male header into two pieces of 5 pins each.
  • Cut out five pieces of strip boards having 5 holes each.
  • Keep the shorter ends of the pins inside the breadboard and slide the stripboard pieces onto the longer pins, as given in the picture.
  • Solder only one of the 5 pin header completely with the stripboard
  • Insert the stereo jack into the top of the stripboard so that its round opening is facing away from the five-pin header and its middle pin is in the end hole of the middle trace of the stripboard.
  • Flip the board and stereo jack upside-down again, place it on a flat surface, and solder the three pins of the stereo jack to the board.






Step 2 - Assembling the breadboard circuit

You can assemble the circuit by looking at the following the picture and the schematic.





Step 3 - Programming the processor

So now you are all set to upload the code to the 'brain' of the circuit. Run the progedit or AXEpad , whichever you prefer. 
This is the code that will make the eye blink.

' This program runs on a PICAXE-08M2.
' It blinks an LED to say "Hello World!"
' === Constants ===
symbol abit = 1000                                   ' used to adjust blink rate (1000ms or 1s in ths case)
symbol LED = C.0                                    ' LED on output C.0 (pin 7)
‘ === Directives ===
#com 3                                                      ' specify serial port
#picaxe 08M2                                           ' specify processor
' ====================== Begin Main Program =====================
do
high LED                                                                  ' LED on
pause abit                                                                 ' pause it for time specified
low LED                                                                   ' LED off
pause abit                                                                 ' pause it for time specified
loop                                                                           ' loop forever

By convention, the lines after an apostrophe are not read by the software

We have one more thing to do before we can run our “Hello World!” program—we need to be sure our AXE027 USB cable is properly configured for use with the ProgEdit or AXEpad software. To do so, open the Options window, either by selecting the View | Options menu or clicking the Options button in the toolbar near the top of your editor’s window. (If you’re not sure which button that is, just point to each one and a tool tip will appear.) When you have opened the Options window, click the Serial Port tab to access the relevant settings. If you have more than one serial port on your computer and/or multiple USB devices connected to it, you will probably see more than one available serial port. In order to determine which serial port is connected to your AXE027 cable, simply click the button labeled “Scan for USB Cable,” and a pop-up window will identify the correct serial port for your cable. If you are using AXEpad on a Mac, the corresponding button is labeled “USB Setup” and the port identification is as follows: #com /dev/tty.usbserial-xxxx, where “xxxx” is the fourdigit serial number of your AXE027 cable. In Linux, it’s: #com /dev/tty/USB0. When you have configured your AXE027 cable, you should be ready to run the “Hello World!” program. Close the Options window, turn on the power to your breadboard circuit, and select the PICAXE | Program menu item (or click the Program tool). The program should download— you will see the LED flickering as it’s doing so. Once the download has completed, you should see the LED on the breadboard blink on and off about once per second.

0 comments:

Post a Comment

Do Comment on Anything you like or dont like!

 

The Engineer's Spot! Copyright © 2011 - |- Template created by O Pregador - |- Powered by Blogger Templates