Welcome

Software

Ofcourse, in a build like this, the software is as important as the hardware. The software for the dekatron driver should do three things: it should generate the high voltage, it should read out the Internet speed and convert that into rotation speed, and finally it should have a nice configuration interface.

Generating the high voltage is pretty easy. The RTC timer is set up to generate interrupts, and the interupt handler is used to generate a PWM signal on GPIO0 at a frequency of about 17KHz. Every 50ms, the value of the boost generator is inspected by reading the ADC and 32 samples are averaged to get rid of glitches caused by the boosting process. This sample is then used to adjust the PWM duty cycle up or down, dependent on if the generated voltage is less or more than the voltage we want. This regulation process isn't too quick or stable, but that doesn't really matter: the dekatron will work on a fairly wide range of voltages without changing visibly in brightness, so it doesn't matter if the generated high voltage fluctuates a bit.

I decided to read out my Internet speed using SNMP: I have a managed switch running a bunch of VLANs in my network, and that switch actually allows SNMP access to a bunch of variables, amongst which are the number of incoming and outgoing octets on a network interface. I could basically just write a SNMP client and read those values periodically to get my speed measurements. I actually built a fairly usable ASN.1 and SNMP stack; it doesn't have all bells and whistles, but it's easy to expand if I ever want to grab other SNMP data or want the ESP to act as an SNMP agent.

For the user interface, I decided to use my esphttpd web interface again. This allows easy connection to a WiFi access point and configuration of the SNMP OIDs etc:

As you can see, I can adjust most of the details here: this way, I don't have to re-flash the ESP when my network changes.

« Prev 3 Next »


© 2006-2022 Sprite_tm - Contact