Bus Pirate Edu Kit Exercise no.1

From DP

Jump to: navigation , search

Contents

Overview

BP EK E1 overview2.jpg

Light Emitting Diodes (LEDs) are all around us and are some of the simplest electronics devices. Oh and they are shiny. This is why we'll start our Bus Pirate exercises with them.

The purpose of this excercise is to get you familiar withe Bus Pirate and its command interface. The commands covered are the 'a' and 'A', which make the AUX pin output a '1' or a '0' respectfully. Meaning the output will either be 3.3V in the case of '1', or 0V in the case of '0'.

The exercise will have an LED and a resistor connected to the AUX pin. Through the Bus Pirate Terminal we'll control the LED ON.

  • learn more about LEDS (link wiki)
  • current calc

The Circuit

BP EK E1 schematic.jpgBP EK E1 circuit3.jpg

An LED (LED1) is a unidirectional device, meaning it passes current in only one direction. If you connect it the right way around it will light up, while if connected the other way it won't.

Another feature of LEDs is that they have a constant voltage drop across them when they are ON. Since the voltage drop is lower than our power supply we have to pass the excess voltage to a resistor (R). So our entire circuit is made up of only a single LED and a resistor connected the AUX and GND pins of the Bus Pirate.

Bus Pirate Terminal

600px

Connect the Bus pirate and activate the terminal window. Here's a tutorial on how to connect the Bus Pirate, and activate the Terminal window, if you haven't already please do this now.

HiZ>A<<<Set AUX pin HIGH
AUX HIGH

In this exercise we'll be looking at the 'A' and 'a' AUX control pin commands. Hit 'A' for the AUX output to become '1', or 3.3V.

HiZ>a<<<Set AUX pin LOW
AUX LOW

The LED should have lighted on. Hit 'a' for the AUX output to become '0', or 0V. The LED should switch off.

Not Working?

  • Check if the LED is connected the right way around. The notch on the case is next to the cathode (-).
  • Still not working, please recheck the wiring, perhaps one of the wires is not connected where it should.
  • If you are still having problems, feel free to contact us through this contact form (use [BP_EK] prefix to your title, or ask in the forums.

Taking it further

The AUX pin of the Bus Pirate also provides PWM output. This means that you set the frequency and duty cycle of a signal and have it power the LED. If the frequency of the signal is fast enough the LED will dim proportionally to the duty cycle.

Bus Pirate Terminal

HiZ>m<<<the mode command
1. HiZ
2. 1-WIRE
3. UART
4. I2C
5. SPI
6. 2WIRE
7. 3WIRE
8. LCD
x. exit(without change)

(1)>8<<<Select the LCD mode

This command is not available in the starting 'HiZ' mode so select any of the other available modes using the 'm' command, and going through the menus. In our example we selected the LCD as it doesn't require any additional setup steps.


LCD>g<<<start PWM on AUX pin
1KHz-4,000KHz PWM
Frequency in KHz
(50)>2<<<select 2 KHz for the frequency
Duty cycle in %
(50)>55<<<Select 55% for the duty cycle
PWM active

To activate PWM on the AUX pin you simply type in the 'g' command. You are then prompted to enter the frequency in KHz (we entered 2). The last thing to do i to enter the duty cycle of the PWM signal to be generated. We selected 55%. After entering the duty cycle the PWM generation on the AUX pin will begin. Congratulations, you should now have an LED shining at 55% of how bright it was when the AUX pin was set HIGH.


LCD>g<<<Disable PWM on AUX pin
PWM disabled
LCD>m<<<mode command
1. HiZ
2. 1-WIRE
3. UART
4. I2C
5. SPI
6. 2WIRE
7. 3WIRE
8. LCD
x. exit(without change)

(1)>1<<<Select HiZ mode
HiZ>

To stop the PWM signal simply type in the 'g' command again, and the PWM will be disabled. To return to the starting menu simply type in 'm' and select the HiZ mode (1).