Introduction: A DVD Player Hack
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
Vacuum fluorescent displays (VFD) make any consumer device looking eye-catching, compelling and unusual. A VFD emits a very bright light with high contrast and can support display elements of various colors, some of them are capable of rendering not only seven-segment numerals but characters and even graphical information. VFDs are equally great for anything from professional devices to basic do-it-yourself things. Yet VFDs are rather expensive for small hobby projects and notorious for their non-trivial control as they require voltages higher than just TTL levels, necessity to drive grids in addition to segments or dots and therefore make presence of dedicated VFD controllers highly desirable just to simplify communication with microprocessors.
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.
Having the service manual and VFD driver datasheet in front of you significantly simplifies reverse engineering. It took us only a few minutes of googling – and service manual with schematic diagrams were found. After opening up Philips DVP630_632_642 schematic diagram (please find the file attached below) and looking at page 3 it becomes obvious that the player utilises DP501 HNV-07SS61 display from Samsung which is controlled by HT16512. Then downloading datasheet for HT16512 (please find the attached file below) – it is a VFD driver with 11 segment output lines, 6 grid output lines, 5 segment/grid output lines 4 LED output ports, a control circuit, a display memory and a key scan circuit. Serial data inputs to the HT16512 through a three-serial interface – just what we need!
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
Let’s have a closer look at the VFD and its driver. For an external device VFD is accessible through a serial interface as static RAM. The display has 7 digits (symbols) by 16 segments. Each symbol is defined by two bytes (16 bits), so in total 14 bytes are used. A symbol is encoded by a combination of bits, a bit set to ’1′ makes a segment to glow. Most significant byte comes first, most significant bit also comes first. So, in order to display very first symbol on the display as ’1′ the first byte of RAM should be set to value 0x20 and the second one – to value 0x6. In other worlds, we need to set bits 13, 2, 1 to logical ’1′ and in binary representation it looks as 0010000000000110b.
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
Now when we have full control over VFD display, it is time to build something meaningful. How about remotely controlled clock with temperature sensor? Boring? Well, it will be unusual device: capable of working from virtually ANY type of remote control, with display activated by a motion sensor, with capability to log current temperature to an external USB host (i.e. PC, laptop or Android phone) and in custom made acrylic enclosure!
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
Also we would need extra components, such as real time clock module, temperature sensor, PIR sensor and a basic speaker or buzzer, all of them are available at Sparkfun Electronics. Real time clock module would keep accurate track of the current time with a calendar up to year 2100, capable of surviving power outages and requiring just two signal wires for communication with main processor. Digital temperature sensor with 12-bit precision would require even less – just one signal line to control it. The job of PIR passive motion sensor would be to activate display when motion is detected so that after a predefined timeout the display goes to standby mode saving energy and VFD resource and making the device more interactive. The purpose of buzzer is to demonstrate that the microcontroller still has some computational power to generate primitive sound so the clock might be easily converted into alarm clock.
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
Fully assembled electronics is shown on the picture below (though the connector to RTC module is temporary disconnected and PIR sensor is not shown yet wires on the bottom on the picture lead to it).
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
To give any electronic project a neat look it is always very important to put it in an enclosure of appropriate sizes and shapes. Our VFD clock is not an exception and also needs a box. There are at least three ways to do so. First is to find something off-the-shelf. This is probably the cheapest and less time consuming solution. The problem is that there is literally no chances to find a box that does not look bulky and ugly and at the same time is capable of accommodating our long VFD panel and power supply along with some room for Freeduino board. Moreover, a box would still require some substantial efforts to secure boards and the panel inside by drilling many holes and in the end would look ugly anyway.
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/