[a bit lost about how Littlebits works] Display 3 numbers often updated via internet


I discovered Littlebits two days ago, and I’m quite impressed about what we can do with.

I thought of project : I want to display 3 numbers which must be updated often from an internet service which have an API (I have programming skills and a server).

I have read that we can update a littlebit module via cloudbit with the littlebits API - https://github.com/littlebits/cloud-api-lessons

So my script would be on my server, executed often (using crontab).

My issue is : I’not sure of what I really need to buy.

To display one number, I need the number module : https://littlebits.cc/bits/number
To deal with the internet, I need a cloudbit : http://littlebits.cc/bits/cloudbit which include a P3 USB Adapter.

Main question : Does I need 3 cloudbits + 3 number module or just 1 cloudbit, 1 fork or branch module and 3 number module ?

=> Can I control 3 number modules distinctly with a fork/a branch + a cloudbit ?

I thought also of another way : I have a lot of old computer at my home that I can let 24h/24 switched on.

Is there any way to update a littlebits number module from a computer? I wasn’t sure that I can with the P3 USB Adapter (is it only power ?)

With what I have read, the Arduino module isn’t a good solution for an internet updated project.

As you can see, I have programming skills but I’m a bit lost with electronics.

thanks for your help and sorry for my poor english,
best regards,

Hi @syskaw! :slight_smile:

The Arduino module works well with the cloudBit, and you can easily use two number bits as outputs on the Arduino.

Would it be acceptable to use 1-2 indicator leds to reduce the amount of number modules required in your design? Let’s say if the led is on then the user can read the number as “player #1’s score”, but if a different led is on, then the same number module can be read as “player #2’s score”… Just an idea! :wink:

Since I don’t have context, I’m using player’s score as an example. Can you tell us more about how your project will be used to help us better understand your intent?

Thanks! :slight_smile:

Hi @JackANDJude!

Thanks for your answer!

My city has a self-service bike system available 24 hours a day - and we can easily get the number of available bikes for each station - they have an API - let’s see an example :

curl -s "https://api.mybikesyst.tld/StationNumber?&apiKey=XXX" 2>&1 \
| grep -E -o "\"available_bikes\":[0-9]+," \
| cut -d : -f2 | cut -d , -f1

This code return the number of available bikes for one station (depends on StationNumber parameter).

You guess: I have 3 bike stations near me.

I want to print a map of my neighborhood (from openstreetmap) and to display in this map the number of available bikes (of my 3 bike stations).

So I must have 3x littlebits number module.
With what you say, I understand that I can’t use a fork/a branch module to help me but more an arduino module?

Thanks for reading!

If you connect 3 number modules to a branch or a split, they will all read the same. You would definitely need an Arduino to easily display 2 number modules.

How many bikes do the bike stations hold? Based on the numbers, how would you decide which bike station you would use? Would it be acceptable to know which bike station has the most bikes, or if a bike station has more than 5 bikes? I’m trying to figure out ways for you to use fewer number modules in your design.

For inspiration, check out the Tide Machine - See the Waves by Zachary McCune:

@JackANDJude !

I would like to thanks you very much for your help :smile:

I prefer to use 3x number module - it would be more a dashboard :smiley:

The last point is that I have never used arduino programming but I have imagined a system like this :

On my server, when I have the 3 numbers, lets say 12, 03, and 0, I would run 4 curl queries ( the value is limited (0 to 99)). I will eliminate the value 99 (to have a starting point).

curl -i -XPOST \
-H "Authorization: Bearer XXXXXXXXXXXXXX" \
"https://api-http.littlebitscloud.cc/v3/devices/XXXXX/output" \
-d percent=12 \
-d duration_ms=4000 ;
sleep 4;
curl -i -XPOST \
-H "Authorization: Bearer XXXXXXXXXXXXXX" \
"https://api-http.littlebitscloud.cc/v3/devices/XXXXX/output" \
-d percent=03 \
-d duration_ms=4000 ;
sleep 4;
curl -i -XPOST \
-H "Authorization: Bearer XXXXXXXXXXXXXX" \
"https://api-http.littlebitscloud.cc/v3/devices/XXXXX/output" \
-d percent=0 \
-d duration_ms=4000 ;
sleep 4;
curl -i -XPOST \
-H "Authorization: Bearer XXXXXXXXXXXXXX" \
"https://api-http.littlebitscloud.cc/v3/devices/XXXXX/output" \
-d percent=99 \
-d duration_ms=63000 
sleep 63;

And I will flash my Arduino with this program :

void setup() {
  pinMode(1, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(0, INPUT); 

void loop() {
 while(digitalRead(0)==99) {  
  digitalWrite(1, digitalRead(0) );
  digitalWrite(5, digitalRead(0) );
  digitalWrite(9, digitalRead(0) );

If you want to understand my delay system here is a graph :

Last question, the power : does the cloudbit will power the 3x number module + arduino ?

Thanks you !

Hi @syskaw,

A potential problem with your setup is that pin 1 does not have pwm output, and will only show either 00 or 99 on a number bit. There are the D10, D11 and D13 pins that are not connected to a bitSnap located near the ICP connection. See this post to find them:

All 3 of those pins DO have pwm output, but you will need to wire them into your circuit yourself.

Hi @chris101,

If i follow what you say D1 output is useless for my project - it’s a logical output.

Are you sure ? What I have seen is that D1 is a digital pin that is also a Serial out (known as TX) ( here : Getting Started with Arduino ) but I don’t know if it’s proper for the number module ( Does the number module require PWM ? I can’t find any information about )

And I understand very well what is a “serial out” ( is it like the “serial port” on a computer ?

I’m not sure if I can wire myself anything ( and what ? )…

I think about the second solution using a Rasbperry Pi/a computer switched on 24h/24.

Hey @syskaw,

Pin D1on the littleBits, or any other Arduino, is a digital pin. In fact, all arduino pins are digital. You are correct: it is shared with the serial out line. This pin, combined with the serial input pin (D0) is like a computer’s serial port. If you look through the Arduino software’s examples menu, you will see several sketches that demonstrate the serial capabilities of he Arduino. The serial port is also avaliable through the usb connector.

Pulse width modulation, or pwm, means that the output of the pin can be changed by using the analogWrite() function. AnalogWrite changes the amount of time the pin is 0 volts vs 5 volts, by switching it on and off very fast (500 or 900 times a second.) A filter circuit can change that into an analog voltage. The switches on the arduino bit activate a filter circuit for pins 5 and 9.

The number bit reads an analog voltage through it’s input bitSnap, and displays it as a voltage, or as a percentage. (The newer number bits also do counting.) Number bits have their own filter circuit, so they work with either analog input, or pwm. So you can use analogWrite to affect a number bit attached to pins D5 and D9 only. You can attach a number bit to pin D1, but it doesn’t have pwm, so it will either read 0 volts or 5 volts, but nothing in between.

For us pin-hungry types, littleBits has broken out three more pwm pins, and put them on solder holes, that a standard 0.1" header fits in. It requires soldering 3 points on the back of the arduino bit, and looks like this when done:

With this header in place, regular jumper wires can be used to get access to three more pwm pins.

You could use a RasPi, but for changing a few numbers, it would be over-kill imho. Remember Marvin the robot from Hitchhiker’s Guide complaining that he had “a brain the size of a planet”, yet his job was to push buttons on an elevator. It’s kinda like that. I find programming an Arduino to be orders of magnitude less complex than even the simplest program on a Pi. Raspberry Pi boards also draw about three times more current than an Arduino bit, and don’t come with bitSnaps.