-->
Page 1 of 2

Multiplexing 14 segments with an ESP

PostPosted: Mon Jun 15, 2015 3:24 pm
by FlyingHacker
HI,

I am porting a sketch (which I need to convert to a library) for driving a 14 segment display (six chars, but can be expanded) from an Arduino to the ESP-01.

I am trying to figure out the best way to drive the multiplexing. I have the hardware all sorted out (shift registers and a ULN2803), but on the Arduino I used an interrupt service routine called regularly to bit bang the data to the shift registers (which drive both the anodes, and the common cathodes via the ULN2803). This worked great.

In the ESP I am using the Ticker library as my "interrupt" routine. I am getting the occasional tiny bit of flicker, like a little glitch you might see in a sci-fi movie display. I am assuming this has to do with the ESP not being a realtime OS, and doing other things like WiFi (which I do not have setup in this sketch yet). The glitches are subtle, and hardly impact the utility, but they look less than professional. They really seem worst right after startup, as though the "os" is doing some other stuff right after boot that then calms down after a few seconds.

So was wondering if there was a better way to drive the multiplexing directly from the ESP. Is there a better way to handle the interrupts? I am multiplexing with a delay of 4 milliseconds, which seems to be as slow as I can go with a clean POV effect.

In another ESP project I have of course used a Max 7219 on an 8x7 segment display, and the 7219 handles the multiplexing internally. So there is no flicker. I don't really want to use a dedicated 14 segment driver chip. They are a lot more expensive than a 7219, and I don't have one right now :D

Perhaps I could or should use a 555 to drive a counter to drive the multiplexing on the ULN2803... This would cycle through the cathodes quickly, totally independently of the ESP.

Thoughts? Could the glitches be something else like RF? I have everything pulled as is normal. I am powering the LEDs and shift registers/ULN separately via 5v, and have the ESP on a bench power supply.

I wonder if I should try a 3.3v<->5v level shifter. I am currently trying to drive the pins on the shift registers with 3.3v "HIGH."

Anyone?

Thanks.

Re: Multiplexing 14 segments with an ESP

PostPosted: Mon Jun 15, 2015 4:59 pm
by tytower
Bit too specialised for me but I can tell you the chip is putting out about a second of serial stuff on 74880 then it shifts to 112800. So leaving a delay of 1 second if you can might fix that. Ill have to study your questions to see if there is anything else I can answer
I don't follow this
I am assuming this has to do with the ESP not being a realtime OS, and doing other things like WiFi (which I do not have setup in this sketch yet).
.If you have coded it I don't think its doing any wifi until you put it on is it? The realtime OS lost me .

Try some caps around if you suspect RF noise.I saw suggested to feed the neg of battery direct to neg of ESP8266 to avoid RF from other devices . Havn't tried this yet tho.

Re: Multiplexing 14 segments with an ESP

PostPosted: Mon Jun 15, 2015 6:01 pm
by FlyingHacker
Thanks for the reply.

I don't think I am having any issue with serial output (other than the fact that I never did get serial output to work, but that is a different story I may post about in another thread). I am not using serial here.

What I meant by not being a realtime OS is that the ESP "os" does other things other than JUST run your code. Like the difference between a Raspberry Pi, which run linux and an Arduino, which runs ONLY your code.

Of course I may be completely wrong here. It may only run your code and nothing else. Though some wifi functions may run as interrupts, etc. I don't know enough about this yet. But *if* it runs some other code at an interrupt level then that code could slow down your code, which is a key factor if you are trying to do things like multiplex, or make some software PWM (Pulse With Modulation), etc. Those are both timing-sensitive operations. If some other code takes away time from those then the output suffers (flickering in LEDs, the wrong duty cycle in PWM).

I think I am on to something though. Will report back shortly.

Re: Multiplexing 14 segments with an ESP

PostPosted: Mon Jun 15, 2015 8:01 pm
by tytower
No matter what code you put on it it outputs the serial anyway whether you catch it or not so the modem functions may well be running in the background as you say. After all merely powering up the chip and puting a serial terminal on the TX/RX lines makes it accessible with AT commands.