Académique Documents
Professionnel Documents
Culture Documents
TABLE OF CONTENTS
Table of Contents .......................................................................................................................................... 2
1
Inspiration ............................................................................................................................................. 3
3.1
3.2
4.2
Programming ...................................................................................................................................... 17
5.1
5.2
5.3
Settings........................................................................................................................................ 20
Gallery ................................................................................................................................................. 22
1 INSPIRATION
Every project begins with an idea, this project was no exception. I love watching anime 1 and the scifi genre just hits the jackpot, here we have Steins;Gate and its time travelling journey that brings tears,
joy, silliness and more importantly the pinnacle of laboratory equipment the Divergence Meter to the
table which is in fact a device (of course fictional) that can calculate the differences between the World
Lines(Multiverse or alternate timelines if you will) and quantify it in percentages, which is then
displayed on a Nixie Tube Clock.
Being the electronics enthusiast I am, I have set out to build this eye dropping device with all its
glory. Not to mention my sister had given me some IN-14 Nixie Tubes prior (thanks a lot), so it was the
perfect time to start building one. I also give thanks to Tom Titor for being one of the Divergence Meter
pioneers, without his prior work and very great documentation this would have been multifold harder,
not impossible but much more harder.
One other reason is that I have my own code to follow which is to try and make something yourself
(of course within your power) before buying some commercial product, this is my maker spirit. Not to
mention the commercial product were talking about is nothing like the device itself presented in the
visual novel/anime. Like seriously, it doesnt. see?
Japanese Animations
Additional Features:
Light Sensor to detect night time to conserve power and extend Nixie tube life (could probably
act as a basic motion sensor with some software magic)
2.
Improvements/Slight changes:
Should be able to fit 2x9V batteries instead of one so more portable cosplay time :D
Should be able to fit 2xAA RTC backup battery so it keeps track of time accurately for
theoretically over a year.
Uses the larger but cheaper and more available version of the HV5622
Uses an AVR instead of a PIC (I chose it because it can be reprogrammed by AVR tools and a
PICKIT2 if you happen to have any of those)
3.
Mostly SMD parts to make look all good when your showing off the innards XD
Limitations:
Can only use the DS3232 RTC and not the DS1307
Anyways thats what sums up what my expectations were during the start of the project, so some
of those features might not be implemented.
Another thing during planning was that I wanted this to be an Open Source/Open Hardware
project, in spirit of sharing with the community and so that anyone could easily create or modify their
own Divergence Meter, which is the reason I used an AVR instead because the compiler tools were more
free (sigh XC8 -.-) with no limitations and hey why not? This is actually the first time Ive programmed
an AVR and it was a good learn, I actually prefer them now! (Fanning the AVR vs PIC wars \o/)
I also considered the cost of making one and new places to source my parts, this should be one of
the cheapest Divergence Meters out there! I sourced my parts from TaoBao 2, finally thanking that I live
in Hong Kong. The parts were significantly cheaper than other sources like Digikey and Element14, the
total shipping was also so much cheaper. Any parts I couldnt find, I just bought from RS, they have free
local delivery so kudos to them. I must also mention that I did request some samples from Maxims
Integrated, Microchip and Texas Instruments (and they approved), so I guess some parts I did get for free . I cant thank them
2
enough for that and hope that enough people build Divergence Meters to cover for their losses. If
you dont want them to go bankrupt or the part series to discontinue, please support the manufacturer
by buying their products.though I guess I should tell myself first.
I actually designed the circuitry and PCB before I started considering the case, I just thought that I
could slap a case around it after assembling the main parts and so I did, so take this with a grain of salt
and plan carefully!
10
11
12
These were sent to a PCB fab 3 and arrived at my house 1.5 weeks later, boy they were fast. It
was the first time I have ordered PCBs instead of etching my own and the difference in quality is
tremendous, the price isnt that bad either. Normally I would buy some photosensitive PCBs and etch
them with a Hydrochloric Acid and Hydrogen Peroxide mix but after this experience, Im probably going
to be ordering PCBs from now, this should save me the worrying caused by bad traces when etching.
Also when designing PCBs another thing to note is that other than electrical and noise
requirements, you also need to make sure the PCB fab you are buying from can make them. Usually they
have a list of Design Rules which you can input to your EDA 4 software, then check for design rule
violations before saving!
3
4
13
4 ASSEMBLY PROCESS
This process is pretty straightforward, just look at your schematics/design and use some creativity
to join the pieces together. This is a breakdown on the steps I took:
14
The Main and Nixie board were assembled by reflowing SMD components onto the board and
soldering through hole components by hand. SMD reflow is a process where solder paste is applied to
the pads of components, and then components are put on the pads. The entire board is then put in a
specialized oven in which the solder paste melts and mounts the components onto the board
permanently as if soldered by hand. As daunting as it seems, this process however is easy to do at home
with a simple cooking pan or toaster, no need for that specialized oven. The key is to keep the
components time exposed to heat as small as possible to prevent damage, therefore as soon as all
solder paste melts and reflows you must remove the heat source immediately! Also to note is that
preheating the board to 90C for a while is recommended to drive off any moisture within the
components, otherwise they will explode like popcorn! (The moisture expands too quickly)
Not everyones build is the same, there are just so many options on places to mount buttons, DC
jack, switches etc. so I encourage the use of creativity in this part to build your own Divergence Meter!
However there are two sections that I think might need some inspiration/details:
15
That means before soldering any Nixie tubes you must sandwich the array! Also test the array
thoroughly and use good quality push buttons, or else you will be in a world of pain, you will have
to desolder ALL the tubes to fix any problems >.<! There is probably a better way of putting buttons
on the device but I did it this way anyways.
And also in Figure 16 you see that I have carefully wrapped the array in electrical tape (for the
love of electronics why do I not have any heatshrink?), just in case something shorts out.
16
5 PROGRAMMING
This step was done quite swiftly and the progress of coding can be followed on the GitHub commit
page:
https://github.com/waicool20/Divergence-Meter-Project/commits/master
The I2C library was written by Peter Fleury and can be easily searched up on Google for your use,
otherwise all other code is original. Here is a block diagram on how the software works:
Of course the above is overly simplified, it does not even include the code of the different modes
and display driving code. It is much better to study the code in-depth.
17
Here is some code from DivergenceMeter.c from commit fc776a2 which part of the flow diagram
is modeled on, this is specifically the timer interrupt:
/* Timer0 Interrupt Code, ran every 10ms as configured*/
ISR(TIMER0_COMPA_vect) {
for (int8_t i = 4; i >= 0; i--) {
if (bit_is_set(PINA, i+3) && buttonCount[i] < 65535) {
buttonCount[i]++;
} else {
buttonCount[i] = 0;
buttonIsPressed[i] = false;
buttonShortPressed[i] = false;
buttonLongPressed[i] = false;
}
if (buttonCount[i] > (BUTTON_LONG_PRESS_MIN_DURATION_MS / 10)) {
buttonIsPressed[i] = true;
buttonShortPressed[i] = false;
buttonLongPressed[i] = true;
} else if (buttonCount[i] > (BUTTON_SHORT_PRESS_MAX_DURATION_MS / 10)) {
buttonIsPressed[i] = true;
buttonShortPressed[i] = false;
buttonLongPressed[i] = false;
} else if (buttonCount[i] >= (BUTTON_SHORT_PRESS_MIN_DURATION_MS / 10)) {
if (settings.main[BEEP_ON_PRESS]) {
DivergenceMeter_buzz(2, 2, 1);
}
buttonIsPressed[i] = true;
buttonShortPressed[i] = true;
buttonLongPressed[i] = false;
}
}
if (buttonShortPressed[BUTTON1]) {
RNG_seed();
switch (currentMode) {
case SETTINGS_MODE:
settings_writeSettingsDS3232();
break;
case REST_MODE:
display_on();
break;
}
currentMode = currentMode < DIVERGENCE_MODE ? currentMode + 1 : CLOCK_MODE;
justEnteredMode[currentMode] = true;
} else if (buttonLongPressed[BUTTON1] && currentMode != SETTINGS_MODE) {
DivergenceMeter_switchMode(SETTINGS_MODE, false);
}
if (++clockCount > 9 && currentMode != CLOCK_SET_MODE) {
settings_readTimeDS3232();
clockCount = 0;
}
if (delayCount > 0) {
delayCount--;
}
if (buzzTimes) {
if (buzzIntervalCount++ == buzzInterval) {
buzzIntervalCount = 0;
PORTB |= (1 << SPEAKER);
if (buzzedDuration++ == buzzDuration) {
buzzedDuration = 0;
PORTB &= ~(1 << SPEAKER);
buzzTimes--;
}
}
}
if (bit_is_clear(PINA, ALARM_INT)) {
ringDuration = (ALARM_RING_M * 60);
beeps = 1;
beepIncCount = 0;
DivergenceMeter_switchMode(CLOCK_MODE, false);
display_on();
settings_clearAlarmFlagsDS3232();
}
TCNT0H = 0x00;
TCNT0L = 0x00;
}
18
As you can see from the above code (commit fc776a2) the initial seed is taken from the value of
the current value of the light sensor, second, minute, hour. This ensures that no two seeds are the same,
well at least in theory.
The randomized numbers are used in determining the numbers rolled onto the Nixie tubes,
almost like what a slot machine does, once again another flow diagram:
19
5.3 SETTINGS
Letting the AVR talk to the Real Time Clock or RTC which in our case is the DS3232 from Maxims
Integrated is actually very easy to do if you have I2C communications down. Instead of using the internal
EEPROM of our AVR, it is actually better to just store any user settings within the RAM of the DS3232,
luckily this particular chip does give us some few bytes of storage! This is great since RAM has an almost
unlimited R/W life at least compared to EEPROM and also it eliminates any human error for example
when the DS3232 is reset, all settings are reset to default, forcing the user to set any custom settings. If
it were left in EEPROM, any old settings would stick and a user thinking it would reset settings to default
will actually be left with some unknown settings.
Anyways that is the gist of what the software is supposed to do, and further study of the code should be
done before making any modifications or if you just want to understand how the device works.
The button interface was designed to be as human friendly as possible, the full How-To-Use Users
Manual can be found at:
https://github.com/waicool20/Divergence-Meter-Project/blob/master/Users%20Manual.md
The latest firmware for the Divergence Meter can be found at:
https://github.com/waicool20/Divergence-Meter-Project/tree/master/Software
20
21
7 GALLERY
22
Figure 19 Assembly!
23
24
25