Making of - The Divergence Meter Project
Short Description
A simple narrative/technical documentation on the process of creating the Divergence Meter. This includes design cons...
Description
Making of:
The Divergence Meter Project An anime inspired Nixie Tube Clock
1
TABLE OF CONTENTS Table of Contents .......................................................................................................................................... 2 1
Inspiration ............................................................................................................................................. 3
2
Design Process - Planning ..................................................................................................................... 4
3
Design Process – Circuitry and PCB ....................................................................................................... 6
4
5
3.1
Schematic Design .......................................................................................................................... 7
3.2
PCB Design .................................................................................................................................. 12
Assembly Process ................................................................................................................................ 14 4.1
Structure – How It’s Held Together ............................................................................................ 15
4.2
Structure – Button Array ............................................................................................................. 16
Programming ...................................................................................................................................... 17 5.1
Random Number Generator and World Line Rolling .................................................................. 19
5.2
Display Driving ............................................................................................................................ 20
5.3
Settings........................................................................................................................................ 20
6
Distribution And Documentation........................................................................................................ 21
7
Gallery ................................................................................................................................................. 22
2
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” we’re talking about is nothing like the device itself presented in the visual novel/anime. Like seriously, it doesn’t…. see?
Top left: As seen within the Visual Novel/Anime Top right: Official “commercial product” 2% true to the original Right: And finally my version 95% true to the original
1
Japanese Animations
3
2 DESIGN PROCESS - PLANNING The initial planning for the Divergence Meter ran just like any other project. I first write down what features and functionality I wanted out of the project, I also write down any limitations that the project might have. So to quote my blog post on this topic: 1.
Additional Features:
•
5 switches possible! Could be less if you tweak the software
•
Buzzer/Speaker output :D hurray for alarms in the morning
•
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.
•
Interrupt based instead of Polling to conserve even more battery
•
Uses the larger but cheaper and more available version of the HV5622
•
Integrated switching power supply instead of a bought module
•
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
•
Miku silhouette included
Limitations:
•
Can only use the DS3232 RTC and not the DS1307
Anyways that’s 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 I’ve 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 couldn’t 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 can’t thank them 2
A Chinese E-commerce platform akin to EBay
4
enough for that and hope that enough people build Divergence Meter’s to cover for their “losses”. 🙈🙈 If you don’t 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!
5
3 DESIGN PROCESS – CIRCUITRY AND PCB The tools I used were DipTrace, pen and paper, my brain, the internet and hell lots of datasheets, I find that during electronics design 90% of the time you will be reading datasheets and not actually drawing anything. All datasheets will be linked in at the end. The process was simple, draw a schematic of the system and layout a PCB accordingly. Can’t be harder than that right? As a newbie to SMD design (my first in fact) it is quite the big step to take. Here I present to you the Block Diagram of how the system is composed:
6
3.1 SCHEMATIC DESIGN I read the datasheets and calculated component values and carefully connected the pins of each component. A nice feature I find in DipTrace is the Hierarchy Block functionality which allows you to put a “module” on a single page and on another page treat it as a single component. This is good for designing and use within the program, unfortunately the PDF export is just terrible and hard to read. The board is comprised of 2 boards, the Main Board and the Nixie board. The Main Board contains most of the logic and power electronics while the Nixie Board is the PCB that contains the shift registers and is the one that the Nixie tubes will mount to. Fig.1-7 are Main Board schematics while Fig.8 is the whole of the Nixie Board
Figure 1 "Main" Microcontroller Schematic
7
Figure 2 Button Block
Figure 4 Real Time Clock Block
Figure 3 Speaker Block
8
Figure 5 Low Voltage DC-DC Converter Block
Figure 6 High Voltage DC-DC Converter Block
9
Figure 7 Light Sensor Block
Figure 8 Nixie Board Connector Block: Connects the Main Board to the Nixie Board
10
11
Figure 9 Nixie Board Schematic
3.2 PCB DESIGN Now this is the part that I think was the hardest but also the most fun, here comes the PCB layout! My layout skills aren’t the best and if you saw any layouts of the boards I have designed in the past, the pros would probably be laughing their pants off >.< Back to reading schematics again! This time not looking at the component values but the dimension and PCB layout section! Thankfully Texas Instruments is an awesome manufacturer (I mean it!) and provides some optimal/recommended layouts, and taking those as reference I soon finished designing the PCB. The things that I mainly thought of were: 1. Dimension of pads especially the inductors to make the PCB more forgiving of various inductors from different manufacturers, mainly for other people who plan on making the device. 2. Thermal dissipation, I put some extra copper under the DC-DC converters just in case. 3. Physical location of batteries, connectors and sensors. 4. IMPORTANT: Noise prevention and traditional high speed analog design, the DC-DC converters are especially sensitive to noise, I also made sure to separate the digital and analog signals/ground. I followed a lot of guidelines from the datasheets and online technical documents. The end result is two nicely designed PCBs. Though there are definitely still some places that can be improved and I may work on those in a future update.
Figure 10 Main Board 3D Render
Figure 11 Nixie Board 3D Render
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 isn’t 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, I’m 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!
Figure 12 Main Board
Figure 13 Nixie Board
3 4
Short for PCB fabricator Electronic Design Automation
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 90°C 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 everyone’s 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:
4.1 STRUCTURE – HOW IT’S HELD TOGETHER The way the device is held together is that there are two groups of hex nuts. The first is the “inner” group, these hex nuts cannot be seen from the outside and are solely used for keeping the breadboard, Nixie Board and Main Board together. You can see that the Main and Nixie Boards have five silver rings, the hex nuts go through these rings and connect them together, they also serve as a path for ground, so I recommend using metal nuts instead of nylon ones. As you can see in Figure 14, the top hex nut is glued to the bread board with two-part epoxy and the other layers are subsequently screwed on. Figure 14 “Inner” set
The second is the “outer” group, some parts of these hex nuts can be seen from the outside and is used to fix the steel casing to the inner “sandwiched” parts. Once again it is glued onto some slightly sanded steel with two-part epoxy. It connected to ground via the DC jack.
Figure 15 “Outer” set
The dimensions of the steel plates used are as follows: Length Width Qty 7 ¼ (184.15) 1 ½ (38.1) 2 2 ⅛ (53.975) 1 ½ (38.1) 2 7 ½ (190.5) 2 ¼ (57.15) 1 Dimensions are in: Inches (Millimeters)
15
4.2 STRUCTURE – BUTTON ARRAY Now the buttons are quite tricky, there are five buttons in total and these five were soldered onto a small piece of scrap breadboard, unfortunately I don’t have a photo when I was assembling this crucial part. However I do have a photo and simple diagram:
Figure 16 That red part is actually the button array!
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 >.= 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 1) ^ randa)); }
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.2 DISPLAY DRIVING Some code is written for aid in sending different signals to the shift registers, this includes sending bits, latching and master off/on. The display is driven by sending different combinations of 1s and 0s to the shift registers which in turn drive the Nixie tubes. The code is pretty straightforward and easy to understand with some basic understanding on switch-case statements. Brightness control is done by a timer module within the AVR which quickly switches the Shift Registers outputs via the Blanking pin with PWM 5, with adaptive brightness on (Level 10), the PWM duty cycle is derived from the light sensor directly, otherwise some predefined values are used. The tubes values are stored within a struct for ease of use, it is much easier to copy a struct than an array in this case. An array stores eight variables ranging from 0-9, two other arrays with the same size store a Boolean value for the decimal points of each tube. Because of this the end result is similar to Binary Coded Decimals or BCD, therefore some BCD math in some sections of the code must be used like incrementing the value of each tube.
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 User’s 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
5
Pulse Width Modulation
20
6 DISTRIBUTION AND DOCUMENTATION You may have noticed already that a majority of links I have given to you are from GitHub, and that is because the project files of this project are hosted on GitHub: https://github.com/waicool20/Divergence-Meter-Project And Yes! As said before this project is Open Source and Open Hardware, though of course I did put a license of them with GPLv3 for the software and TAPR OHL for the hardware, don’t worry though! You are still free to use and modify any of the files, just make sure you follow the terms of the licenses, go google them up, there are tons of sites simplifying the terms. As for documentation, this document is one of them, there are some more on GitHub and also on my blog at: https://www.waicool20.com I have written a lot during the progress of building the device and it may or may not help/interest you, so go on take a look! Otherwise I also post on other projects, so if you liked this one you may like the others! Hehe shameless advertisement🙈🙈
21
7 GALLERY
Figure 18 Early Stages
Figure 17 Early Stages 2
22
Figure 19 Assembly!
Figure 20 Case done!
23
Figure 22 Almost done!
Figure 21 There we go! It's complete!
24
- End of Document You may stop reading now!
Divergence Meter Project by waicool20 And yes you just saw my name
25
View more...
Comments