Example: confidence

1 ELECTRONIC DICE - Home - PICAXE

1 picaxe -08 ELECTRONIC dice PROJECT revolution1 copyright 2002-10 - AXE105 ELECTRONIC dice Project Notes Version by:Revolution Education Ltd. Web: DICEWhat is a microcontroller?A microcontroller is often described asa 'computer-on-a-chip'. It can be usedas an ELECTRONIC brain to control aproduct, toy or microcontroller is an integrated circuit("chip") that contains memory (to store the program), aprocessor (to process and carry out the program) and input/output pins (to connect switches, sensors and output devices like motors).Microcontrollers are purchased 'blank' and then programmed with a specific controlprogram. This program is written on a computer and then 'downloaded' into themicrocontroller chip. Once programmed the microcontroller is built into a product tomake the product more intelligent and easier to use of a picture above shows an ELECTRONIC dice that can be made to generate a randomnumber. It can be used like a normal dice in dice works by switching Light Emitting Diodes (LEDs) on and off in the pattern ofdots found on a traditional dice .

1 PICAXE-08 ELECTRONIC DICE PROJECT revolution 1 © copyright 2002-10 - AXE105 Electronic Dice Project Notes Version 2.0 Supported by: Revolution Education Ltd. Web: www.picaxe.co.uk

Tags:

  Picaxe, Electronic, Dice, 1 electronic dice, 1 picaxe, Electronic dice

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Transcription of 1 ELECTRONIC DICE - Home - PICAXE

1 1 picaxe -08 ELECTRONIC dice PROJECT revolution1 copyright 2002-10 - AXE105 ELECTRONIC dice Project Notes Version by:Revolution Education Ltd. Web: DICEWhat is a microcontroller?A microcontroller is often described asa 'computer-on-a-chip'. It can be usedas an ELECTRONIC brain to control aproduct, toy or microcontroller is an integrated circuit("chip") that contains memory (to store the program), aprocessor (to process and carry out the program) and input/output pins (to connect switches, sensors and output devices like motors).Microcontrollers are purchased 'blank' and then programmed with a specific controlprogram. This program is written on a computer and then 'downloaded' into themicrocontroller chip. Once programmed the microcontroller is built into a product tomake the product more intelligent and easier to use of a picture above shows an ELECTRONIC dice that can be made to generate a randomnumber. It can be used like a normal dice in dice works by switching Light Emitting Diodes (LEDs) on and off in the pattern ofdots found on a traditional dice .

2 The microcontroller is the brain of the are powerful ELECTRONIC components that have a memory and can beprogrammed to switch things on and off in any sequence. The microcontroller in thedice can switch the LEDs on and off to show numbers between one and the diagonal pairs on LEDs in the dice always light at the same time, they can beswitched on and off by the same microcontroller output. Therefore 4 outputs (3 pairsand the central dot ) are required. 2 PICAXE -08 ELECTRONIC dice PROJECT revolution2 copyright 2002-10 - AXE105 ELECTRONIC dice Project Notes Version by:Revolution Education Ltd. Web: DIAGRAMSThe ELECTRONIC system for an ELECTRONIC dice can be drawn as a block diagram .The push switch is an ELECTRONIC device that can detect movement and is known as an input . The microcontroller then decides how to behave and may then switch theoutput LEDs on in different IS THE PICAXE SYSTEM?The microcontrollers used in devices such as ELECTRONIC games can be difficult toprogram, as they generally use a complicated programming language called assemblercode , which can be quite difficult to PICAXE system makes the microcontrollers much easier to program.

3 The controlsequence can be drawn (and simulated) on the computer as a flowchart, or written in asimpler programming language called BASIC. This makes it much easier to use themicrocontroller as the complicated assemblercode does not need to be sample BASIC program and Logicatorflowchart are shown here. In this case bothprograms do the same thing - flash a light(connected to output 0) on and off :high 0wait 1low 0wait 1goto main 3 PICAXE -08 ELECTRONIC dice PROJECT revolution3 copyright 2002-10 - AXE105 ELECTRONIC dice Project Notes Version by:Revolution Education Ltd. Web: YOUR OWN ELECTRONIC DICED esign BriefDesign and make an ELECTRONIC dice The dice must show the numbers 1-6 randomly byswitching LEDs on and Specification Points1) The design will use any 8 pin PICAXE microcontroller as it s ) The design will include LEDs in a dice DiagramThe block diagram for your safety light may look like this:Personalising Your ELECTRONIC DiceThere are several ways to personalise your are some things to think about:1) Are you going to build your dice on the circuit board or mount it in a case?

4 If youuse a case you will need to attach the LEDs and switch using ) What colour and size of LEDs are you going to use? The most common LEDs are red,but many other sizes and colours are available ( blue).3) How will you activate the dice ? Normally a push switch is used, but you could usemany other types of sensor, for example, you could have a light sensor (LDR) thatcan detect changes in light level when you put your hand over it. 4 PICAXE -08 ELECTRONIC dice PROJECT revolution4 copyright 2002-10 - AXE105 ELECTRONIC dice Project Notes Version by:Revolution Education Ltd. Web: COMPONENTSThe main ELECTRONIC components you may need for your ELECTRONIC dice are shown next few pages describe each of these components in more detail, and also providesome programming ideas that may be useful when you are later programming your dicelight microcontrollerlight emitting diode (LED)push switch3 x AA battery boxand you will also needpicaxe download socketresistors5 PICAXE -08 ELECTRONIC dice PROJECT revolution5 copyright 2002-10 - AXE105 ELECTRONIC dice Project Notes Version by:Revolution Education Ltd.

5 Web: SECTION 2 - ELECTRONIC COMPONENTSMICROCONTROLLERSWhat is a microcontroller?A microcontroller is often described as a computer-on-a-chip . It is anintegrated circuit that contains memory, processing units, and input/output circuitry in a single are purchased blank and then programmed with a specificcontrol program. Once programmed the microcontroller is built into aproduct to make the product more intelligent and easier to are microcontrollers used?Applications that use microcontrollers include householdappliances, alarm systems, medical equipment, vehiclesubsystems, and ELECTRONIC instrumentation. Some modern carscontain over thirty microcontrollers - used in a range ofsubsystems from engine management to remote locking!As an example, a microwave oven may use a single microcontroller to processinformation from the keypad, display user information on the seven segmentdisplay, and control the output devices (turntable motor, light, bell and magnetron).How are microcontrollers used?

6 Microcontrollers are used as the brain in ELECTRONIC circuits. These ELECTRONIC circuits areoften drawn visually as a block diagram . For instance a simplified block diagram for themicrowave above could be drawn like this:The program for the microcontroller is developed (and tested) on the computer and thendownloaded into the microcontroller. Once the program is in the microcontroller itstarts to run and carries out the instructions. 6 PICAXE -08 ELECTRONIC dice PROJECT revolution6 copyright 2002-10 - AXE105 ELECTRONIC dice Project Notes Version by:Revolution Education Ltd. Web: are programs written?Programs are drawn as flowcharts or typed as BASIC listings. This is is explained in theprogramming section (section 3) later in this is the program transferred to the microcontroller?The PICAXE -08 microcontroller is programmed by connecting a cable from the serialport at the back of the computer to a socket on the printed circuit board (PCB) besidethe microcontroller. This socket (which looks like a headphone socket as found on aportable CD player) connects to two legs of the microcontroller and to 0V from thebattery.

7 This allows the computer and the microcontroller to talk to allow a newprogram to be downloaded into the microcontroller s socket and interfacing circuit is included on every PCB designed to be used with thePICAXE-08 microcontroller. This enables the PICAXE microcontroller to be re-programmed without removing the chip from the PCB - simply connect the cable whenever you want to download a new program!The circuit diagrams of PICAXE circuits often do not include the components above tomake it easier to understand the input/output connections. However the two resistorsand the socket are always built onto every PICAXE project board!Output 0 With the PICAXE -08 system leg 7 has two functions - when a program is being run theleg is known as output 0 and can control outputs like LEDs and a program is being downloaded the same leg acts as the serial out pin, talking tothe computer. Therefore if you also have an output such as an LED connected to the leg,you will find that the LED will flicker on and off as the program download takes :The Programming Editor software used to create the programs must be configured forthe correct download cable select View>Options>Serial Port to select the correct serialport for your machine.

8 The cable may be a traditional serial type (part AXE026) or USBtype (part AXE027). ! "#$ ! % & ' ' (") ) *"+ ",' $7 PICAXE -08 ELECTRONIC dice PROJECT revolution7 copyright 2002-10 - AXE105 ELECTRONIC dice Project Notes Version by:Revolution Education Ltd. Web: is a battery?A battery is a self-contained source of electronicenergy. It is a portable power contain chemicals that store connected into a circuit this chemicalenergy is converted to electrical energy that canthen power the battery size should I use?Batteries come in all sorts of types and sizes. Mostbattery packs are made up of a number of 'cells',and each cell provides about Therefore 4 cellswill generate a 6V battery and 3 cells a a general rule, the larger the battery the longer itwill last (as it contains more chemicals and so willbe able to convert more energy). A higher voltagebattery does not last longer than a lower voltagebattery Therefore a battery pack made up of 3AA cells will last much longer than a 9V PP3 battery, as it contains a larger total amountof chemical energy as it is physically larger.

9 Therefore items that require more power towork ( a CD walkman which contains a motor and laser to read the CD's) will alwaysuse AA cells rather than PP3 generally require 3 to to work, and so it is better to use a batterypack made up of two or three AAA or AA size cells. Never use a 9V PP3 battery as the 9 Vsupply will damage the battery type should I use?Different batteries are made of different chemicals. Zinc-carbon batteries are thecheapest, and are quite suitable for many microcontroller circuits. Alkaline batteries aremore expensive, but will last much longer when driving devices like motors that requirelarger currents. Lithium batteries are much more expensive but have a long life, and soare commonly used in computer circuits to provide a clock batteries can be recharged when they 'run-down'. They are generally madeup of nickel and cadmium (Ni-cad) or nickel metal hydroxide (NiMH) ELECTRONIC dice PROJECT revolution8 copyright 2002-10 - AXE105 ELECTRONIC dice Project Notes Version by:Revolution Education Ltd.

10 Web: !Never 'short circuit' any battery. Alkaline and rechargeable batteries can provide a verylarge current, and can get so hot that they will actually melt the battery box if you shortcircuit them! Always make sure you connect the battery around the correct way (redpositive (V+) and black negative (0V or ground). The microcontroller chip will get hotand be damaged if the battery is connected the wrong way battery packs are often connected to ELECTRONIC printed circuit boards bybattery snaps or wires. Always ensure you get the red and black wires thecorrect way around. It is also useful to thread the wires through holes onthe board before soldering it in place - this provides a much strongerjoint that is less likely to snap accidentally connect a 9V PP3 battery to the battery snap - this will damage themicrocontroller, which only works between 3 and to battery small battery boxes require wires to be soldered to metal contacts on the batterybox. In this case you must be very careful not to overheat the metal contact.)