These are PCBs recently manufactured for a VFD project. Aiming at very small initial quantity and rather compact 100×25 mm dimensions BatchPCB was considered an ideal service for making our PCBs. But in the end it turned out that shipment from US would be ridiculously expensive and simply not being worth ordering. That was the turning point when ITead Studio has been discovered. The company offers very attractive deals for small PCB batches and especially prototyping but in order to take full advantage of their prices PCBs dimensions should somewhat correlate with the factory’s blank sizes. That way even greater economy might be achieved significantly cutting down expenses for prototyping and small runs.
So what is so special about the service from ITead Studio? To begin with, they have a bit different approach by providing certain number of blanks with predefined sizes, let’s say, 100×100 mm, 100×50 mm, 50×50 mm and so on. A customer is offered to buy a service, for example, 10 blanks of 100×50 mm with specific parameters such as material type and thickness, mask and silkscreen colours etc. And then after uploading PCB design in Gerber format the factory house takes care of everything else. For instance, they do panelisation by themselves, without even asking you. In our case, having ordered 100×50 mm service and PCB dimensions 100×25 mm we ended up not with 10 but 20 PBCs, they just silently managed to fit two PCBs on each blank!
The prices are very attractive, for 100×50 mm service they ask just $25 (or even $22 if you’re happy with green color for the mask) for 10 (or even more depending on how many PCBs can fit on one blank) PCBs. Another significant advantage is an absence of tooling fee which brings the overall cost to a level way less than $100 which was literally impossible until now.
Add to this friendly e-mail notifications, really short lead time (just 7 days), and an option to choose really cheap shipment which by the way is not that slow, took two weeks in our case to deliver a parcel from Hong-Kong to Australia and cost us less than $6. Indeed, PCB manufacturing has never been so affordable for hobbysts as it is now.
These days LCD modules become cheaper and cheaper and finally they are getting to the point when it is practical to use them for hobby projects without substantial budget increase. Not only projects significantly gain in functionality and usability but also in aesthetic matter. So we decided to test one of these LCDs and have a look what it can do and what it can’t. After some shopping around our choice has fallen to 3.2″ TFT LCD Module Display that was advertised on ebay. The list of claimed features was quite impressive: brand new display, 3.2 inches with resolution of 320×240 pixels, 262k colors, touch screen controller, SD card socket and 8/16 bit data bus – all this was for just US $13.98 with free shipping.
The item was shipped next day after payment and was delivered a few days after – promising beginning. But there were a few little surprises upon close up visual inspection of the arrived item. First of all, it didn’t look like brand new. There were many scratches on the display’s protective film and evidences of manual re-soldering of one chip on the PCB’s bottom side. The seller didn’t want to damage his feedback history and quickly admitted that the item’s condition might be not immaculate. Then, to save his time and money, he basically suggested to refund half of the costs. Before we gave him a definitive answer we wanted to make sure if the display was functional at all. And immediately faced the second problem – it was absolutely unclear what type of display it was and where to find its 40-pin header pinouts. Normally, such displays have a pinout table on the bottom PCB’s layer, this one didn’t have anything. Also it would be very helpful to find schematic diagram to figure out what components have been used and how they interact with each other.
We searched the Internet for any similar display and found ITB02 module from Itead Studio which has been documented quite extensively and which came with circuit diagram, chip datasheets, detailed pictures and C libraries. Everything looked the same but the was… pinouts mismatch. ITB02 module had powerful software support of UTFT library designed by Henning Karslen but it order to use it we still needed to find pinout for our module.
LCD’s pinout mismatch
Eventually a module with the same header pinout has been found, it was Connan TFT-3.2. Connan came with absolutely horrible schematic diagram, half-English / half-Chinese and messy library/demo code. As it turned out, in our possession was one of these modules with no silkscreen legend and SSD1289 LCD controller instead of HX8347. Further comparison with UTFT_Requirements.pdf from UTFT library revealed that pin designations were somewhat the same for both display types, the really difference was in the actual pin numbering – pins from 1 to 20 were numbered in the opposite order! As a result of the effort the following table below was created, defining relation between signal names and pin numbers for both display modules.
Must be pulled high (3.3v)
LED backlight, connect to +3.3v rail
+5v or +3.3v (see descr. below)
UTFT library had a detailed description of how to connect LCD modules to a variety of Ardiinos and Chipkits. However, it had a few very important things missing.
First, it was not explicitly stated anywhere that these LCD modules ARE NOT 5v tolerant. Surely, it is possible to power them from 5v source but signal lines and LED backlight must not be exposed to levels greater than 3.3v. At the same time, many Arduinos work in 5v range so strictly speaking level converters should be used, for example, like ITDB02 Arduino Shield. All this, undoubtedly, makes the total project cost higher and dimensions bigger.
Secondly, it was not mentioned that LED backlight must be connected to +3.3v as well – without it the LCD’s usability becomes second to none as it is literary impossible to distinguish anything on its dark screen.
To make it even more confusing, our LCD contained 3.3v onboard regulator that obviously does not work if only +3.3v is applied to VCC pin – the voltage is just not high enough. There is a way to bypass the regulator if you power your LCD off 3.3v source – JP1 should be closed, making regulator’s input and output pins connected together.
Bypassing voltage regulator – JP1 must be shorted
Now when it is clear with the LCD itself, it is time to physically connect it to a microcontroller and put everything together. We decided to test the LCD in tandem with Freeduino that had ATMega328p oboard with UTFT library. There was one trick to be made in order to fit everything into 32 kB – uncomment everything but #define DISABLE_SSD1289 in memorysaver.h so it would look like code snippet below. That way the final code was much more compact due to elimination of redundant code.
We combined UTFT_Demo_320x240 with UTFT_Textrotation_Demo and UTFT_ViewFont, the resulting sketch is available here: Combined_UTFT_Demo_320x240
The Connan TFT-3.2″ LCD in action is shown below. There are the following drawbacks that we managed to find, both related to changing the displaying content. First, the overall transfer speed is not very impressive despite the fact that 16-bit bus was used. It takes a few moments to fill LCD’s video memory from its beginning to an end. This solution is obviously not for displaying moving sprites or updating the full screen a few times per second. Second problem is that there are some artifacts during the moments when graphical information is being updated – visually it looks like multiple flickering white dots and lines, there is also a possibility that we have a faulty LCD in our possession.
Connan TFT-3.2″ LCD in action
As a conclusion it would be worthwhile to highlight pros and cons of this LCD. Let’s start from the positive side:
1. Cheap and affordable,
2. Makes hobby projects to look professional and modern,
3. Great for rapid prototyping,
4. Excellent software support.
However, there are the following disadvantages:
1. A limited edition of ITDB02-3.2S with poorer quality and confusing pinouts,
2. Absence of documentation,
3. Intolerant to 5v signal levels,
4. No 1:1 compatibility with Arduino pins,
5. Too many signal wires with no significant advantage in performance if compare with LCD’s with serial interfaces,
6. Not very compact when used with Arduino and ITDB02 Arduino Shield,
7. Not cheap when used with ITDB02 Arduino Shield.
And finally, as you probably noticed, we haven’t described all signals that are wired up to the LCD’s 40-pin header. There are datalines for interfacing with SD card and touch screen controller – they will be topics for our future articles.
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 compromising solution 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.
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.
Exported To Ponoko Template
Enclosure Arrived From Ponoko
To download VFD MagiClock Enclosure Drawings in Google SketchUp and SVG formats please feel free to hit this button:
Our ‘Remotely Controlled Camera’ project grabbed second prize at Instructables.com. We’ve been given annual membership at Instructables, a T-shirt and a remotely controlled helicopter! Thanks to everyone who voted for us and special thanks to Instructables and contest sponsors! It was fun!
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.
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.
RTC Module Sparkfun (BOB-00099)
DS18B20 Sparkfun (SEN-00245)
Buzzer Sparkfun (COM-07950)
PIR Motion Sensor Sparkfun (SEN-08630)
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.
Time to connect modules together. Two pictures below show pinouts for signal and power lines on our Freeduino board.
Freeduino Schematic Diagram Pinout
Freeduino PCB Pinout
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.
VFD MagiClock PIR sensor bypassing voltage regulator
VFD MagiClock StandBy Wire Connection
Here is the signal mapping table between Freeduino board and the remaining components (please also refer to DVP630 Schematic Diagram):
VFD panel-Q581-base, via 1kOhm; R582 must be unloaded
VFD panel-RB501-5, RTC Module-5V Pin, DS18B20-VCC Pin, PIR Sensor-in bypass of voltage reg.
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).
VFD MagiClock Electronics Assembled
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 feel free to hit this button:
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):
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.
In order to control DP501 HNV-07SS61 VFD in an effortless and efficient manner the following software driver has been implemented. The functionality is encapsulated in HT16512.cpp and HT16512.h files and designed for AVR processors. To drive communication interface the logic uses PinMode and DigitalWrite functions provided by Arduino low level library. Also new HT16512 class inherits Arduino’s Print class to simplify output to display even more. However, despite those Arduino’s dependencies the code might be easily ported to PIC or ARM architectures.
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.
1. Initialisation and low-level methods
1.1. HT16512 constructor
Constructs a new instance of HT16512 class and assigns three interface pins for communication. For more information about mapping between pins and pin numbers please refer to pins_arduino.cpp;
CS, SCLK and DATA pin numbers appropriately for physical communication with VFD;
1.2. Reset method
Sets three pins as outputs and their initial states, sets VFD driver mode (7 digits, 15 segments), switches display on with maximum brightness. Resets flashing attributes;
1.3. DisplayOnCmd method
Switches display on and sets display brightness;
void displayOnCmd(uint8_t dimming);
The 8-step dimmer value from 0 to 7 defines accordingly 1/16, 2/16, 4/16, 10/16, 11/16, 12/16, 13/16 and 14/16 pulse width. The 1/16 pulse width indicates minimum lightness. The 14/16 pulse width represents maximum lightness;
1.4. DisplayOff method
Switches display off;
1.5. DisplayWriteCmd method
Writes data to display memory. The address might be set in advance by means of addrSetCmd(uint8_t addr) method;
If addr_inc is set to true then HT16512 increments address after data has been written.
If nodata is set to false then CS line is set back to HIGH after command byte is sent to HT16512 meaning end of command transmission;
1.6. AddrSetCmd method
Sets the address of the display memory;
void addrSetCmd(uint8_t addr);
Addr has the value to be set to. If address 0x16H or higher is provided, data is ignored until a valid address is set;
1.7. Command method
Low level function for sending a command;
Value is a data byte to be sent,
init_cs should be set to true to pull CS line LOW before initiating data transmission (and normally this parameter is set to false because CS is already set to LOW before command byte transmission),
finalise_cs must be set to true only for the very last data byte in a single transmission;
2. Tests and visual effects
Tests and visual effects are represented by methods with Test and Effect suffixes in method names. Each method has to be invoked more than once in order to be completed. Upon completion methods return FALSE. In order to perform all available tests one by one there is a testStep(void) method that might be invoked from user code by a timer routine. Current test is kept in _tstState variable that can be assigned to one of the following values:
To run through all available tests subsequently, it is enough to invoke uint8_t HT16512::testStep() on a periodic basis and do it until the method returns COMPLETED result. Internally, this method invokes one by one the following tests:
3. Methods for direct access to HT16512 without intermediate buffer
3.1. Write byte method
Outputs ASCII character to display memory using current address. The address should be set in advance by means of void HT16512::addrSetCmd(uint8_t addr). When address is set more than one character might be sent to display memory as address is automatically incremented by VFD driver. To display one character two bytes are used so the address is incremented twice per a character resulting maximum of 7 (seven) consecutive invocations of this method after which address must be set to 0 (zero) again. Not all characters from ASCII table could be displayed – please refer to const PROGMEM uint8_t FONT_PGM array;
void write(uint8_t value);
value – ASCII character to be displayed;
3.1. Write byte array method
Outputs raw byte array to display memory using the provided address start value. No need in setting address in advance as it will be overriden in this method. Unlike the previous void write(uint8_t value) method no conversion of ASCII code to VFD segment codes is performed;
buffer points to an array of raw bytes to be displayed,
dstIndex defines address in display memory,
len is a number of bytes to be written;
Number of bytes written;
4. Methods for intermediate buffer operations
The is no way to read data from display memory and there are situations when it would be extremely good to have that feature – for example, to read and modify the content that is currently being displayed. Introduction of an intermediate buffer allows us to have this feature and it makes possible to implement ‘blinking’ (or ‘flashing’) functionality.
4.1. Write_f byte method
Outputs ASCII character to intermediate buffer. Similar to 3.1 Write byte method but uses intermediate buffer instead of direct access to display memory;
value – ASCII character to be sent to buffer,
dstIndex defines address in buffer,
dispColumn is set to TRUE if ‘:’ colon should be displayed as well (applicable only for digits 3 and 5, counting from left to right starting from 1);
4.2. Write_f byte array method
Outputs raw byte array to intermediate buffer. Similar to 3.2 Write byte array method but uses intermediate buffer instead of direct access to display memory;
index defined as zero or greater but less than VFD_DIGITS gets a blinking state of a digit. Otherwise blinking states for all digits will be given as a result;
Returns TRUE if a digit is in blinking mode and FALSE otherwise. If as input argument a value equal to VFD_DIGITS or greater was used then the result indicates blinking states of all 7 (seven) digits in 0…6 bits;
4.8. FlipFlashState method
Flips flash state of the display content. Should be periodically invoked by user code to visualise blinking. Note, than this method only changes the logical state of blinking, immediately after 4.5. FlipFrame method should be invoked;
The code below demonstrates how to initialise our VFD driver:
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.
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 DVP 630.
Philips DVP-630 VFD PCB
Philips DVP-630 Power Supply
A few more minutes – and service manual with schematic diagrams was found as well. After opening up Philips DVP630_632_642 schematic diagram 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 – 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.
Philips DVP630 VFD PCB hacking points
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.
HNV-07SS61 HT16512 Segment to Bitmapping
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 article we will go through this process.