What where my goals in this project? First of all, of course, I want to know a current time, date and
the day of week. Also it would be interesting to know the temperature in the room and anything else. For
example, I want to be able to configure the device through USB-connection using the AT-commands in the
same way as with dial-up modems
in a far, far galaxy...
a long time ago.
Let's develop it.
Every clock like this can be functionally divided into several blocks.
I also added a buzzer for an alarm clock and a USB-TTL converter for communicating with a PC via a standard USB port as described above.
And now let's go through each block in more detail.
Actually, we can use any MCU for our goals. This can be MCUs from ATMEGA, for example, the same that uses in ARDUINO-boards, from MSP (for example, most popular MSP430 series), from ST (lot of STM32 ARM-series). I choose the STM32 MCU, model STM32F030F4Px. Why this one? I'm working with this MCU series, I have several MFUs of this model available, and they are cheap.
Here we again have many options for counting and saving the current date and time. Almost every ST MCU has a built-in RTC module, and, of course, we can use this module. But I want to practice more with a dedicated RTC module for coding and testing some circuit/schematic solutions. Thats why I choosed DS3231 IC from Maxim Integrated.
The VFD Driver
As you know, the MCU's operating voltage in case STM32 is 3.3V, but VFD requires up to 70V. So, to operate with this voltage we need a VFD drivers. They allow control this VFD's high voltage with our MCU. I choosed MAX6921AWI from Maxim Integrated. This IC perfectly fits for IV-18 VFD.
The DC-DC Step-Up convertor
And now we must obtain this VFD's high voltage. From where? We can use a DC-DC step-up convertors. Our device will powers from a standart USB, we can step-up this 5 Volts up to 50Volts for our VFD.
And now, let's go to the schematics.
To configure the MCU and build a source code template I use the STM32CubeMX. This is a perfect and easy to use tool. Now, after selecting the MCU model, clocks, pins and peripherals configuration looks like this.
The clock configuration looks very simple. It is just maximum possible values for this MCU.
The SPI, I2C and USART also has configured with standart params.
Let's begin from power supply. First, we need global power supply for our device. Here is minimum of necessary components as you can see.
I want to supply my device from any USB-host (e.g. laptops, PCs, USB chargers etc…) therefore, the device is designed for an input voltage of 5V. But MCU works with 3.3 Volts and I used pretty simple solution with fixed voltage regulator AMS1117 from Advanced Monolithic Systems. Simple and practical.
Besides all this we need stabilize our input (from USB) and output (from regulator) voltages to reduce interference and power surges. We can do this adding the electrolythic and ceramic capasitors. Datasheet for MCU recommends, how to properly we need add capasitors, but I want to minimize number of components and reduce the cost of whole device. For this device, this will be enough.
J1 — Mini-USB connector
C6, C7 — Capasitors for input voltage from USB
C3, C4, C5 — Capasitors for output voltage from voltage regulator
Now we can connect the buzzer for alarms.
Another one simple solution to operate with buzzer with direct (from USB) 5V voltage.
R5 — Current limiting resistor for MCU pin
R6 — Current limiting resistor for buzzer
Q3 — Almost any NPN transistor
TIM3 PWM configuration for BUZZ pin
The prescaler, counter and pulse values may be vary.
Next. We need count and store time and date to show them and implement an alarm. I like IC DS3231 from Maxim Integrated with an integrated temperature-compensated crystal oscillator (TCXO) and crystal.
Of course, I can use built-in MCU's RTC. But in this project I wants littile bit more practice with «external» interfaces, such as I2C. Among other things, we can read the «room» temperature from this IC.
I will use only the I2C for interfacing with our MCU. And also we need provide a backup power supply for DS3231 for continuous timekeeping. For this I use standart battery CR2032.
And now the most interesting part, in my opinion, in this device. It is a step-up converter for our VFD indicator.
Each VFDs requires two voltages. It is a heating (from 1.5 to 5.5 Volts) and operating voltage (from 25 to 75 Volts) depending of VFD model.
Heating (cathode) voltage for this VFD can be powered directly from USB which is very convenient.
Now we must commutate all anodes and grids of VFD using our MCU. How we can do it? There is two ways at least. At first, we can add many transistor keys. But in this case we needs many of free MCU pins or use shift registers IC for multiplexing our MCU pins for these keys. At second, and it is my solution, we can use some IC, which designed special for this targets. An VFD drivers. And I found this one.
MAX6921AWI from Maxim Integrated again. Perfect IC for this solution. Using this IC I can connect and commutate all VFD pins using SPI interface of MCU.
Now also I added the IC for communicate with USB host to be able to changing settings of device or get some info. It is popular IC CH340G (like FT323).
This is simple USB-TTL level converter which I can use for USB interfacing.
Also I want to use buttons for setting time and date directly, without connecting the device to any USB hosts.
I used three buttons. This more easily to programming and operating for users.
And now, after all of this we must draw full circuit, make PCB design, export this design to Gerber-files and make order in any PCB manufacture.
…now assembling, soldering, tesing…
…adding little bit of code…
…and it is ready.
Thanks for reading .)