• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 06:41
CET 12:41
KST 20:41
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
HomeStory Cup 28 - Info & Preview6Rongyi Cup S3 - Preview & Info3herO wins SC2 All-Star Invitational14SC2 All-Star Invitational: Tournament Preview5RSL Revival - 2025 Season Finals Preview8
Community News
Weekly Cups (Jan 19-25): Bunny, Trigger, MaxPax win3Weekly Cups (Jan 12-18): herO, MaxPax, Solar win0BSL Season 2025 - Full Overview and Conclusion8Weekly Cups (Jan 5-11): Clem wins big offline, Trigger upsets4$21,000 Rongyi Cup Season 3 announced (Jan 22-Feb 7)38
StarCraft 2
General
HomeStory Cup 28 - Info & Preview StarCraft 2 Not at the Esports World Cup 2026 Weekly Cups (Jan 19-25): Bunny, Trigger, MaxPax win Oliveira Would Have Returned If EWC Continued herO wins SC2 All-Star Invitational
Tourneys
KSL Week 85 HomeStory Cup 28 $21,000 Rongyi Cup Season 3 announced (Jan 22-Feb 7) OSC Season 13 World Championship $70 Prize Pool Ladder Legends Academy Weekly Open!
Strategy
Simple Questions Simple Answers
Custom Maps
[A] Starcraft Sound Mod
External Content
Mutation # 510 Safety Violation Mutation # 509 Doomsday Report Mutation # 508 Violent Night Mutation # 507 Well Trained
Brood War
General
Bleak Future After Failed ProGaming Career Potential ASL qualifier breakthroughs? BW General Discussion BGH Auto Balance -> http://bghmmr.eu/ [ASL21] Potential Map Candidates
Tourneys
[Megathread] Daily Proleagues Small VOD Thread 2.0 Azhi's Colosseum - Season 2 [BSL21] Non-Korean Championship - Starts Jan 10
Strategy
Simple Questions, Simple Answers Zealot bombing is no longer popular? Current Meta Soma's 9 hatch build from ASL Game 2
Other Games
General Games
Nintendo Switch Thread Battle Aces/David Kim RTS Megathread Path of Exile Mobile Legends: Bang Bang Beyond All Reason
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Hager werken embalming powder+27 81 711 1572
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Mafia Game Mode Feedback/Ideas Vanilla Mini Mafia
Community
General
Things Aren’t Peaceful in Palestine US Politics Mega-thread Russo-Ukrainian War Thread YouTube Thread Canadian Politics Mega-thread
Fan Clubs
The herO Fan Club! The IdrA Fan Club
Media & Entertainment
[Manga] One Piece Anime Discussion Thread
Sports
2024 - 2026 Football Thread
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List
Blogs
How Esports Advertising Shap…
TrAiDoS
My 2025 Magic: The Gathering…
DARKING
Life Update and thoughts.
FuDDx
How do archons sleep?
8882
James Bond movies ranking - pa…
Topin
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1532 users

[Boredom] A real-time Bitcoin price ticker

Blogs > Loser777
Post a Reply
Loser777
Profile Blog Joined January 2008
1931 Posts
April 13 2013 22:26 GMT
#1
(with Arduino.)

Here is what it looks like:

[image loading]

This is an extremely long rant about something extremely simple.

I recently stumbled upon a fairly common joke sign that reads "This is a
Velociraptor free workplace... it has proudly been [blank] days since the
last velociraptor incident. This particular sign had a post-it tacked on that
had the result of some crude calculation e.g. 71 million years x 365 days/year.
Excusing the fact that there are leap years and that it is highly unlikely that
it has been EXACTLY 71 million years since the last Velociraptor incident,
the post-it is static and unchanging. It will read the same number of days every
day unless someone manually changes it (not going to happen).

As I happened to be somewhat bored, I thought about building a sort of clock
that increments by a day for every day--such clocks are common, but this one
would have 11 digits (enough to support the order of magnitude of the number
of days). I figured the perfect platform to build such a device on would
be the Arduino, connected to some kind of binary-coded decimal to
seven-segment decoder. I knew what I needed existed (the seven-segment
decoder was a mini-project in one of my classes). However, given the number of inputs
on the Arduino and basic economics, it wouldn't make sense to use a
separate decoder for every digit.

Instead, I used one of the greatest tricks in the history of human-interface
devices. Multiplexing. Instead of drawing every number at the same time,
I just draw them one at a time. Really, really fast. Fast enough that
it looks like I'm drawing all of them at the same time. All I need to implement
the multiplexing with the Arduino is to control when a given digit is lit
so that the correct one is drawn--this is easily done with a transistor
acting as a switch. In fact, even though a given digit is comprised of
seven distinct LEDs, they share a common path to ground, so an entire
digit can be switched on and off with a single transistor.

At this point, there just needs to be a little housekeeping and part-sourcing
to build the project. I used the following:
4511 Seven-segment BCD-decoder--this just takes in a binary number from in the
range 0000 to 1001 and spits out seven voltages that will drive the seven-segment
display. I was originally using the 4543BE (which has very similar specs), but
it kept malfunctioning (digits weren't showing up correctly) so I switched to
the 4511. Knightbright (RED) Seven-segment displays (number depends on how many
digits you want. As the number of digits lit up per display is not constant, there needs
to be a current limiting resistor for each segment of each digit--in this case
I was driving everything with 5V and a voltage drop of 2V meant I needed
7*(number of digits) worth of 150 ohm resistors to limit the current to 20mA.
For the switching transistor I picked the 2N3904, which can handle the current
requirements easily (max of 7*20mA). I also used a resistor to limit the base
current on the 2N3904 to 1/10th of what I needed from collector to emitter
(in this case 300ohms). Finally there's a 10K reistor for each of the digital
logic inputs so that I can control what the logic values settle on.

Oh yeah. I also used a breadboard pre-cut jumper wire (I'm not a big fan of
stripping a lot of wire by hand).

This is where it stopped becoming a clock and became a ticker. While prototyping
the circuit, I realized that each of the seven-segment digits I bought had
an eighth LED--a decimal point. I had already added five digits and realized
that 5 significant digits and a decimal point are just right to represent
some $XXX.XX dollar value. That's where bitcoin prices came in.

The software side of the project is so simple that I'm not going to go into
too much detail.
I use a 20-line Python script that parses the last price from mtgox.com and
spits it out as serial data. It refreshed mtgox every 30 seconds and will
retry up to 10 times if the page isn't loading.

The Arduino is constantly drawing the digits and checks if it has received
a new number every two seconds, and if the new number is different, it
increments or decrements the old number until it's equal to the new number
(this gives it a slightly cooler look than just changing the display
in a single instant).

Comments:
Unfortunately I'm not crazy enough to program the microcontroller at the assembly
level or use some fancier display process so basically all of Arduino time
is spent drawing the digits. This means that when it's reading new serial
input there's a half a second when the display blanks.

There's also some floating point rounding
quirks on the Arduino where if you do something
like:
If number A is less than number B
add 0.01 to number A
Else if number A is greater than number B
subtract 0.01 from number A
You end up with some oscillation where A never quite settles on a single
value but jumps between B and B + 0.01. You can solve this by simply
deciding to stop incrementing something when the difference is withing
some number larger than 0.01.

When drawing the digits, there's a brief period (1ms) where everything is switched
off before drawing the next digit, otherwise there is ghosting from the
next digit being drawn bleeding onto the current digit. The 1ms period
is not visible to the human eye.

Getting Arduino to work in Arch Linux is a pain. The IDE doesn't render correctly
if you don't use a full-fledged desktop environment that supports Java's
crap and there's some serial communication configuration that you have to go
through. As a result, I did all of the Arduino stuff in Winblows and later
moved the code over to GNU/Linux when I knew it was working.

Notes:
If you are really dying to see my horrible and ugly code (I have no sense of style, especially Python style), here it is:
https://github.com/eqy/bitticker

6581
LML
Profile Blog Joined March 2007
Germany1774 Posts
April 13 2013 23:00 GMT
#2
no indent after case, this hurts me a little inside;
LML
Loser777
Profile Blog Joined January 2008
1931 Posts
April 13 2013 23:16 GMT
#3
On April 14 2013 08:00 LML wrote:
no indent after case, this hurts me a little inside;

Yeah that Arduino code was a serious hackjob (had to use the crappy IDE instead of my usual text editor).
6581
Please log in or register to reply.
Live Events Refresh
Next event in 19m
[ Submit Event ]
Live Streams
Refresh
StarCraft: Brood War
Calm 15774
Bisu 1929
PianO 1431
Hyuk 790
Shuttle 496
Jaedong 469
Stork 337
Pusan 312
Soulkey 273
Mini 268
[ Show more ]
Soma 266
Light 260
EffOrt 245
Zeus 233
firebathero 214
actioN 203
BeSt 191
Hyun 162
Snow 106
Dewaltoss 84
Larva 80
ggaemo 79
Rush 70
Mong 69
Mind 66
Backho 51
scan(afreeca) 50
ToSsGirL 48
Sharp 35
NotJumperer 33
[sc1f]eonzerg 24
Shine 23
Free 22
Sea.KH 21
Sacsri 21
Shinee 20
Movie 17
soO 16
GoRush 16
Bale 15
HiyA 12
Terrorterran 12
zelot 10
SilentControl 8
sorry 7
Icarus 4
Dota 2
XaKoH 511
XcaliburYe183
Fuzer 166
NeuroSwarm79
League of Legends
JimRising 314
Counter-Strike
zeus1242
olofmeister698
Other Games
gofns10564
B2W.Neo985
crisheroes366
ToD135
Mew2King75
Organizations
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 14 non-featured ]
StarCraft 2
• StrangeGG 94
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Jankos1622
• Lourlo1152
• Stunt428
Upcoming Events
HomeStory Cup
19m
TaKeTV0
TaKeSeN 0
Korean StarCraft League
15h 19m
HomeStory Cup
1d
Replay Cast
1d 12h
HomeStory Cup
2 days
Replay Cast
2 days
Replay Cast
3 days
Wardi Open
4 days
WardiTV Invitational
5 days
The PondCast
5 days
[ Show More ]
WardiTV Invitational
6 days
Liquipedia Results

Completed

Proleague 2026-01-29
OSC Championship Season 13
Underdog Cup #3

Ongoing

CSL 2025 WINTER (S19)
KCM Race Survival 2026 Season 1
Acropolis #4 - TS4
Escore Tournament S1: W6
Rongyi Cup S3
HSC XXVIII
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
eXTREMESLAND 2025
SL Budapest Major 2025
ESL Impact League Season 8

Upcoming

Escore Tournament S1: W7
Acropolis #4
IPSL Spring 2026
uThermal 2v2 2026 Main Event
Bellum Gens Elite Stara Zagora 2026
PiG Sty Festival 7.0
LiuLi Cup: 2025 Grand Finals
Nations Cup 2026
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League Season 23
ESL Pro League Season 23
PGL Cluj-Napoca 2026
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2026 TLnet. All Rights Reserved.