Having source code and all design files as a starting point it becomes very easy to customise it for your own needs and your own DIY project, even VFD driver might be modified with little efforts to control VFD panel from another DVD player - they all designed in a unified way.
This is a list of features that we've got in the end (and what could be potentially enhanced if you like):
- Real time clock battery backed up dedicated chip;
- 1Wire temperature sensor;
- Controlled wirelessly by any RC;
- Activated by PIR motion sensor;
- Serial-to-USB convertor for reprogramming and logging purposes;
- Acrylic enclosure;
- Full source code is available;
Thank you and we hope you will find this project useful and worth making!
Step 1: Scrapped DVD Player Parts
But what if all this infrastructure already existed, would it be that difficult to combine together something like Arduino controller and VFD? The answer is no, not at all! Most modern DVD players equipped with VFDs and when less reliable mechanical parts (DVD ROM drives) fail devices are simply thrown away. Instead, some electronics could still be reused to give your project a completely new look reducing costs at the same time and saving the environment. In addition to a VFD with controller onboard and a power supply which provides everything with all vital voltage levels there is a bonus – an IR receiver and buttons. VFD controller takes care of refreshing display, handling events from buttons and IR receiver encapsulating whole control into a serial interface and making integration with even primitive controllers very possible, giving in exchange fully functional remotely controlled system.
But enough theory, let’s have a look at a real example. We found a broken DVD player literally lying in the street. Quick test indicated that VFD board and power supply were functional. VFD was 16-segment and therefore capable of displaying not only digits but characters as well. After a few minutes of internet search model name was identified: Philips DVP630
For our experiment we will need a front VFD panel and a power supply board only.
Returning back to the page 3 of the service manual, checking RB502 connector – there are V-CLK, V-CS, V-DATE to control VFD. Also we will need GND, IR (output from infrared receiver) and +5V. An attentive reader should notice that there is also +5V_STB at RB501 connector. It is 5V standby voltage that is always applied. +5V appears only after pressing either ‘StandBy’ TA501 button on DVD’s front panel or On/Off button on a remote control. The power supply is instructed to activate/deactivate +5V via PCON signal. But in order to wake up the player from a remote control only original RC must be used otherwise IC581 won’t recognise the command. We want to make our device working with ANY type of RC that is why our microcontroller must take responsibility of decoding RC commands and controlling PCON signal.
Please refer to the picture, the hacking points are marked with red ellipses.
Step 3: VFD Display and Driver - Mapping Bits to Segments
Note, that colon is controlled with one single bit 5 and it is available for 3-th and 5-th digits only. Two vertical segments in the middle of digit are simultaneously driven by a single bit 9, there is no way to activate only one out of two segments.
In order to simplify output to the display a software driver has to be implemented. In the next step we will go through this process.
Step 4: VFD Driver Demo
The driver’s logic is subdivided into several groups: initialisation and low-level methods, tests and visual effects, methods for direct access to HT16512 without intermediate buffer and methods for intermediate buffer operations.
We won't discuss boring details of VFD driver implementation, however, if you are interested, you can refer to this article: http://atmega.magictale.com/853/vfd-driver-demo/
The code below demonstrates how to initialise our VFD driver:
#define VFD_CS_PIN 15 //PD7
#define VFD_SCLK_PIN 14 //PD6
#define VFD_DATA_PIN 13 //PD5
#define STANDBY_PIN 12 //PD4
HT16512 vfd(VFD_CS_PIN, VFD_SCLK_PIN, VFD_DATA_PIN); //VFD display
//Enable VFD power supply
//Initialise VFD tube
As you can see, apart from VFD_CS_PIN, VFD_SCLK_PIN, VFD_DATA_PIN pins that are dedicated to VFD communication there is also STANDBY_PIN pin that simulates POWER button and instructs to switch +5V power rail on.
Let’s get down to the hardware part. In this demo we will be using Freeduino board. In total we would need 4 (four) signal wires to connect it to the VFD panel. Of course, we will also need GND and +5V power rail.
Here is the signal mapping table between Freeduino board and VFD panel (please also refer to DVP630 Schematic Diagram):
|Signal||Freduino connector-pin||VFD panel connector-pin|
And the video demonstrates the result: Freeduino board running VFDDemo, connected to the VFD panel and power supply from broken Philips DVP 630.
To download VFD Demo library and VFD example for AVR please find VFDDriverDemo.zip attached to this step.
Step 5: Building Clock + Thermometer
As a heart of the system Freeduino board would be probably an ideal choice: more than enough computational power, abundance of GPIOs, the amount of program memory is roughly just right for this type of project, compact dimensions (we really need it because the VFD panel and the power supply are rather bulky so we would aim to achieve to minimum possible size for our box). And finally, this board is really cheap.
The board comes as a kit so it is a good chance to practice in soldering yet all components are very easy to solder.
As an advantage, the board does not need any external programming equipment – it has serial-to-USB converter and could be connected directly to a PC and programmed by means of Arduino IDE. In fact, it is possible to program it even without Arduino IDE as such – everything that needs to be installed is AVRdude.
After programming procedure serial port might be user for debugging output or, in our case, for logging current temperature to external device.
Step 6: Adding Extra Components
We also would need a remote control to manipulate clock settings and the type of RC (whether it is NEC, SONY, RC5 or RC6 standard) really does not make any difference simply because we are going to support… all types! To say more, the initial set up of a remote control for use with our clock will be done by means of… a remote control! How? Read on and it will be explained for you later.
Step 7: Connecting Together
There are couple of tricks again. Firstly, the PIR sensor works stable from +12V and allows false alarms when the voltage is +5V (which is exactly our case). This is because it has voltage regulator 7805 and +5V is not enough for proper regulation. Bypassing the regulator (connecting +5V to its output leaving input unconnected) solves the issue.
Secondly, the standby mode on VFD panel is controlled by a chip IC581 that flips the state of its PCON output when it detects a pulse on its POWER input. It has been discovered that sometimes it may detect a false pulse induced by appliances located nearby. Besides, there is no way for our Freeduino to detect which mode (ON or STANDBY) is currently active. The solution is very simple – to unload R582 and therefore disconnect IC581 from controlling the standby line and instead connect Q581 via 1K resistor to our Freeduino board. So the ON/STANDBY mode will be controlled not by pulses but by levels.
Here is the signal mapping table between Freeduino board and the remaining components (please also refer to DVP630 Schematic Diagram):
|STANDBY||J3-5||VFD panel-Q581-base, via 1kOhm; R582 must be unloaded|
|+5V Standby||JP1-3||VFD panel-RB501-5, RTC Module-5V Pin, DS18B20-VCC Pin, PIR Sensor-in bypass of voltage reg.|
|GND||JP1-4, 5||VFD panel-RB502-4, Buzzer-’-’ Pin, RTC Module-GND Pin, DS18B20-GND Pin|
|PIR_SNSR||J3-4||PIR Motion Sensor-ALARM (AL) Pin|
|SCL||J2-6||RTC Module-SCL pin|
|SDA||J2-5||RTC Module-SDA pin|
Step 8: Assembling Electronics
Electronics is ready but firmware is not programmed yet. Next step briefly tells how to do it. To download VFD MagiClock binaries and source code please follow this link: VFD_MagiClock_Rev1.0_2012_09.29.zip
To program the firmware connect Freduino board to PC using USB cable wait until a new virtual port is installed then just type the following in Windows Command Prompt (but before make sure that AVRdude is installed on your PC):
avrdude -p m328p -c avrisp -v -P comXX -b 57600 -U flash:w:VFD_MagiClock_Rev1.0_2012_09.29.hex
where comXX is your newly installed COM port name (i.e. COM10, COM15).
When the programming procedure is completed, our application starts and Freeduino activates VFD display straight away displaying greeting information and then awaiting for RC setup. If within a few seconds no commands from RC have been received, the device goes to its normal mode displaying periodically time, date, day of week and temperature.
Step 9: Laser Cut Enclosure
Second approach is to design a 3D model of enclosure in a CAD system then place an order with a manufacturing house and make it using 3D printing technology. This would probably give best results in terms of shape but would require rather advanced skills in 3D modelling and in addition would cost us a fortune.
A reasonable compromise would be the third approach – to make a box of acrylic panels that are laser cut by a manufacturing house like Ponoko making system. The design files could be prepared even in Corel Draw or Inkscape (although we would strongly recommend to use a 3D tool such as SketchUp and will explain later why). That way it would be possible to make a box as compact as possible, designing the required holes and making laser to do the hard job instead of us. It also will give us invaluable skills of making drawings for real things with opportunity to see and touch the end result. And all of this for a very reasonable price to pay for materials, machining time and shipping.
Now a few words why it is preferable to use 3D modelling tool instead of 2D one. The short answer is simple: while the overhead of complexity designing things in 3D is so low that it could be neglected there is a very powerful opportunity to fit all parts in 3D together, find and fix problems before the parts have been actually manufactured. By designing models of boards and VDF panel it is also possible to make sure that all of them fit inside our box without mutual interference.
There are some tricks and tips that we followed designing this enclosure, they are described in detail at Ponoko’s article ‘How to make snug joints in Acrylic’. There is no sharp corners in design as they create weak points in the acrylic, that is why every corner has a small radii. Another trick is that slots are made slightly smaller than they would be in ideal world – to compensate the material that is burnt away by laser.
To export data in 2D Sketchup-svg-outline-plugin needs to be installed. Guys from Flights Of Ideas company have done a great job – now it is very easy to export paths from 3D SketchUp designs.
The final 2D drawing is ready to be submitted to Ponoko. An attentive reader has probably noticed that the number of parts is bigger than is needed. Yes, this is just to maximise the use of material – if you don’t need spare parts then just delete excessive elements before sending the design to the manufacturing house.
To download VFD MagiClock Enclosure Drawings in Google SketchUp and SVG formats please follow this link: VFDClock_Enclosure_Rev1.0_2012_10.11.zip
Step 10: Final Assembling
We hope you enjoyed this tutorial and hope to see you again!
Please take note of two links related to this project:
- Source code and design files published at http://code.google.com/p/magicclock/
- Blog dedicated to this project is available at http://atmega.magictale.com/category/vfd-magiclock/