Nixie tube clock rev 2 design solutions - Page 1
Forum section: electronics / projects

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: June 24, 2013, 10:17:39 am
content: hello, im currently making a rev two board for my nixie tube and i was wondering weather or not it will it will be better to have a switch mode regulator to regulate 5V than to have a linear regulator. this is for several reasons:1, the input voltage is 12V which has to be dropped down to 5V just under 1A, i currently have a 5V linear regulator in there and it gets quite hot as it is a very confined space with no air flow (about 7W heat dissipation)2, due to the confined space and the linear regulator releasing 7W it heats up over 60oC very quickly and as i intend to use it as a clock so it is on all the time its not the best idea.3, there is already a smps for the 155V supply for the nixie tubes so another one wont hurt?now currently in the Rev 1 it consists of fully through hole components but in rev 2 i have changed alot of the components to be SMT so there is alot of free room in the case which i could fit a smt smps controller inside.no only problem is i dont want it making alot of noise so if i do have a smps what sort of frequency would i need to either eliminate the noise (out of human hearing range) or so it is quiet enough so that i cant hear it about 30-50cm away.could anyone give there feedback on this idea and weather its a good way to go? if so could you suggest a smps controller as i don't know which one to use, i was thinking something like an LT1533.your thoughts?

author: digsys
author_rank: Unknown
timestamp: June 24, 2013, 01:38:36 pm
content: I'd be a HECK of a lot less work, and likely cheaper, to just use an off-the-shelf DC-DC converter module. There are 100s available.Something like RECOM Power R-78B5.0-1.5 5v-1.5A for ~ $12-14. TI (Power Trends), Murata, Traco, XP-Power and MANY more out there.IF you HAVE to make it yourself, study the application circuits / layouts given (usuallyalwaysuse S/Mount), keep it tight, watchground loops and everything will be sweet. DC-DC converters are a well aged technology now, so you should'nt have any issues.

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: June 24, 2013, 01:54:40 pm
content: how do these DC-DC converters work? ive got a couple in my draws il check what voltages they do nowedit:i have some aimtec ones but none that do 12V to 5V and all of them are under 400mai can do 5-12,5-24,12-24,24-15 and 5-15...

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: June 24, 2013, 02:10:54 pm
content: also how much heat would a DC-DC converter emit?

author: c4757p
author_rank: Super Contributor
timestamp: June 24, 2013, 02:15:26 pm
content: Second question: Not much. At 1A you'll need a small heat sink. It depends entirely on efficiency.

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: June 24, 2013, 02:24:03 pm
content: hmmm ok, there may not be enough space for a heatsink on the inside, the dc-dc converter on its own its too big at 17.5mm :/ and putting it onto its side when its 8.5mm might be a bit of a push, but will probably be fine if i cut a slot in the upper board.the case that i have currently holds two boards one on top of the other to hold the circuitry.the case is made out of sheet aluminium and i currently have the regulator against it which helps but not enough, hence why i was looking for a smt solution that is quite thin(may have forgotten to say that in original post) but this is also why i asked if a smps would be ok because smt chips are quite thin and so are the inductors (ish).

author: c4757p
author_rank: Super Contributor
timestamp: June 24, 2013, 02:32:19 pm
content: If you can find one with around 90% efficiency or more, you may be able to run without a heat sink. It will be warm but shouldn't overheat. Make sure to test it, though.

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: June 24, 2013, 02:45:47 pm
content: what about this one:http://uk.rs-online.com/web/p/buck-converters/5333973/its also sugesting a flat heatsink to go with it which wont increase the overall height:http://uk.rs-online.com/web/p/heatsinks/6988111/?origin=PSF_438335|accedit:and because the ic is about 4.5mm tall i could chop the side flaps on that heatsink to make it a bit flatter which would make it a lower profile

author: c4757p
author_rank: Super Contributor
timestamp: June 24, 2013, 02:52:49 pm
content: A quick run through the calculations gives me a worst case 60C rise at 12V -> 5V, 1A out. You could do that without a heatsink, but ideally you shouldn't. Still, it is worst case - read through the whole datasheet and do the calculations more carefully than some guy sitting in a waiting room, and you may find better. I think you could use that without a heat sink if you design with care.

author: c4757p
author_rank: Super Contributor
timestamp: June 24, 2013, 02:54:07 pm
content: Don't forget your inductor and capacitors. Low-profile, high-current inductors tend to be a bit expensive.

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: June 24, 2013, 02:58:42 pm
content: http://uk.rs-online.com/mobile/p/wire-wound-surface-mount-inductors/7296508/Or would i need a higher current one?Such as thishttp://uk.rs-online.com/mobile/p/wire-wound-surface-mount-inductors/7271903/

author: c4757p
author_rank: Super Contributor
timestamp: June 24, 2013, 03:02:07 pm
content: Run through all the calculations. The TI switcher datasheets always make it nice and straightforward. Find your worst case peak current and give yourself 20% margin.

author: digsys
author_rank: Unknown
timestamp: June 24, 2013, 03:06:07 pm
content: Quote from: carbon dude oxideThe self-contained modules, like the one I suggested, do not need ANY heatsinking. iehttp://www.farnell.com/datasheets/526429.pdfAND if you believe you'll be pushing it, just make larger PCB pads, simple as that. Nothing to mess with.

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: June 24, 2013, 03:11:22 pm
content: Ok i shall work them out and have a look on rs, i have an order from them which i can tag it onto

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: June 24, 2013, 03:56:11 pm
content: I was having a quick look and i found this 14A smt inductor is that enough of a margin?(but im a bit suspicious if thats peak as i currently cant see a datasheet because im on my mobile currently.http://uk.rs-online.com/mobile/p/wire-wound-surface-mount-inductors/7701132/

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: June 24, 2013, 04:25:16 pm
content: ok ive had a look and found that it has a max of 6.26 RMS current but i was also looking on the rs website and it says the maximum resonate frequency is 100kHz does that mean it can't be used with frequency over 100kHz?

author: Harvs
author_rank: Super Contributor
timestamp: June 25, 2013, 01:27:11 am
content: If you want to get this project finished (i.e. not turn the power supply into a project in itself), then I think digsys has given you some really good advice.Building SMPS, whilst extremely common and proven tech these days, still requires quite a lot of knowledge to do well. And even then, requires a fair bit of time and testing to build a good one.Where as they are so cheap to buy as a module, that unless I have some odd requirement these days I'll just grab one off the shelf. If it's a hobby project, you can often get away with one of the ridiculously cheap modules off eBay (YMMV, but as long as you don't push their limits often they'll work alright.)

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: June 25, 2013, 09:09:12 am
content: i dont mind spending alot of time on it, i have plenty of time to spare, i am looking into the Dc-DC modules but alot of them are too thick :/

author: Harvs
author_rank: Super Contributor
timestamp: June 25, 2013, 09:23:33 am
content: Too think?http://www.ebay.com/itm/1pcs-DC-DC-Buck-Converter-Step-Down-Module-LM2596-Power-Supply-Output-1-23V-30V-/251066005460?pt=LH_DefaultDomain_0&hash=item3a74b337d4ok I just saw your posts about low profile.Another option would be just to get something like that board from ebay and replace the caps and inductor with equivalent lower profile items if they're too big. Obviously the trim-pot can just be replaced by a couple of fixed SMD resistors for a set voltage.

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: June 25, 2013, 10:32:35 am
content: yea i have a load of 0805 smd resistors which i could add into there, il have to look into some caps for it, i could also have a cut out for this board to slot into then use some brackets or soldered jump cables to the main board so that this board is in line with the main board.i would defiantly like to go through the proses of designing my own smps mainly so i know how and so that i can say ive done it

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: June 25, 2013, 10:45:25 am
content: i will probably go with that module so i shall put the designing of my own off for a while. ok the next part that i would like to have a look at is the control of the tubes.in rev 1 i use some original k155ID1 nixie drivers (which i did statically shock a couple of) and 2 of them were controlled by an 8 bit port expander (used 4 lines to make a BCD line for the k155ID1 chips) for the port expander i used a PCF8574 which i controlled via a breadboard arduino using I2C. what i noticed is that after an extended period of time the clock would freeze on a random time which i am assuming is because the I2C bus locked high/low (don't have a oscilloscope to test) and i was wondering if there is a better way of controling them.current what i have planed is to use a BCD to decimal CMOS chip or a 10 port expander which are connected to some high voltage transistors (MPSA92) which will pull each cathode of the tube low making the digit light up, now either way i need some form of port expansion for my arduino chip (which i may reprogram to make it just an AVR so there is no bootload time/minimal bootime)my question is what bus would be best for this and most stable and would it be better to have a port expander straight onto the transistors or would it be better to have them like i did originaly putting out 2 BCD signals then putting it into a dedicated BCD to Decimal converter and then driving the transistors?or is there a better way of doing this, if there is please let me know) such as multiplexing?

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: June 26, 2013, 01:52:08 pm
content: also another question, if I already have a pre purchased smps nixie power module which comes on a separate board in its own right would i be able to copy the layout and design onto my main board and mount the same circuit onto the main board instead of it being an externaly attached board?i Have the schematic for the board and most of the measurements and the exact layout of the board so instead of mounting this secondary board onto the main could i print it onto the main and solder the components onto the main board? or would this messup the SMPS as i i know now layout highly effects the power supply.

author: c4757p
author_rank: Super Contributor
timestamp: June 26, 2013, 02:20:33 pm
content: Quote from: carbon dude oxide on June 25, 2013, 10:45:25 am74HC595shift registers (think of them as SPI port expanders - connect DS(pin 14) to MOSI, STCP(pin 12) to #CS, SHCP(pin 11) to SCK, #OE(pin 13) to ground and #MR(pin 10) to VCC) are absolutely dirt cheap. You can chain them (Q7S(pin 9) of one into DS(pin 14) of the next, everything else connected together) to get whatever length shift register you want. I don't see any reason to use the more "proper" port expanders unless you also need input as well as output, as they cost about twice as much.You'd get a "cleaner" logic layout on the board by using them to output pairs of 4-bit BCD values, and those into BCD decoders (since each 595 has 8 bits and each tube requires 10 control signals), but I'd rather just use the 595s and handle the bit mapping in software. 595s + BCD decoders will require more chips, and the BCD decoders probably cost more because they're not as common.Quote from: carbon dude oxide on June 26, 2013, 01:52:08 pmJust make sure you copy carefully. You don't need to match the layout to the tenth of a millimeter - most SMPSs that aren't super-high-efficiency aren'tthatlayout-critical - but if you get a connection wrong you could be sticking 200V up something that really shouldn't have it, or worse, running it open-loop - god knows what voltage it will put out when it can't see its output.What about leaving that spot on your PCB blank and mounting the external PSU right on top? You might be able to remove connectors on it and replace them with pin strips so you have a nice plug-in module.

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: June 26, 2013, 03:03:23 pm
content: Quotei have the module mounted in rev 1 but its in an awkward place but i know where i can move it too if it was a few mill smaller and if it didn't have the 7805 on it as well (which i dont need so i can remove) it would fit nicely onto the main board itself.i do have a schematic that came with the module so i will make sure to carefully copy itQuote from: c4757p on June 26, 2013, 02:20:33 pmthis is how i had it before but using I2c port expandersits nice to know that i did something someone else would do but just with a different bus. i will look into the shift registers and figure out how to use them in a chain

author: c4757p
author_rank: Super Contributor
timestamp: June 26, 2013, 03:16:48 pm
content: Quote from: carbon dude oxide on June 26, 2013, 03:03:23 pmForget my awkward description, here's a nice picture I painted for you.

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: June 26, 2013, 03:21:48 pm
content: Quote from: c4757p on June 26, 2013, 03:16:48 pmthat is a nice pictureok so with my understanding of shift registers each time you send a byte into the register it bumps it along one so for example:original outputs 0= low 1 = high00010001if i then send a byte to the register it will come out like this:10001000and just delete the last byte unless if another register is connected to Q7S where it would then carry onto the next register, so for this to work with a chain you send x amount of bytes to match the x amount of outputs and then using the latch function to lock the outputs into the byte that corresponds to it after sending the x amount of bytes into it?

author: c4757p
author_rank: Super Contributor
timestamp: June 26, 2013, 03:26:17 pm
content: You are correct. No need to overthink it, though, they really are perfectly SPI-compatible when you hook them up like that. Just blast it your data, MSB-first (the last register the chain will be the most significantbyte). Pseudocode:Code:initialize_spi (mode=msb_first); // There are other settings, just use the defaultsdata = {1, 2, 3};// To send datapin_cs = 0;for (int i = 0; i < n; ++i) {wait_for_spi ();spi_transmit (data);}wait_for_spi ();pin_cs = 1;The registers will contain: (top of chain) 00000011, 00000010, 00000001 (bottom of chain) (Q7 ... Q0).

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: June 26, 2013, 03:29:52 pm
content: i see, thanks aloti shall get onto the designing soonis spi a more reliable bus that I2c?and do i need any pull up/down resistors / sheild lines ect with it as it is going to be going down a 5 inch board

author: c4757p
author_rank: Super Contributor
timestamp: June 26, 2013, 03:34:06 pm
content: More reliable? No. It works equally well. I find it easier to design with, personally, and it can run at much higher speeds.You don'tneedany resistors. If your MCU is programmed via SPI (like AVRs), I'd recommend putting a weak pullup resistor (~100k) on the CS line, otherwise when it goes high impedance when the chip is in programming mode, the 595s may read out the code being sent to the MCU and your tubes will go crazy (if the HV PSU is turned on and they pick up noise on CS).You don't need high speeds, so if there's a problem with signal integrity, just slow down the data rate. No need for any special design.

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: June 26, 2013, 03:35:08 pm
content: Quote from: c4757p on June 26, 2013, 03:34:06 pmah okalso would it be a good idea to change my RTC from I2C to SPI as well? (im currently using a DS1307)

author: c4757p
author_rank: Super Contributor
timestamp: June 26, 2013, 03:37:17 pm
content: I'm not sure what microcontroller you are using - some of them combine I2C and SPI on the same pins, in which case you'll need to. (Well, there are a few naughty tricks you could do...) If you have separate I2C and SPI ports, there's no reason to bother doing that, and IIRC the DS1307 is about as cheap as they come, so go with that if you can. I doubt you're in a pin-pinching situation here.

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: June 26, 2013, 03:40:09 pm
content: Im currently using an atmega328 with arduino boot loader on it i am thinking of changing it to an AVR based project so that it does not have the 5 second boot up time but i am unsure, it does have separate SPI and I2C pins so its not a problem having both of them.for the SPI chip select i have to pull it low for it to be active correct?

author: c4757p
author_rank: Super Contributor
timestamp: June 26, 2013, 03:42:38 pm
content: Correct. The actual, internal shift register is always active. The outputs are a separate set of latches, which read the values on the shift register and store them on the rising edge of CS.

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: June 26, 2013, 03:44:53 pm
content: ok,would it be worth me changing from the arduino boot loader to AVR so i use atmel studio instead of arduino program?i am going to need to learn it for my new job coming up but i am unsure weather or not to do it on this project

author: c4757p
author_rank: Super Contributor
timestamp: June 26, 2013, 03:47:20 pm
content: Do you have an AVR programmer? Yes, then, I think you ought to try. It's easy. Only trap: make sure the fuses are set right - if you shut the clock down accidentally, you won't be able to program it without a parallel programmer. When you have them figured out, you can always post them here so someone can look them over before you upload.

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: June 26, 2013, 03:54:34 pm
content: i have a usb to icsp programmer on its way currently but i can get the code sorted before thenhttp://www.ebay.co.uk/itm/261021924011?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2649that one to be exsact

author: c4757p
author_rank: Super Contributor
timestamp: June 26, 2013, 04:06:23 pm
content: I rather like that. Nice and compact, no more complex than it needs to be.

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: June 26, 2013, 04:19:53 pm
content: ive just noticed it does not program atmega328 T.T it does 329 and 325 but not 8

author: c4757p
author_rank: Super Contributor
timestamp: June 26, 2013, 05:08:57 pm
content: It does 168, which is identical except for device ID and memory length. I bet it can do it. In fact, if you can fit your code in the memory length of a 168, you could try programming it as a 168 (you may need to select some "force" option in the programming software to make it ignore the device ID).

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: June 26, 2013, 05:49:35 pm
content: ok, i shall ask when i try if it does not work

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: June 26, 2013, 10:03:29 pm
content: another design question, due to there being 170V flowing through some of the traces would it be wise to have isolation slots and separate jump header to go between the boards? i know i need to make the power traces thicker than REV 1 as they were the same as the signal tracesbut yea would it be an idea to have isolation slots or just have a silk screen isolation? with no traces below it?

author: c4757p
author_rank: Super Contributor
timestamp: June 26, 2013, 10:23:55 pm
content: Don't bother, just mind the isolation distance. Put it into the design rule system of whatever program you're using so it is enforced. 200V from a boost converter doesn't need nearly as much care as mains or worse. And they don't need to be thick. That's determined by current, not voltage, and they are only carrying a few mA. 10-15 mil is more than enough.

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: June 27, 2013, 06:26:34 am
content: Ok

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: June 27, 2013, 11:04:17 am
content: ok so following on from the port expanders would it be better and save space by having a ATMega329P so that i enough pins to control each cathode directly? that way i exclude the shift regulators and reduce the amount of current the whole thing draws?following on from currentif i want to know the current i need to supply to the base of a BJT transistor i would do currentneeded/Hfe = current to fully saturatethen double it to ensure it is always fully saturatedso in the case of my nixie tubes each tube will need to draw 2.5mA and the transistor i will be using is anMPSA42which has a minimum Hfe of 25 andf a max of 40therefore:2.5/25 = 0.1mA2.5/40 = 0.06mA(take largest)therefore i would need aproximatly 0.2mA to fully saturate the transistor correct?

author: c4757p
author_rank: Super Contributor
timestamp: June 27, 2013, 02:32:53 pm
content: I'm not sure about the 329P - they're pretty expensive. You could do this with a $2 microcontroller and a few $0.40 shift registers. On the other hand, it's not like you're making a commercial product. The simplicity might be worth the cost for a one-off. And on the gripping hand, the cheapass-MCU-plus-shiftregs may be an easier PCB to route. It might not be very easy to get all of those nets routed all the way from the microcontroller to the tube drivers. I'm pretty sure I'd go with something like an ATmega48 driving 74HC595s. (By the way, the 74HC series really doesn't draw much current. There's a big difference between CMOS and TTL.) Question: Are you planning on multiplexing the tubes, or driving each one directly?Your gain calculation looks good to me. Following from that, you'll want (5V-0.7V)/200uA ~= 18k or (3.3V-0.7V)/200uA ~= 12k resistors, depending on VCC. I'd probably just use 10k anyway, because I buy hundreds of them in all different sizes to use as a "standard medium-value resistor". There's no reason not to oversaturate the transistor, even dramatically, if the current is small.Quote from: mojo-chan on June 27, 2013, 01:07:52 pmI've actually never owned a real Atmel programmer and I've found that all the ones I've used worked just fine. It doesn't take much to shove some code out to a chip - I'd have done it myself with the parallel portif I had a parallel port(I do have a PICkit, though...)

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: June 27, 2013, 02:39:29 pm
content: i plan on having all on at the same time, but at night it to turn on and off like multiplexing to make the brightness dimmer, im unsure if this is the best way to do it as nixies can be bright when your trying to sleepi need them to go about 1/4 brightness at night so yeaany ideas on that?

author: c4757p
author_rank: Super Contributor
timestamp: June 27, 2013, 02:42:16 pm
content: Two ways: 1) Put weak pulldown resistors on all transistor bases (you can use little surface mount resistor networks to do this - it's a lot of resistors....) and PWM the OE pin on the 595s. (If you use 595s.) 2) Run the entire HV supply through a high-side switch before it goes off to the tubes, and PWM that. I'd go with #2.

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: June 27, 2013, 02:46:01 pm
content: anMPSA92would eb good for that?but i know you need the same or more voltage on the base in order for this to work. how would i control it via PWM?would i use an npn to control the pnp or something on the lines of that?

author: c4757p
author_rank: Super Contributor
timestamp: June 27, 2013, 02:48:38 pm
content: I've used that exact transistor in a Nixie project. Yep, it works fine. (Personally I'd recommend doing this with SMD, though - that's a shitload of transistors. The smaller the better. MMBTA92 is the SMD equivalent, as well as MMBTA42 for NPN.) Drive it with an NPN transistor.I'd even consider something like theMSD42WT1G(God, they don't make the part numbers nice these days, do they?), which is roughly the same as an MMBTA42 or MPSA42, but in theeven smaller than SOT-23SC-70.

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: June 27, 2013, 02:49:31 pm
content: how would i drive it?

author: c4757p
author_rank: Super Contributor
timestamp: June 27, 2013, 02:56:47 pm
content: Like this.(The anode resistor obviously wouldn't be as low as 5.6k, that's to simulate the load of multiple parallel tubes)

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: June 27, 2013, 02:58:21 pm
content: ok would i ahve to have 1 pnp before all the resistors or would i ahve to have a pnp after each of the 8 anode resistors?

author: c4757p
author_rank: Super Contributor
timestamp: June 27, 2013, 02:59:29 pm
content: One before all. Like I said, you're switching on and off the entire HV supply to the tubes.The exact same configuration could be used individually before each tube as an anode driver for multiplexing, but you said you're not doing that.

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: June 27, 2013, 03:00:49 pm
content: ok so in that diagram you sent the V1 would be +170V v2 would eb the pin from the avr and u1 is the voltage line for the tubes correct?

author: c4757p
author_rank: Super Contributor
timestamp: June 27, 2013, 03:03:47 pm
content: V1 - yep.V2 - yep.R1 and U1 togetherrepresentthe tubes, just so that the simulation would behave somewhat realistically. The voltage line to the tubes comes directly from the collector of Q1.

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: June 27, 2013, 03:08:38 pm
content: Quote from: c4757p on June 27, 2013, 03:03:47 pmok thanks alotQuote from: c4757p on June 27, 2013, 02:32:53 pmi might go with the single chip solution to save a bit of space for an additional feature that i am thinking off, i am unsure about it yet but i will have to do a bit of research into charging battery's ect (im thinking have a li-po battery in the base so that the clock can run without power for an extended period of time but the problem is that i need to find one / combine several to make 12V and for it to be able to charge off the input supply (currently 12V) but i think i remember from somewhere that i would have to charge them at a slightly higher voltage but like i said just thinking currently.

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: June 27, 2013, 10:49:54 pm
content: Quote from: c4757p on June 26, 2013, 03:47:20 pmi ahve a code snippet for an ATMega329PA which sets up the chip for 20MHz and starts a PWM pin roling (PB7/OC2A to be exact)i was wondering if i have set it up correctlyCode:/** Nixie_Clock_REV2_0_0.c** Created: 27/06/2013 23:12:18* Author: carbon dude oxide*/#define F_CPU = 20000000UL;#include <avr/io.h>#include <avr/interrupt.h>#include <avr/delay.h>double nixieSupplyDutyCycle = 0;int powerSaveMode = 0x00;int main(void){//i/o declarationDDRA = 0xFF; //set port A i/o (all outputs) Digits 1-2DDRB = 0x80; // set port B i/o outputs:PB7 inputs:PB1-PB6DDRC = 0xFF; //set port A i/o (all outputs) Digits 3-4DDRD = 0xFF; //set port A i/o (all outputs) Digits 5-6DDRE = 0xFF; //set port A i/o (all outputs) Digits 7-8//PWM timer stuff.TCCR2A = (1 << COM2A1) | (1 << WGM21) | (1 << WGM20); // set to fast PWM and mode.TIMSK2 = (1 << TOIE2); // set to run interrupt when timer overflowsOCR2A = ((nixieSupplyDutyCycle/100)*255); //work out duty cyclesei(); //set up external interrupts;TCCR2A |= (1 << CS20); // set pre-scaler to 1. and start timerwhile(1){//TODO:: Please write your application code}}//interupt serviceISR(TIMER2_OVF_vect_num) //interupt for timer 2 - for nixie voltage supply modulation at night or low power mode.{OCR2A = ((nixieSupplyDutyCycle/100)*255); //work out duty cycle as it may change mid code.}there are a few extras like the delay library and power saving mode var already in there if you were wondering that isive also figured out which pins im most likely going to use when making the schematic in my PCB program (i have to wait untill my laptop returns from repair T.T) so i have already set the i/o for all the required ports, i think i have done that right that is.

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: July 02, 2013, 09:28:37 pm
content: ok with the time keeping of the clock, would it be better to use the DS1307 using the I2C bus or would it be better to use a DS1390 using the SPI bus?

author: c4757p
author_rank: Super Contributor
timestamp: July 02, 2013, 09:36:55 pm
content: DS1390 includes a trickle charger and works down to a slightly lower voltage. If you need/want that, go with the 1390. Otherwise just use whatever is cheaper...

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: July 02, 2013, 09:38:01 pm
content: would the SPI connection be more reliable than the I2C?

author: c4757p
author_rank: Super Contributor
timestamp: July 02, 2013, 09:40:28 pm
content: Reliable? If either one ever doesn't work you've done something wrong. They both work just fine.Personally I think SPI's a bit easier to work with, but that's just my opinion.

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: July 02, 2013, 09:41:04 pm
content: fair enough

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: July 02, 2013, 09:44:00 pm
content: ok another question, il stay with the DS1307 as i have a few in my draw. would it be better to: wait 1 second on the AVR and read the time off the DS1307 then display OR set the DS1307 to output a 1Hz square wave from the SQW/OUT pin and have the AVR act when it gets pulled low OR use the internal timer on the AVR to keep a time and synchronise the clock once an hour or so?

author: c4757p
author_rank: Super Contributor
timestamp: July 02, 2013, 09:48:31 pm
content: Quote from: carbon dude oxide on July 02, 2013, 09:44:00 pmRequires just a couple lines of code.QuoteRequires a trace on the PCB and wastes a pin.QuoteTwo clocks, you might as well ditch the 1307.KISS.

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: July 02, 2013, 09:52:19 pm
content: the reason i ask is, on my revision 1 i did the first method and every 30 mins or so it would jump 2 seconds, what i think this is because the code slightly pauses while it is doing the I2C stuff and then waits 1 second so after an extensive period of time it overtakes getting the 2 second jumpmy thaught on the second sugestion (i have 4 interupt pins free on my AVRis to utilise the 1Hz pulse from the DS1307 so even if the AVR is pausing to wait for the bytes to go to and from on the bus it re triggers 1 second later instead of 1 and a tiny bit.

author: c4757p
author_rank: Super Contributor
timestamp: July 02, 2013, 09:57:56 pm
content: Quote from: carbon dude oxide on July 02, 2013, 09:52:19 pmCan I see the code?

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: July 02, 2013, 10:01:52 pm
content: its an arduino program that is saved on my laptop, which is currently in china for repair(ive had to do without my laptop for 5 weeks T.T) so i have been currently using my server computer to do my work on.from memory it used the main loop, had a 1 second delay at the bottom and used a DS1307 library to read the clock then do a small amount of bit shifting to output it onto the I2C bus to 4 port expanders. code worked it just had that annoying 2 second jump and then it just stoped displaying the time

author: c4757p
author_rank: Super Contributor
timestamp: July 02, 2013, 10:04:23 pm
content: Skipping 1 second seems reasonable if there's offset between the two clocks. That's why I'd probably update multiple times a second. But two seconds, and it stops? I suspect the timer was set up wrong.

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: July 02, 2013, 10:09:43 pm
content: no the clock stopped working after a week or two, the 2 second jump happened every 30-40 mins ish (from memory)when i initialy did this without a DS1307 the clock lost 4 seconds per hour so i had to sync it with an on-line server using the spare Ethernet shield i had, that was a fun little projectduring this project i learned that the arduino time keeping facility is not too accurate in the long run.i did debate whether or not to update it multiple times a second, but i decided to remake it and fix some of the underlying problems such as the power supply and i thought while i was there i should re work it all making it better all round and more compact as it needs to fit in a small case to its onto SMTi also then decided to change from Arduino to AVR to expand my knowledge in micros

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: July 03, 2013, 03:51:50 pm
content: so yea which of the two methods should i use?, i can spare a trace which is only going to be travelling about 10 mm and a spare interrupt pin which would not be in use anyway.im looking for the one that will keep the time accurate by not having those annoying time leapsedit: also im connecting an ISP to the board, am i still able to use the MISO,MOSI,SCK lines as normal inputs and outputs after programming?

author: c4757p
author_rank: Super Contributor
timestamp: July 03, 2013, 04:10:26 pm
content: None of these will result in time leaps. That's a programming mistake in the loop.Yes, you can still use them for programming. However, the CS line out to any SPI devices will float when the MCU is put into programming mode. To keep the SPI devices from seeing their CS line flapping in the wind and thinking the programming message is intended for them, you should put weak (100k-ish) pull-up resistors on those lines.

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: July 03, 2013, 04:12:00 pm
content: so on all MISO,MOSI and SCK?

author: c4757p
author_rank: Super Contributor
timestamp: July 03, 2013, 04:13:39 pm
content: No, on the chip select line going to the other SPI device.

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: July 03, 2013, 04:14:36 pm
content: there are no other SPI devices? i was on about using the pins as an I/O to use the BCD to Decimal converters.

author: c4757p
author_rank: Super Contributor
timestamp: July 03, 2013, 04:16:41 pm
content: Oh. Then you're fine. Just make sure that either 1) You find some way to hide the programming signal from them, 2) The HV supply is shut off during programming, or 3) You don't give a shit if the tubes flicker on and off during programming.

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: July 03, 2013, 04:18:51 pm
content: yea i will have the PNP transistor on the HV rail off initially.how can i make it so that the PNP transistor is controled by an NPN transistor connected to the micro, so when the pin on the micro is low (start up ect) then the PNP will be off and when the micro pin is high the PNP is on?

author: c4757p
author_rank: Super Contributor
timestamp: July 03, 2013, 04:21:36 pm
content: I am 99.83% certain I already posted a schematic with all the resistor values calculated and everything on another thread of yours.

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: July 03, 2013, 04:22:33 pm
content: i think i remember you posting that yes, i shall have a look now.should i do anything special with the PEN pin (program enable ?)edit: it was earlyer in this post:right here

author: c4757p
author_rank: Super Contributor
timestamp: July 03, 2013, 04:29:12 pm
content: You are using the ATmega169A still, right? There are three ways to program it - JTAG, parallel, and the usual ICSP serial. The program enable pins are for parallel. They're just normal pins otherwise.

author: c4757p
author_rank: Super Contributor
timestamp: July 03, 2013, 04:30:19 pm
content: Remember that R1 (5k6) in that circuit isn't part of the switch, it's a load for simulation purposes.You may want to add a base resistor between the MCU and Q2 (1k to 3k9 or so) so that if there's any capacitive coupling of HV during switching, the ESD diodes can dissipate it. You don't really need it, though.

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: July 03, 2013, 06:13:23 pm
content: Quote from: c4757p on July 03, 2013, 04:29:12 pmsory no im using theATMega128A<-datasheet

author: c4757p
author_rank: Super Contributor
timestamp: July 03, 2013, 06:20:22 pm
content: Nope, you don't need it. Just let it float.

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: July 03, 2013, 10:31:23 pm
content: well that makes my life a bit easieri shall continue to wire everything up

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: July 03, 2013, 10:32:15 pm
content: oh also should it get:74HC595 OR 74HCT595 OR 74LS595it needs to use the least power as possible

author: c4757p
author_rank: Super Contributor
timestamp: July 03, 2013, 10:34:38 pm
content: 74HC595

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: July 03, 2013, 10:40:33 pm
content: thanks

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: July 06, 2013, 10:05:01 pm
content: ok so from the LTsplice simulation you posted:here for reffereanceive i want to use the least amount of current to turn the transistors on or off i have worked it out as:HV:155VHFe of MMBTA92 is 25 min.max current from the tubes is 21matherefore R2 in the diagram should be:0.021/25 = 0.00084 *2 (to ensure full saturation) = 0.00168A to fully saturateR=V/IR=155/0.00168 = 91k (nearest E value)so R2 should be 91kunsure about R3 (pull down resistor? if so what value for 155V?)but i am sure there i meant to be a base resistor for the NPN transistor which would be: again HFe: 25 V:5 max 21 maso 0.00168A to fully saturate5/0.00168 = 7.2K nearest valueis that correct?

author: c4757p
author_rank: Super Contributor
timestamp: July 06, 2013, 10:07:58 pm
content: Onequickcorrection - the NPN transistor needs no base resistor.Give me one minute to go through the math.I've approximated Ic = Ie, which is close enough for these calculations.Ic(Q2) ~= Ie(Q2) = Ve(Q2)/R3 = (Vb(Q2)-Vbe(Q2))/R3Ib(Q1) = Ic(Q2)Ic(Q1) = 21mA (max current, as you specified) = hFE(Q1) Ib(Q1)21mA / hFE(Q1) = (Vb(Q2)-Vbe(Q2))/R321mA / 25 = (5V - 0.65V)/R3R3 = (5V - 0.65V)/(21mA / 25) =5.17kSo the resistor as I calculated it isalready too large- I underestimated the current draw.I was going to go through calculations for R2, but they're a bit complex, and they really don't matter. R2 draws very little current (at most 0.65V / R2, so less than 100uA). Anything within the vast range of 5k to 100k will do. The smaller it is, the faster you can switch (but if it's too small you'll have to lower R3 as well, so don't go too small).

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: July 06, 2013, 10:13:16 pm
content: why is there no need for a base resistor, i thought it was needed on all transistors?

author: c4757p
author_rank: Super Contributor
timestamp: July 06, 2013, 10:13:47 pm
content: You don't need a base resistor, you just need something to limit current. In this case, theemitterresistor will do that.You'll notice that there arenobase resistors in the whole thing. Q2 is configured as an emitter follower, and when you put a resistor on the emitter of an emitter follower, what you get is a programmable current source/sink (because it applies a known voltage across a known resistor, giving a known current by Ohm's law). This current sink supplies the base current for Q1, which also needs no base resistor because it is being fed with a constant current rather than a voltage.One minute, I'm still continuing the math for the other resistor.Done.

author: c4757p
author_rank: Super Contributor
timestamp: July 06, 2013, 10:31:25 pm
content: Keep in mind that this is absolute worst case by the datasheet minimum hFE. If you truly need even lower current consumption (rather silly IMHO, this switch will be dwarfed by the tubes themselves), you can always measure the hFE ofyourtransistors (make sure to do it at the correct load current, don't just shove them in an hFE socket on a cheapass multimeter).

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: July 06, 2013, 10:35:06 pm
content: right another question am i able to have more than 1 5V regulator in a circuit?the first way i don't think you can is by having 2 regulator in parallel effectively 'sharing the current over each regulator. i remember being told i cant do this.now the other way is havung two separate 5V rails (due to there being two board in my project but are connected with data lines and grounds) would it be possible to have a seperate 5V rail for each board and will effect the BCD signals from the ATMega (on a 5V regulator) to the BCD to decimal converter (which would be on the second 5V rail. would this work?

author: c4757p
author_rank: Super Contributor
timestamp: July 06, 2013, 10:47:00 pm
content: How much current do you need from the 5V regulators??A 7805 can give 1A! Obviously heat management is an issue, but I'd think a bigass heat sink on one regulator would be easier and cheaper than two slightly less bigass heatsinks.But yes. The second way will most certainly work. Separate power supplies isn't an issue between devices. It's very common, in fact, especially when different chips have to run at different voltages.As for the first way - the jury's out, depending on who's on the jury... There was a rather heated argument about this recently on the forum. Personally I wouldn't do it, especially if it can be avoided.

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: July 06, 2013, 10:52:18 pm
content: unfortunately due to the size restrictions i am unable to fit a heat sink in there, so i was maby planning on having a couple of 7805's in there to 'share' the current load. i was also going to add a few diodes from the 12V line before it goes into the regulators. that way there will not be as big of a voltage dropbut i am unsure if thats going to be enough to keep it cool in the small compact space

author: c4757p
author_rank: Super Contributor
timestamp: July 06, 2013, 11:02:20 pm
content: How much current do you need?

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: July 06, 2013, 11:07:00 pm
content: The amount to run an ATMega128, 4 bcd to decimal converters, DS1307 and 8 LED's. on REV 1 there were a few more chips which meant my current draw was aproxomatly 0.5-0.7A from memory (12V to 155V included) im taking that as my worst case current draw

author: c4757p
author_rank: Super Contributor
timestamp: July 06, 2013, 11:09:13 pm
content: I doubt your current on the 5V rail will exceed 50mA. The DC-DC converter running off 12V was the bulk of that half amp, I promise.

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: July 06, 2013, 11:11:02 pm
content: Then how come it heated up to 60°C in about 7 seconds once being turned on? Then continued to riseWould it be because i use 30 year old BCD to decimal converters?

author: c4757p
author_rank: Super Contributor
timestamp: July 07, 2013, 12:19:06 am
content: Possibly, if they were 7400 series (TTL) and not the CMOS 4000 chips. But still, that's really hot. I think you may have had something somewhere else that was taking way too much current.

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: July 07, 2013, 06:36:59 am
content: Hmmm, ok

author: WarSim
author_rank: Frequent Contributor
timestamp: July 07, 2013, 07:04:00 am
content: Did you ever say which NiXi tubes you are using.I am a bit confused by your selected driving methods.I seems to be a mix of the different accepted methods of a few NiXi tube types.I haven't heard the 30+ year old terms referring to the different types for a very long time.So I won't bother typing them, and just ask about the ones you are using.No I didn't read the entire thread

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: July 07, 2013, 07:10:38 am
content: You dont nee to read the whole thread, its me asking questions about different aspects of the clock.I am using 8 IN-14 nixie tubes, in the Rev1 i used k155id1 drivers which are as old as the tubes.The tubes i have at home were made 1972 and 1973 in russia and they were surplus stock. I baught them 'unused' from ebay.do you need any more infomation?or was that too much?

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: July 07, 2013, 07:47:35 am
content: on theatmega128 datasheeton page 321, the electrical characteristic Icc i the current that the micro draws itelf. but the value says 8Mhz 5V. im going to be running at 20Mhz. is the amount of current drawn linear to the frequency? if so typicaly it would be drawing 24.5mA but as a maximum 47.5mA.am i right in saying its linear?

author: WarSim
author_rank: Frequent Contributor
timestamp: July 07, 2013, 08:14:40 am
content: Yes I have experience with them, but I have never used that driver.I also could not find a complete datasheet on a search I just did.So I am going a bit from memory.I have one word of caution. If you used only the information on the English translated data sheets I have found on the web so far your power usage will be greater than nessesary..These tubes are not primarily intended to be used with DC on the Anode. Therefore the term multiplexing is not exactly what it means today.The reason I am saying this is if you are keeping DC on the Anode and multiplexing the Cathodes it is likely you are experiencing the effects of tube saturation. I am assuming this method because of the mention of the constant current drivers. This has the possibility of causing extra work for the low side only multiplexers/drivers. And many will induce noise back into their supply and ground. Of course the noise will make your regulator work harder. The reason I am assuming this is I not seen a single spanned driver that allow anything but half wave AC. Well DC if you use a huge heat sink. Then again I don't use them for my projects an only time I see them is when repaired others equipment.To reduce the effects of corona saturation many methods are available to compensate for it and these will to a lesser extent compensate for tube saturation. Seems this is rev 2 I doubt a method change would be reasonable. I strongly suggest you build a tube exerciser or even use a suitable tube rejuvenator in each individual tube. Then when installed exercise/refresh often (whichever method you have chosen for you clock). I believe you should see reduced Anode consumption and reduced cathode noise.Yes if those drivers are from the 70s also, they used power. 100mW was low power back tem.Just double check for noise to make sure all 7 watts disipation is nessesary.If you know all this, thanks for indulging my nostalgia trip.Personally I like the IN-12 better so I have a bunch of them waiting for my time. I maid a PIC based driver board module and power supply. But I didn't like it enough, so it has gone back in the queue for a rework.Too long winded forum keeps logging me out.

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: July 07, 2013, 09:04:07 am
content: Im not the only one having trouble with the forumI do have the tubes cycling to prevent cathode poisoning (have not got time to fully read your post as ive got to get to work)

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: July 07, 2013, 03:32:52 pm
content: got to love working in an electronics store on a very hot sunday XD its been dead all day.im unsure what you mean by:Quote

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: July 07, 2013, 03:49:09 pm
content: ok i believe i have finished the first board schematic (there are two boards stacked on top of each other hence the header pins)on PE0 and PE1 i have a 90 pin header to connect the serial line to my computer to send times and debug ectPE4 and PE3 are PWM lines for both the 155V power and the top board LED'sPE6,PE5 and PD2 are physical control button to change modes and manually set time ect.PE7 is for the external 1Hz interupt from the DS1307.how does it look to you guys?Edit: just realised i did not attach it, an im no longer at home to attach. Pause this thought untill i get back to upload

author: WarSim
author_rank: Frequent Contributor
timestamp: July 07, 2013, 07:23:46 pm
content: Many sites talk about the negative effects of driving these tubes with DC or the pulsing.All seem to focus on the Corona Saturation problem but few I have found talk about the gas saturation problem.Corona saturation has the visual effect of unelected digits glowing. This happens even with the "AC" method also but takes months to years to happen. Pulsing the effect take weeks to months. DC drive it takes hours to weeks to happen. To reduce the problem the tube needs to be to be exercised often.The gas saturation problem takes comparatively longer, and the effect is more gradual. The only site that indirectly referred to the problem recommended replacing the tubes every 5 years, due to digit dimming. The actual effect is the anode off gasses and if re-absorption is not allowed the tube will become more capacitive. Resulting in a diode and really noisy capacitor in parallel. The equipment still running with the original tubes all use in cct automatic rejuvenation methods. It is possible for NiXi tube to run for decades if cared for, but this is seldom considered important these days. What should be considered is the noise effect. Modern electronics is more susceptible to noise/EMI therefor the the gas saturation problem will cause problems sooner. In the mentioned site estimated at 5 years for their clocks which can be auto exercised every 15 seconds. The noisy capacitor effect is what can cause unnecessary power consumption ergo heat.There are many diode rejuvenation methods all with pros and cons. If you want your tubes to last a long time please use at least one.

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: July 07, 2013, 07:27:56 pm
content: Yes it cycles the numbers every 1-30 mins have not defided yet, probably make it an effect when the minute changesI have also reduced the current on the tubes to preent cathod poisning (purple specles apearing within the tubes due age and current, it also can cause multiple digits or partial digits to be displayed)

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: July 07, 2013, 08:13:06 pm
content: here we go the current schematic for the main board

author: WarSim
author_rank: Frequent Contributor
timestamp: July 07, 2013, 10:14:48 pm
content: Well you are using two symbols I don't immediately recognizeA FET of some type and three switches/sensors of some type.Different countries different symbols.Off to the Internet.The reason for this reply is.Your power connector has 155v adjacent to 12v.Are you sure the pin spacing is sufficient.Isolation requirements vary between countries but not any connector pitch can be used.I have seen products who ignore this and the disastrous results. Since it must have been missed by several people then, so it could be possible you missed it also.

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: July 07, 2013, 10:17:23 pm
content: each power line on the power header is separated by a ground line, and when i come to laying it out the 155 line will have considerably more space around it to other lines.

author: WarSim
author_rank: Frequent Contributor
timestamp: July 08, 2013, 04:00:27 pm
content: Finally donned on me what the symbols mean.Don't have any experience with your controller.Not much time to go through the schematic, hopefully someone will chime in.I do find it kinda hard to believe that a heat sink wouldn't take less space that all the diodes.Even if you can't have the regulator 2mm higher you could still extend a thermal conduit trace to a heat sink shorter than your max height and area taken by the diodes.The layout is in front of you not me, not saying your wrong, just it is hard to believe.Seems to be a pretty simple schematic, even if there is a mistake, it could still be adjusted.Or even the programers motto, "anything can be fixed in software".Rev 98 should be just about perfect.

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: July 10, 2013, 08:27:44 am
content: there surface mound diodes, the way that they have been layed out though takes up the same space as the regulator itself.when filling in a ground plane is it better to have it fill directly to GND pins fully or connect to them with a + shape? please ask if i have not made any sense

author: WarSim
author_rank: Frequent Contributor
timestamp: July 10, 2013, 01:51:18 pm
content: Depends on the purpose.Thermals (the crosses) are to reduce the transmission of heat to the ground plane.If the components dissipation is used alone thermals are used to reduce board heating.Because of this it also helps with soldering. Dramatically changing the pad thermal mass requires different techniques and temps.Thermals are not used when the pad is used as a heat sink. In this case thermals should be placed around the combined or individual conduction area. There are several techniques to do this, like hatching.In general heat is always the enemy. For reliable circuits heat must be managed. Keep temp down and restrict it to where it can be tolerated. I saw a glass PCB explode once due to runaway heat, the glass substrate was selected because of the heat..

author: carbon dude oxide
author_rank: Frequent Contributor
timestamp: July 10, 2013, 03:53:05 pm
content: i see, makes sense