Experimenters Kit

Introduction

CodeBug’s legs are really powerful, you can attached LEDs and button to them using croc-clips, to make your CodeBug project even more interactive, and this guide will show you how!

>

Before you start this guide you should have completed the Scrolling Name Badge activity, for an introduction to CodeBug and the website.

You will need
CodeBug CodeBug
Micro USB cable
Computer
CR2032 battery
Crocclips
Buttons
LEDs

2 Questions

Croc-clips and wires

Croc-clips are useful wires that can clip to all sorts of electrical components.

Many croc-clips come in bright colours but they work the same way no matter what colour they are. However to make projects simpler certain colours are typically used for certain tasks. For example, black is used for ground(-) connections and red for power(+). This is so it doesn’t become confusing with complicated projects.


  • Ask a new question:

Lights!

CodeBug’s legs can be used to turn LEDs (and other things!) on or off. In this mode the legs are called outputs.

How LEDs work

LED stands for light emitting diode, they are essentially really small light bulbs. So firstly, what is a diode? A diode is simply something that lets electricity flow in one direction and not the other.

LEDs create light because they are made of two different materials. One of the materials requires the electrons to have less energy so they lose their extra energy in the form of light.


1 Question

Lighting up an LED with CodeBug

Connect a red croc-clip to the power leg (PWR) of CodeBug and another croc-clip to leg 0.

LEDs have two leads and one is longer than the other. The longer lead is the positive one, so connect this to the red croc-clip that is attached to the PWR leg on CodeBug. The shorter lead is the negative one, so connect this to the croc-clip attached to leg 0. LEDs will also sometimes have a flat edge on the plastic casing, this indicates the negative side.

Follow the tutorial below to flash your LED!


2 Questions
  • Why is there no external current-limiting resistor in series with the LED? I would expect one so as not to damage the LED or the GPIO pin. Is there a resistor on the Code Bug or are you using the GPIO in some special way to limit the current? Dan Halbert @ Oct. 17, 2015, 2:09 a.m.

    • The Codebug has a 330 ohm resistor in series with each leg so you don't need an external current-limiting resistor. You can see it on the schematic here: http://www.codebug.org.uk/assets/creativecommons/codebug-schematics.pdf — ee31ag @ Dec. 7, 2015, 10:15 a.m.


    Answer this question:

  • there is a series resistor for each of the GPIO legs on codebug.to limit current Thomas Macpherson-Pope @ Oct. 21, 2015, 10:08 a.m.

    • The Codebug has a 330 ohm resistor in series with each leg so you don't need an external current-limiting resistor. You can see it on the schematic here: http://www.codebug.org.uk/assets/creativecommons/codebug-schematics.pdf — ee31ag @ Dec. 7, 2015, 10:16 a.m.


    Answer this question:

  • Ask a new question:

Buttons!

CodeBug’s legs are can also detect electric currents. In this mode they are called inputs.

How buttons work

Buttons work by controlling whether two contacts are connected or not. When the button is pushed the two sides are connected and electricity can flow. In the off state (not-pressed) no electricity will flow.

The button diagram above shows how the buttons legs are connected. The two legs on the left are always connected together, and the two legs on the right are always connected together. While you press the button, the left side and the right side are connected.


2 Questions
  • Do we need to debounce buttons in the codebug? Yes, I'm also learning Arduino ... can you tell? — RooAndDad @ Aug. 5, 2015, 8:08 a.m.


    nope I can't tell ericyun @ Aug. 1, 2018, 5:40 a.m.

    Depending on your program you may need to debounce the buttons Thomas Macpherson-Pope @ Sept. 29, 2015, 12:13 p.m.

    Answer this question:

  • Nope ericyun @ Aug. 1, 2018, 5:40 a.m.


    Answer this question:

  • Ask a new question:

Using a button with CodeBug

Connect a black croc-clip to the ground leg (GND) on CodeBug and attach the other end of the croc-clip to a lead on the button. Now connect another croc-clip to leg 1 of CodeBug and the other end to the lead diagonally across from the other leg you have connected to.

Follow the tutorial below to write programs for your button!


  • Ask a new question:

Touch sensitive inputs

CodeBug’s legs are also touch sensitive, so you don’t have to use switches -- you can just use your hands!

  • Leave your program on CodeBug from the previous step and make sure CodeBug is powered.

  • Disconnect your button from the croc-clips, but leave the croc-clips connected to CodeBug’s legs (1 and GND).

  • Hold the metal end of one croc-clip in one hand and touch the end of the other croc-clip with your other hand.

  • When you touch the clip, CodeBug senses it and runs the blocks of code you told it to.

This works because everything containing a lot of water will conduct a small amount of electricity. This is not enough electricity to power something like an LED, but it is enough for CodeBug’s legs to sense. Since the human body is about 70% water YOU conduct this small amount of electricity too!

Try holding a friend’s hand and get them to touch the other croc-clip.

Gather some more friends and see how many how people can be in the chain before CodeBug can’t sense the electricity anymore. Each extra person adds some resistance to the electricity in the chain. Each person in the chain adds more resistance which makes it harder for the electricity to flow.


  • Ask a new question:

What next?

Have a look at CodeBug’s Fruit keyboard activity sheet that uses different objects as keyboard inputs!


4 Questions
  • I'd like to connect a peripheral which will pull it's output high (5V) when it's condition is satisfied, all of the instructions I have found so far indicate how to operate a switch that connects to ground rather than one that pulls high. Should I add a physical pulldown resistor (as there isn't a pulldown option in blockly)? Will I need to add a voltage divider to the output to drop the voltage level onto the input leg? Doug @ Sept. 18, 2015, 2:10 p.m.

    • Can I ask what device it is? It's unlikely that you'll need a pull-down resistor as the device probably pull the output low (0v) when the condition is not satisfied, but I'd need to know that the device is to be sure. And, yes, It probably would be best to used a voltage divider. — ee31ag @ Dec. 7, 2015, 10:19 a.m.


    CodeBug has pullup resistors so the inputs default to high. To achieve what you need you could use a transistor to pull the pin to CodeBug's ground when your peripheral Thomas Macpherson-Pope @ Sept. 29, 2015, 12:21 p.m.
    • Thank you Thomas. — Doug @ Sept. 30, 2015, 7:54 a.m.


    Answer this question:

  • What would happen if we were to use say 10 LEDS on adaptors with two croc-clips? Giorgio Albertini @ May 2, 2016, 4:29 a.m.

    • in — Austen W @ Aug. 24, 2016, 10:32 a.m.


    The 'Codebug Brain' has limited current it could supply. If you connect those ten LEDs in parallel, all of them will probably shine with a dimm light. If you connect those ten LEDs in series - no LED would light up because depending on colour, each LED has a dropout voltage, say 1,2 V. 10 x 1.2 V = 12 V and the Codebug supplies 5 V (via USB) or 3.3 V (via battery) so the Codebug has to small voltage to power such a series. Grzegorz Grzęda @ July 7, 2016, 9:40 a.m.

    Answer this question:

  • how young Ruby Darwen @ May 23, 2016, 1:17 p.m.


    inbetween Ahania Ashlin @ Dec. 31, 2016, 11:50 a.m.

    -1
    olivia stop it !!!!!!!!!!!!!!!!!!!!!!!!!! Ruby Darwen @ May 23, 2016, 1:18 p.m.

    Answer this question:

  • -1

    how old Ruby Darwen @ May 23, 2016, 1:16 p.m.


    10 Ruby Darwen @ May 23, 2016, 1:16 p.m.

    Answer this question:

  • Ask a new question:

Back to top