You can never have too many clocks based on obsolete display technologies ...
To make the experience fit your profile, pick a username and tell us what interests you.
We found and based on your interests.
VFD Clock.zipAtmega328P VFD Clock Firmwarex-zip-compressed - 5.33 kB - 10/08/2019 at 15:05 |
|
|
mainbd.schController Board Eagle Schematicsch - 1.17 MB - 10/08/2019 at 15:02 |
|
|
mainbd_2019-09-26.zipController Board Gerber Filesx-zip-compressed - 225.47 kB - 10/08/2019 at 15:02 |
|
|
IV-21VFDsub_2019-02-08.zipIV-21 Tube Riser Board Gerber Filesx-zip-compressed - 59.70 kB - 10/08/2019 at 15:02 |
|
|
mainbd.brdController Board Eagle Filebrd - 160.67 kB - 10/08/2019 at 15:02 |
|
Just a quick video outlining some software improvements I've made such as fixing that stuck segment bug and adding brightness adjustment. Still need to figure out how to activate and set alarms using the user interface without making it cumbersome.
Here's a quick demo and assembly video that recaps the hardware side of things:
Ok, with that out of the way we'll now go into some more detail about the software works. The software has a few main tasks going on that all have to run simultaneously. First the atmega328P has to generate the higher voltage for the tube and it does this using timer1 running at ~62.5kHz (adjusting the duty from 50-95% will boost the open circuit voltage from ~30-120V, respectively). Luckily the load (the vfd tube) wont really change drastically during operation so I just run the boost converter open loop, although closing the loop would be simple enough by adding some code to the interrupt.
Additionally we need a method to automatically update the multiplexing to all the digits. This is done in the timer2 interrupt which is configured to fire off at 2kHz. In this interrupt we do a couple of things. First off, similar to my word and discrete 8 digit LED clocks, the interrupt will step though one digit each iteration and set the correct segments to send. Data is sent serially via the SPI peripheral so that we don't have to waste time manually bit-banging pins to send the required 20 bits to update the next digit. Actually an odd aside, since the mcu only deals in 8 bit spi packets at a time we end up having to send 3 bytes (24 bits) and the first 4 bits just end up being discarded.
So now we have high voltage and data going to the tube driver. All we have left to do is read button inputs, talk to the real time clock and make fun beeps/boops when a button is pressed. I originally wanted to generate the beeps of adjustable frequency using timer0 but found out that's what the arduino library uses to generate delays and messing with that would be slightly annoying. So instead I just look for a buzzer flag that any function can set to control the buzzer and if it's set then in the interrupt it toggles the buzzer pin. Since it can only toggle it once per interrupt period then the frequency ends up being half that of the interrupt which is 1kHz (a suitably loud but not too annoying frequency for a beep).
The real time clock is also controlled via SPI, but I was a bit lazy on this one and just included the library file I wrote before for bit-banging the signalling (I definitely could have shared the data and clock with the max6921 driver chip though and just given the rtc a separate chip select). We have lots of free pins so why not.
For the button pins, I thought of having a separate pin change interrupt to read them, but instead I simply reused the timer interrupt to poll the buttons at 2kHz and set global flags which any other function can use to react to button presses. Additionally the button flags are also read during the buzzer code in the interrupt to beep when any button is pressed for a bit of user feedback.
So that's about everything in terms of software. There is one major bug I've found where segment A of digit 0 always seems to be set and I've tracked it down to the display mux code in the interrupt so I'll fix that once I get the time.
To start off, thanks to JLCPCB for sponsoring this project as well as providing pcbs to get the ball rolling. JLCPCB Prototype for $2 (Any Color): https://jlcpcb.com
The hardware requirements of this project are fairly simple: two buttons for setting time, a small speaker for delightful beeps and possibly to add alarm functionality in the future, onboard software controllable "high voltage" boost converter to generate ~30-70V from 5V, USB micro power input, battery backed real time clock, and software controllable dc filament drive/driver blanking. I've pretty much done an identical clock in the past using a larger IV-18 tube with the pcb done on protoboard using hand wiring but this time I wanted something that would look more professional.
The design consists of two boards. The first is the main board that contains all the electronics to keep time, generate the necessary tube drive voltage, and control all the multiplexed segments for the display. I wanted to keep the board small, single sided for easy assembly, and yet not go crazy with microscopic surface mount components. The digital parts are for the most part surface mount, but the boost converter components are through hole and suitably spaced for ease of replacement or sourcing suitable alternatives. All the low voltage stuff is condensed to the left hand side, while the higher voltage goodies lie on the right side with the tube header on the very end. I opted to just do dc filament drive as my past experience with the brightness gradient due to dc wasn't bad (especially for small tubes like these) compared to the complication that moving to ac drive would add. Here's the circuit and layout I settled on:
The second board is just a wiring pass through to allow the vfd to be mounted above the main board, and connects via a standard 0.1" pin header and female socket for ease of replacement (just in case the tube burns out or meets an unfortunate end after a rough bump or drop). Here's what it looks like:
I actually had an interesting time figuring out an easy way to calculate the positions of the radial pads. Since eagle does everything in cartesian coordinates making a nice evenly spaced circular arrangement of pads is easier said than done. I'm not familiar with eagle's scripting language yet, so I ended up manually setting the coordinates of each pad, but to make my life easier I wrote up a quick excel spreadsheet to calculate the x and y values for you if you plug in the desired number of pins, radius and angular separation. Hah, and I often hear people say they never use trig after high school, but those equations came in handy for me now! Then all you need to do is plug in the output x and y coordinates into the pad position settings in eagle and they are perfectly aligned! (Caveat: the calculations sometime spit out negative angles and positions in the wrong quadrant, but some common sense of signs when transferring the coordinates will fix those issues quick enough)
This "calculator" ended up being super useful and I will definitely end up using it in future projects with various tubes I intend to use.
After receiving the boards from JLCPCB I quickly assembled them.
It certainly looks the part! There were a few small problems with the circuit though. I accidentally miswired c6 (the large electrolytic cap) to the wrong point (just after the switching transistor instead of the 5V input DOH!) so the boost converter wasn't able to ... erm boost. I cut the trace and off she went, easily generating over 100V off the 5V input. The second issue I ran across is that I wired the blanking input of the max6921 hv driver chip to the atmega's miso pin. This didn't seem like it'd be an issue, but apparently when the atmega is configured as a master SPI device the mico pin is hardwired to be an input and cannot be reconfigured to use as an output. Bummer, but I lifted the max6921 pin and ran a bodge wire the the open A1 output pin of the atmega and all...
Read more »
Create an account to leave a comment. Already have an account? Log In.
You can try adding a large electrolytic cap (try 100uF, making sure to get polarity right) in parallel to the ceramic cap right next to the rtc chip. The boost converter is probably creating enough noise to disrupt the rtc's supply and cause it to count faster than it should.
Hello, please help with programming the atmel328. Does the bootloader have to be loaded or not? How should the fuses be set, I set them wrong and the atmel328 is blocked. Thanks Pavel
I wanted to build one of these but have run into 2 stumbling blocks. The first is/was figuring out how to program/reprogram the processor. I may have that figured out now... maybe. The second is determining which wire is which on the IV-21 tube. I see there is a mark on the pcb, and that there is some extra space between that pin and the one adjacent but... I don't see any obvious mark on the wires or the tube and there is no obvious spacing difference. A little guidance on figuring out the wires would help me out alot. Thanks.
It is a little late but the pinout can be found by finding the short lead. That is pin 19. The next pin clockwise would be 1 thru 18
Here is a translated datasheet of the IV-21
https://drive.google.com/file/d/19pHtBFc515MrxD8HwFjyqsK27nt_Oiih/view?usp=sharing
I've got the VFD's coming to me from eBay and the PCB's are ordered through JLCPCB but the bill of materials is still a drudge. You say that it's included in your downloads but mostly the parts list is incomplete at least as far as I can tell. It sure would help if you could flesh out the BOM with part numbers and source. Hopefully I can figure it out. Usually in situations where parts aren't well defined I end up ordering the wrong ones on the first go around and end up having to revisit a few of the parts. Anyway, great design! I love it!
Sorry, I meant to write a BOM but have been super busy. All the component values are marked in the schematic and nothing is super critical for the passives (I got all mine from pulls or ebay). Chips are marked with part numbers as well, a quick google search will net you links to common suppliers (I got mine as free samples direct from the manufacturers). The only changes I made when assembling the circuit was the boost inductor was increased to ~4mH and the filament resistor was selected to be 82ohms by experimentation. Other than those changes you should be fine following the schematic. If there's anything specific you have trouble finding I'd be happy to help.
O.K. Thanks for detailing those two parts. Once the PCB's get here I should be able to figure other details like part footprints so that I order the right sizes. I notice that in your photos of the working clock you didn't ever populate the two crystal capacitors C2 and C3 for the ATMega. Does it work just as well without them? Should I leave them out or put them in? Also, sometimes mechanical things like switches can be a little bit difficult to source so that they match the footprint of the PCB. Can you maybe provide some more detail about the push button switches that you used? Thanks for helping.
C2 and C3 are 22pF loading caps to properly stabilize the 16MHz crystal. From a technical standpoint I really should've soldered them in, but even without them I've had the clock running for months without issue. Now if I were using the atmega to count and keep track of time it would be absolutely critical to include them to ensure that it would be as accurate as possible, however nothing the micro is currently doing is very timing critical. It's up to you though if you want to add them or not. As for the switches they are a standard footprint for right angle tacts, unfortunately those were desoldered from some random junk boards I had so I don't have part numbers for them.
Could you offer any hints as how to program the processor?
Do you have another arduino to act as an icsp programmer? (Or a cheap USBASP programmer will work as well).
All - I've uploaded all the design files to make your own boards and program the microcontroller. Feel free to replicate/modify but please give attribution to me (sjm4306) and link this project page if you do so.
I uploaded both gerber zips to JLCPCB and got the following replies. I don't know how to order boards so I accepted all the defaults. For the tube board:
"Per shows, the topper trace will be cut off by outline apparently,is it normal to move?"
The image sent shows the outside trace cut to 1/2 its width.
For the main board: "The space between the traces are not enough when we make it. For Single&Double Layer PCB, the minimum spacing is 5 mil;". The image shows the traces around the holes for the tube board header too close to each other and too close to the holes.
They offered to cancel and refund as they cannot make boards as is. I accepted.
That probably means sjm4306 will need to change the schematic so that it fits properly. To sjm4306: Did you use EasyEda? If so, did you do the Design Rule Check (DRC)? (It comes up automatically in EasyEDA when you export to Gerber)
Also anxious for the design files - my IV-21's arrived today!
Hey
Really cool project. Any updates on posting the files ? Very keen to make one. Hopefully you'll put the source-code and PCB design files up so that I can make some tweaks ? Thanks !
Are the gerber files and the code available anywhere for anyone who wants to build one?
I like your clock but I have never used https://jlcpcb.com . How to I order these pcbs? Is there a project number that I can refer to at jlcpcb to get the pcbs or do I have to copy and send in your schemo's or ??? Also will you be posting a parts list/where to order etc. I have already ordered the IV-21 VFD.
I'll be posting the zip folder containing the pcb gerbers ready to order once I've fixed a few errors. I'll also upload the firmware to this project page.
When you post your zip, could you include suppliers stock numbers or links to components to purchase. I have started to look at Mouser and Digikey and there are an overwhelming array of choices to select from. For instance it looks like pcb
uses the 3904 in both thru hole and surface mount. Even the clock chip seems to have a bunch of varieties. I want to make sure that I get the exact parts to fit the pcb. Thanks for all of your efforts.
Nice project! The gradient in brightness is most likely caused by having a DC supply for the filament. That way you get a voltage difference between the left and right , this adds up to your anode/grid supply. Normally the filament is AC fed from a transformer which also generates the 'high' voltage for the anode/grid. You could try a few turns of wire around the coil of your boost converter and use that for filament supply.
In v2.0 I was originally planning on driving a motor h-bridge chip to modulate either square or pseudo-sine via a look up table from the micro to drive the filament with ac but that doesn't seem necessary now. After debugging to fix a few issues with the software I've been able to add a small amount of compensation in software by adjusting the duty of the grids to look roughly equal in brightness across the tube.
I have two of these tubes in my stash of stuff and I didn't know what to do with them, but this project gives me hope!
Nice job, love the look. And that riser card was a nice touch. I'm writing this up for the blog, hopefully it'll publish soon. And Mike included this in the newsletter this week, so look out for that.
Thanks, glad you like it. I'll be proud to have this little guy sitting on my desk at work. The nixie clock I built will have to be relegated to my work bench.
Beautiful work on the right-angle header for the tube mounting arm. Looks spectacular!
Thanks, I probably spent more time on that bit than I did for the entire main board design!
Become a member to follow this project and never miss any updates
I have successfully replicated this project, but there is a problem: the time is inaccurate. After a period of time, the displayed time is nearly 5 minutes faster than the actual time. In addition to manual adjustment, I wonder if there is a better way to solve this problem?