The Programming boxes

Table of Contents

Fork me on GitHub

1 PIC Programming

  • One of the most useful process components you will use in Design engineering is a PIC chip. This are small silicon chips which you can write programs for, which will in turn allow you to take control of how your circuit behaves.
  • Using our pre-built programming boxes, you can see how a circuit can be re-purposed to perform an task you want. Hardware hackers take everyday objects, and add electronics to them to create new original products from scrap materials - this is a great way to create innovative new products, and teaches you an enormous amount about Design Engineering at the same time.
  • Your task is to produce a series of increasingly difficult programs to make the inputs and outputs in the programming boxes perform different jobs.
  • You can download the Circuit Wizard file which contains the circuit that is inside the program box from here. It also has an example PIC program to get you started; well worth a read!

The programming boxes

There are 12 different programming challenges, each a little harder than the one before it. You're not expected to complete them all (although if you can, you should take GCSE Design Engineering!).

a: Bike light. Make a program that causes the LED lights to alternate on and off once a second when the unit is turned on.

b: Momentary LED torch. Make a program where holding down the button causes the LEDs to illuminate, and releasing it turns them off.

c: Toggle switched LED torch. Change the program so that the LEDs come on when the button is pushed once, and are turned off when pushed a second time.

d: Morse code transmitter. Make a program that will cause the piezo siren to beep (and the LEDs illuminate) when the button is pushed, to allow act as a Morse code transmitter. Bonus marks if you can make it transmit SOS when the button is pushed once.

e: Night light. Write a program for the box that causes the LEDs to illuminate when it gets dark.

f: Night light Mk II. Modify your program so that your night light can also be turned on and off by the PTM switch.

g: Music box. When the button is pushed, Happy birthday plays and the red LED is illuminated. When pushed while the LDR is covered, a different tune is played, and the green LED comes on.

h: Music box Mk II. The piezo plays a tone which goes up and down in response to the current light level. Even better, if the button has to be held down at the same time.

i: Personal alarm. Write a program that will make the piezo siren beep, and the LEDs flash on and off when the button is held down for 3 seconds.

j: Book alarm. The user places an object on top of the program box (so the LDR is in the dark). When the object is removed, the piezeo siren sounds and the LEDs to flash.

k: Free choice. Write your own program to utilise all the inputs and outputs, and write a short description of what it does.

Final challenge: Write a program to control an alarm which (when armed) sits inside a cupboard or drawer, and goes off when it detects the drawer has been opened. It should work as follows:

  • 1. Green LED comes on
  • 2. When the button is pushed and held for 3 seconds, the green LED should blink on and off once a second and the piezo should beep at the same time for 5 seconds.
  • 3. After 5 seconds, the green LED should go off, and the red LED should be turned on.
  • 4. The current light level should be stored in a variable called "C".
  • 5. The value of C should be increased by 5.
  • 6. Once a second, the current light level should be compared to the stored in "C".
    • 6a. IF the current light level goes above the value of C, then…
    • 6b. The red and green LEDs should flash one after another, while the piezo siren beeps.
  • 7. Repeat step 6.
  • For additional credit, add instructions to disarm the alarm without setting it off by holding down the button.

Badge It Silver

  • Download the Word document and upload you screenshots below each letter.
  • Only upload the the document once, to the badge you feel it fits best with.
  • Use the 'Snipping Tool' to take a picture of your flowchart. Upload the challenges 'A to E' for the Silver Badge.

Badge It Gold

  • Upload Challenges 'F to H' flowcharts.

Badge It Platinum

  • Upload all of the flowchart challenges(I to K), including the Final challenge.

Return to homepage