Number Module & Arduino

Is it possible to create my own value by using the number module and the arduino module? In other words, lets say I want to use the number module as a countdown from the arduino module, how would I get those values from the arduino transfered to the number module? There are pads on the backside of the number module, but I am unsure how to use them.

Hi Mr. Steam,

Yes you can do that! I’m tracking down a look-up table that we have been using to do just this and will post it when I find it.

-Sean

Awesome! Appreciate the help Sean!

Hi Mr. Steam,

This is the look-up table. So when you want to set a number, set the index of clockValues to the number you want (i.e. clockValues[20] should display 20). You may have to tweak it a bit but this will get you pretty close.

int clockValues[] = {0,3,5,7,9,11,15,17,19,22,25,28,29,32,35,38,39,42,44,47,51,53,57,59,60,62,65,69,70,72,75,78,82,84,85,87,91,93,96,97,101,103,106,109,111,112,115,117,121,124,126,128,132,134,135,137,141,143,145,147,150,154,156,158,160,163,165,168,171,174,177,179,181,184,186,188,190,192,195,197,202,204,206,210,212,214,217,219,221,224,227,230,233,235,237,240,242,244,246,250};
6 Likes

Sean,
Can you please tell me how the numbers are mapped/assigned within the number bit? I programmed mine differently, so mine does not correspond to this lookup table. Here is my code for mapping numbers within the number bit:

int number = analogRead (ADCpin); //ADCpin is A0
number = map(number, 375,999 , 0, 99);

This map works for me with a dimmer, because I get voltages from 1.9v to 4.9v at A0.

My circuit is the same as the number bit, except that I replaced the ATMega168 with a ProMini 5V (ATMega328).

Thank you!
-Jude

Hey @JackANDJude!

Check out RichB’s “littleBits Counter” Project. He uses the number bit within his code. He explains how the Arduino converts numbers to the number Bit using Pulse Width Modulation. He explains it through the Arduino Code, via comments. http://littlebits.cc/projects/the-littlebits-count

Also check out the code for “Quantified Thirst”.

Good Luck :smile:

I have looked through these projects, as well as RichB’s Dice projects. They would be exactly what I would need if I was using the original number bit.

I made my own number bit using the littleBits schematic on GitHub. I can’t guess at the coding for the number bit (there’s a programmed atmega168 chip on the number bit). I can make all the numbers from 0 to 99 just fine with a dimmer, but the map I used within the number bit is too granular to use with the Arduino bit.

What I need is the code littleBits uses for their number bit, or a hint as to how they read the signal on their ADCpin…

Hey Jude!

We’re working to get this code uploaded for the community soon, but as of now it is unavailable. Sorry for the inconvenience. I know how anxious you may be!

Awesome Number Bit BTW! You’re truly amazing! We most definitely should collaborate on some projects one day! :smile:

Thanks. I agree a collaboration is in order. I like your stuff.

I’ll use work-arounds on my DIY number bit in the meantime. :wink:

:slight_smile: Awesome! We’ll be a great duo! I’ll inform you when the code is released!

@JackANDJude i’m not quite understanding your problem. If you are able to read A0 on your 328, and then you map the analog values to 0 to 99 and print that value out to the console, do you not see numbers from 0 to 99? If “yes”, then you need to turn on the proper segments on the 2 7-segment LEDs … or ?
For reference here is spec on 7-segment LED
http://www.hacktronics.com/Components/LED/7-Segment-Blue-LED-Display/flypage.tpl.html
They come in either common-cathode or common-anode flavors.

Sparkfun has breakout board with these LED numbers, and their product description includes the firmware used on the embedded 328p, see

https://www.sparkfun.com/products/11442

@JackANDJude the firmware for o21 number module is available now
https://github.com/littlebits/o21-number

Thank you :slight_smile:

I also spent a bit of time on this as well and came up with the following simple formula. You can run any number 00-99 through to output the correct corresponding number to your Little Bits Number Module via Arduino Module. I’ve also used on Scratch 2.0 with Little Bits Arduino extension. Has worked great for me.

Simply take your desired output number and multiply it by 2.522

  //Assign outputNumber as any desired digit 00-99 to be displayed
  //Tested as int and float and both have worked

  outputNumber = outputNumber * 2.522;
  analogWrite(5, outputNumber);

Hope this helps,
Derek

1 Like

Nice work, thanks for that code.

I’m trying this code with the latest number module and in order for this to work I need to set the switch to read->values. That is all working great and using Derek’s formula is perfect for setting the number, but I can’t seem to get the counter to start at 0. even if I set:

analogWrite(5, 0);

The value sill displays as 01

Any ideas?

@RichB, you’ve worked with both numbers. Do you have a suggestion for @maccast?

Hi maccast: Were you able to solve this problem?. I’m experiencing the same situation and trying to find an answer found your question.

@MaryMIG, so sorry for the super LATE reply. I never did get this working and I did not ever get back to it.