Posts Tagged ‘pcb’
I become interested in Nixie tubes after I bought a Netduino and tried out the ArduiNIX. From that I decided to make my own Nixie Tube clock. My clock, besides showing the time, also shows the date, year, temperature, has an alarm, and can communicate with a PC via USART.
The clock is built on two PCB boards connected by two 10 pin IDC cables. I use stand-offs to screw the two boards together, doing that makes the clock free standing and eliminates the need to build a separate case or stand. I would have done it on one giant board but that was not feasible due to size limitations in Eagle freeware. The boards were manufactured through OSHPark.
I use four IN-17 Nixe tubes for the display. Although they are small, IN-17 tubes are cheap and easy to source through Ebay. Also I had several left over from my ArduiNIX experiment.
The tubes are multiplexed through 2 SN74141 BCD to decimal drivers. I built a version with one driver per tube but that seemed wasteful which is why I decided to multiplex them. I also tried a version where I drove the tubes with individual transistors but the switching was slow resulting in much ghosting.
The SN74141 drivers interface to the microcontroller through TLP-627 optoisolators. I chose an optoisolator to isolate the microcontroller from the tube high voltage. In theory it is cheaper to replace a $1.30 optoisolator than a $8 micro. In my case the optoisolator did not isolate enough and I ended up ruining a MCU in a high voltage probing accident.
The microcontroller is an ATMega32. It is run at 8MHz with the JTAG fuse bit disabled. I originally selected the ATMega32 because it has enough pins to drive four SN74141 tubes and perform serial I/O. In hindsight, for the two drivers I ended up with, I could have gone to a lower pin-count MCU like the ATMega328 and saved some board space. The code only uses 10% of the available 32KB of flash. It is nice to not have to worry about IOs or having to optimize the code to eke out every iota of performance and it leaves room for expansion.
The power-supply is based on the one in the ArduiNIX that I write about here.
The time, date, alarm, and temperature come from the DS3231 RTC chip on my RTC breakout board documented here. I wired up a buzzer for the alarm but I didn’t read the datasheet correctly and wired one of its pins to the input voltage. This leads to a high DC voltage across the buzzer which the datasheet warns again. I’ve fixed this in the Eagle files so it will work when order another set of boards.
The user interface is through three push-buttons on the Nixie tube board. One button is used to switch between the modes and the other two are used to increment the left and right sides.
In addition, I brought out the TX and RX pins for serial communication. I used Dean Camera’s Interrupt Driven USART guide to get the interface up and running but I haven’t done much with it since. It would be interesting to show stock prices and other numerical data from the internet on the display. There are three LEDs available for debug, alarm, and to show seconds.
The code is based around an overflow interrupt on Timer0. The interrupt calls the RTC to get the current time. From that the input pushbuttons, the alarm, and LEDs are toggled once per second.
The display() function drives the digits and uses a state machine to multiplex between them. This avoids wasting cycles in a delay loop to implement a delay between switching displays to avoid ghosting.
UpdateLeftRight() updates the variables that hold the values to write to the tubes with the correct value based on the selected mode. update_time() updates the time, date, day, and alarm based on the mode and which increment button the user is pushing. The RTC data is read through the GetTimeDateAlarmDataFromRTC() function.
I didn’t wire the outputs of the SN74141 to the correct leads on the nixie tubes, Instead I wired them based on ease of routing. remap() remaps the input to the driver to the correct value that should be written to the driver.
In addition, I have ‘anti_flashy‘ code to toggle the digits once per second through all their values per minute. This is done to avoid cathode poisoning that will eventually dim the tubes and also as a way to count the first 9 seconds of each minute. It is a nice effect. And since I don’t have the buzzer wired up, I toggle the debug LED on pin D6 when the time hour and minutes match the alarm.
Things I Learned
Be careful with the high voltage output. I’ve shocked myself a few times by touching the board accidentally in a high voltage area.
Don’t probe around the board with wires hooked up to 170V. I had a case where one of my tubes were not working and I tried powering them directly using very sloppy techniques. Something shorted out and I ended up damaging the neighboring tube, shorting the optoisolator, and burning out the microcontroller!
Use IC sockets as much as possible. Using a socket meant I could quickly replace a burnt out ATMega without having to rebuild a whole board. Not using a socket for my tubes meant I had to re-do the entire display board when I fried one of the tubes.
Read the datasheets and then read them one more time. Not reading the buzzer datasheet and just going off information from the internet meant that I wasn’t able to use the buzzer in my project.
Check your header directions and orientations of the components. Print out a paper copy of your board, place your components on them, and check the pin orientation. I put the tubes on the back of the board in one iteration of the design which meant that I had to re-do the board.
Always have a current limiting resistor in place. Testing my tubes with high vcc and no limiting resistor resulted in them flickering and glowing when off.
There is some optimization possible on the board and in the software.
For the hardware, I’ve added a switch to the board to turn off the clock at the input supply for when I’m away and of course fixed the buzzer. There are enough I/O pins open to drive a LCD display to show additional information. This with the serial I/O can give us a nice PC connected display. The MCU is only running at 8MHz but can be clocked at up to 16MHz so there are plenty of spare cycles available.
The timings for reading the RTC and driving the display can be optimized further. Initially I used delays to wait between turning off a tube and turning on its neighbor – you can see this in the commented out code in the display() function. I later took out the delays but did not check to see if I can read the RTC or multiplex the tubes less often. This will save power and free up cycles for additional features and effects.
Additional effects are possible with the tubes. Things like flickering, scrolling, fading in, fading out e.t.c
For the original inspiration and for sharing their designs:
For inspiration and samples of code for driving the DS3231 RTC chip:
All code and files are released as ‘Do what you want with it. I am not responsible for anything that happens.’
CPU board schematic:
Tube board schematic:
I made this binary clock to learn how to use Eagle and go through a real PCB ordering process. Until I made this clock, all my PCBs had been made through ExpressPCB. ExpressPCB’s PCB ordering process is very easy but their PCB design tool is not as advanced as Eagle, puts out proprietary files, and is not well used by the PCB community. In addition their PCBs are a little on the expensive side at $51+shipping for 3 boards although you do get them in 1-2 weeks.
For this project I had the PCB manufactured by BatchPCB – a service run by SparkFun. However, since then I’ve switched over to OSH Park. OSH Park has much better looking and higher quality PCBs than SparkFun. In addition they are purple and come with nice looking gold plating.
The clock layout is very simple since this was a beginner project. Most binary clocks represent the time in binary-coded-decimal (BCD) format where each digit in the time is encoded as a binary number. I chose to do a full binary clock where the entire hour (or minute, or second) is displayed in binary.
Putting the schematic together in Eagle was easy and so was laying out the PCB. I took the easy way out and used the autoroute feature to lay the traces. The autorouter isn’t very smart and I recommend against it, it routed several traces under the small 1206 parts and inserted vias where it was very easy to bridge them to pads with solder.
A few places that I screwed up was in connecting the LEDs to the IO pins and not putting in a screw down terminal connector for the input power. I randomly assigned the LEDs to various pins and this made addressing them difficult when writing the code. For the input power, I figured that I would just solder the power adapter directly to the voltage regulator pins (7805). I found out the hard way that this is not a very secure way to tie down the supply and it made re-using the supply difficult because I now had solder on the tips of the wires!
I based much of the code on a binary clock I made a while back. I set up timer1 to overflow every 100ms and increment the seconds every 10 overflows. I increment the minutes and set the number of seconds to 0 when seconds is greater than 60, and increment the hours when minutes are greater than 60. Updating the display only needs to be done after you increment the seconds. I also did a crude PWM where I toggled the LEDs on each overflow to reduce power consumption.
You can download the code here.
The schematic is not very interesting, so here is the layout. I have four buttons to set the time; the ATmega32; 6 LEDs per for the hours, minutes, and seconds; a 6 pin AVR-ISP header; and a 7805 voltage regulator. I initially thought about powering the device via USB – There are pads for a USB socket – but I never got around to it.
|18||1206 100ohm resistors||current limiting resistors for the LEDs|
|18||1206 LEDs||For the display. Mine are blue.|
|4||Momentary on Omron switches||Part name: B3F-10XX|
|4||10KOhm resistors||pull up resistors for the switches|
|1||2×3 header||AVRISP connector|
|1||7805T||5v Power regulator|
|1||USB header||USB header as alternate powersupply – not used|
|misc||capacitors||Used for AC bypass and switch debouncing|
You can download the eagle files by clicking here.
This is the DS3231 breakout board that I designed for my nixie tube clock. The DS3231 is a cool Real Time Clock (RTC) chip from Maxim that keeps track of the time, date, two alarms, and outputs the current temperature. The chip has an internal oscillator which allows it to be very precise. And, the chip can run at very low power off a battery backup and keeps time for 6-7 years when the power goes off. Sounds cool, right? However, the one drawback is that the IO pins require external pull-up resistors and many of the breakout boards (like say, the ChronoDot) on the market don’t include them. So I decided to make my own breakout board with proper pull-up resistors on all the pins, appropriate de-coupling capacitors, and a on-board battery backup. This makes the board fully independent and pluggable into any project without requiring additional components. The board is slightly taller than a quarter and works great in my nixie tube clock. In the future I should be able to port it other projects. The layout follows the datasheet and I tried to keep a nice solid ground plane under the chip. I used surface mount components to reduce board size but used larger 1206 size components for easy soldering.
In Action – Plugged into my Nixie Tube CPU board:
|Part||Value||Package||Digikey Part #|
|R1, R2, R3, R4||10k Ohm||1206||RHM10.0KFRCT-ND|
Eagle layout files:
Forget building your own board. You can get the DS3231 on a PCB for about $4.50 direct from China through Amazon. You’ll save yourself a lot of time and hassle and the pinout even looks to be Arduino compatible. Link here.
I’ve recently become interested in Nixie tubes. Nixie tubes are neon filled glass tubes that contain cathodes in various shapes, numbers being the most common, and a mesh anode. Passing a current through the cathode causes the neon gas to ionize which makes it light up.
The problem with these tubes is that they voltages of around 170V in order to ionize the gas. Fortunately, most tubes only need a few mA which makes the supply design simpler and easy to run off a wall wart.
My goal here is to create a power supply that is cheap and works well enough to power 4 IN-17 tubes for a direct drive Nixie tube clock. My design is based on the power supply used in the ArduiNIX.
A search of the web shows that their power supply design is quite common. I took their design and incorporated the suggestions Nick De Smith gives in his own Nixie tube design tutorial. Nick’s supply is nice but it is expensive. However, his suggestions are useful. I added a solid ground plane except around the inductor and used multiple vias to connect to ground for low resistance paths. I used large traces and expanded them to a plane wherever possible to further reduce resistance. In addition I added capacitors to the input (C5, C6) and output (C7) to help smooth ripples. I put the components as close together as possible and also changed the output diode to a UF4004. Why switch the diode? Because it was cheaper.
So is the supply cheap? The total component cost is $7.75. Is it possible to make it even cheaper? Yes. You can directly solder your wires to the board and omit the terminal connectors (J1, J3 – $1.64). You can also omit the input/output stabilizing capacitors (C5, C6, C7) and the IC socket for the 555 timer and save another $0.53. This brings the total down to $5.58.
The board size is 1.8 x 1.9 inches. Assuming that you live in the US and pay $ 1.67/sq inch for your PCBs, you can build one for about $13.50 (or $11.29 with reduced components). And, it only gets cheaper if you make more.
How Does it Work?
The supply uses a traditional switch mode topology. The 555 timer switches inductor L1 to ground and diode D2 through transistor Q10. L1 charges up when it is connected to ground and then acts like a current source to force charge through D2 when Q10 is off. This charge build up on capacitor C1 provides the desired output voltage. Potentiometer R19 and transistor Q5 form a feedback loop that control the 555 timer’s switching frequency.
The supply takes a while to stabilize. In addition to switching noise, the supply output drops about 5-7 volts over the span of a few minutes after you turn it on. It stabilizes soon afterwards. In my tests, if I set the supply to 175v with a 100kOhm load, it stabilizes around 168v and will stay that way for several days. Fortunately Nixie tubes are forgiving enough
that this supply is adequate.
Construction and Usage:
Constructing the supply is simple. Solder the indicated components into their proper places on the board. It should take about 30 mins to assemble. Once it is assembled, connect yourinput power supply to header J1 and a multimeter to the output header – J3. The input supply should be around 9v. Plug in the input power supply. THIS INVOLVES HIGH VOLTAGES THAT CAN KILL YOU, SO DO NOT TOUCH THE HIGH VOLTAGE PORTIONS OF THE BOARD. Look at your multimeter – it should read somewhere between 90V and 200V. Adjust potentiometer R10 until you reach your desired voltage. As you do this, pass your hand over the supply – you should feel no heat. If it feels hot, or if the output voltage is low or wildly oscillating then you have a short or misplaced component. CAUTION – Unplug the board before you check your work.
I’ve saved the parts list at Mouser as a project titled ‘HV Supply’:
The supply was designed using Eagle. You can download the board and schematic files here:
Update 7/4/2013: Board and schematic files without a ground plane to avoid the issue mentioned in the comments: