If you’re curious about how the Arduino Bit works and would like to dive a little deeper into its features, check out the info below:
The micro USB port allows you to connect your Arduino to your computer with the included micro USB cable. This connection allows you to load your code onto the Bit and send information from your Bits to your computer.
INPUTS & OUTPUTS
The littleBits Arduino Bit has three input Bitsnaps (d0, a0, and a1) and three output Bitsnaps (d1, d5, d9). You can use these labels in your code to specify which bitsnap you are referring to.
ANALOG vs. DIGITAL
You’ll notice that two of the inputs are labeled with an “a” (a0 and a1). These inputs are analog. That means that they can read any electrical signal coming into them that is between 0 volts and 5 volts. For example, if you connected a slide dimmer to these inputs, it would be able to read all the possible positions of the slide dimmer.
The other input is labeled with a “d.” This is because it is a digital input and can only read digital signals. Digital signals are either HIGH (5 volts) or LOW (0 volts), but never any of the voltages in between. For example if you connected a slide dimmer to d0, the input would read LOW (0 volts) if the slide dimmer was set to less than 50% and HIGH if it was set to more than 50%. For this reason, digital inputs work best with Bits like buttons.
ANALOG vs. PWM
The three outputs are all digital as well. d1 can only send out HIGH and LOW signals. However, d5 and d9 have some extra features which allow you to do much more. The mode switches on these outputs give you two options for your signals.
In PWM Mode the digital output turns on and off so rapidly that it behaves similarly to an analog signal (see Advanced Info below for more details). This mode is especially useful for creating tones and musical notes with a littleBits speaker.
In Analog Mode the PWM signal gets converted into a true analog signal. This is the mode you will use most often with your littleBits circuits.
For more about the difference between analog and PWM mode, check out the Advanced Info below.
If you’d like to dig a little deeper into the Arduino, here’s some more in depth information about the various inputs, outputs, and features of the Bit.
MORE ABOUT PWM AND ANALOG MODE
The key to understanding this difference is to understand the difference between digital and analog electronics:
An analog signal generally refers to the voltage of a signal at a certain time. It is implied that through various electronic components, we can manipulate these signals to represent any voltage between 0 volts and the voltage of our power source. In littleBits this voltage is 5V. An analog signal could be a sine wave such as one in the following picture:
When a signal is said to be digital, it can generally only represent two values, high and low (or as a computer would interpret it, 1 or 0). In the scope of Arduino, the microcontroller it uses can only output a high value or a low value. It cannot for example, output 2.5V (midway between high and low). In order to compensate for this lack of versatility, it uses what is known as a PWM11, or pulse-width modulated, signal.
A pulse-width modulated signal is a digital signal that over a short fixed time interval that will keep the signal low for a percent of the time and the signal high for a percent of the time such that the average signal will be of desired value. Have a look at the figure below.
The blue is a representation of a PWM signal. Notice that it only goes high or low and never has a value in between. Every 1000 samples on the x-axis represents one PWM cycle. When you program your Arduino you can change the length of this cycle, but perhaps more importantly you can tell it for what percent of each cycle you would like the signal to be high for. In the Arduino you will set a value between 0 and 255 to represent this. For this example we set it to 51 which is 20% of 255, so for every cycle the signal goes high for 20% of the time. If we are to take the average value of this cycle (sum each of the 1000 samples and divide by 1000) we would get an average voltage of 1V.
So let’s bring this back to the switch on your Arduino module which allows you to select between the two. when you have PWM mode selected you will be getting that periodic high/low signal described above. When you switch it to analog mode, you are actually rerouting that PWM signal through some additionally circuitry before it leaves the module. This circuitry (in this case a low-pass filter20) converts that PWM signal to the average value of the PWM signal so your output signal will look like the dashed red line rathern than the blue line.
If you have a bar graph bit28, you can use the default code for the Arduino module to see the difference in action. If you program a PWM output to ramp up and down repeatedly you will see all LEDs on the bargraph slowly get brighter and dimmer, all at the same time. If you are to then switch it to analog analog mode you will see each LED turn on in succession and then turn off in succession, all with the same brightness.
MORE ABOUT THE INPUTS AND OUTPUTS
There are six microcontroller pins connected to our bitSnap™ connectors. On one side of the board, there are three input bitSnaps™. They are referred to as D0, A0, and A1 in the Arduino environment. D0 is a digital pin that is also a Serial input (known as RX). A0 and A1 are analog inputs that can also be used as digital inputs.
The other side of the board features three output bitSnaps™. D1 is a digital pin that is also a Serial out (known as TX). D5~ and D9~ are PWM outputs that are also capable of simulating an analog DC voltage (more on that later).
Both the TX and RX pins have LEDs associated with them so show the status of Serial communication between the board and the computer.
For advanced Arduino users, we added a few features that can be taken advantage of and offer connections not previously offered on a littleBits module. They are:
I2C – The top side of the PCB has two pads which break out pins D2 and D3 from the ATmega32U4. These are the SDA and SDL lines used in I2C communications so multiple boards can be chained together. There are unpopulated pads for 10K pull up resistors if I2C implementation is needed. These pins can also be used as GPIO.
ICSP – There is a standard ICSP connection in the form of through holes that can be soldered to with jumper wires or male/female headers. The bootloader can be updated/changed through these pins and programs can be uploaded via a AVR programmer.
Analog GPIO – Pins A2, A3, and A4 are available in the form of through holes that can be soldered to with jumper wires or male/female headers.
Digital GPIO – Pins D10, D11, and D13 are available in the form of through holes that can be soldered to with jumper wires or male/female headers.
LED Bits make bright and bold projects. There are 7 LED Bits in the littleBits family and although we don’t play favorites, the l...