The latest version uses a 4 lines x 20 characters LCD that connects via I2C as well as a rotary encoder with a push button. While the display got its own little board, the encoder connected directly with the solar charger where its signals aredebounced in hardware and then routed to the PIC. And it was not very elegant that the display was powered off by just cutting the entire power supply. I then decided to design an new board that also includes the rotary encoder with all the necessary debouncing. That way I get a quite universal, easy to use user interface that I can use for other projects as well.
|Published (Last):||4 December 2016|
|PDF File Size:||16.97 Mb|
|ePub File Size:||7.65 Mb|
|Price:||Free* [*Free Regsitration Required]|
The latest version uses a 4 lines x 20 characters LCD that connects via I2C as well as a rotary encoder with a push button. While the display got its own little board, the encoder connected directly with the solar charger where its signals aredebounced in hardware and then routed to the PIC.
And it was not very elegant that the display was powered off by just cutting the entire power supply. I then decided to design an new board that also includes the rotary encoder with all the necessary debouncing.
That way I get a quite universal, easy to use user interface that I can use for other projects as well. That eliminates the need to design the same functionality think debouncing again and again. The size of the board is mainly given by the size of the display so there is plenty of board space.
I still need a way to control both the backight as well as the reset signal without needing any more singnals. Since the display connects via I2C it was quite straight forward to use I2C communication for those purposes as well. And PWM control of the backlight would require a great deal of I2C communication which puts a burdon on the microcontroller.
I also considered adding a sub-dollar PIC16 which could be programmed as an I2C slave and control both the backlight and the reset signal as well as giving the option of getting the encoder input via I2C.
Another design requirement was to keep this a very low-power design. To be sure: when the display and especially the backlight are on it will consume several milliamps to several dozen milliamps. But when the user interface is not in use, we need a way to put it in a very low power state where the display as well as the rotary encoder is off but the push button still works in order to wake up the microcontroller. In that state the user interface must not use more than a few microamps.
Furthermore the encoder signals must assume a high impedance state when the user interface is disabled. The digipot should always be either at its minimum or its maximum. The backlight brightness is controlled by the other digipot via an op-amp and a n-channel mosfet.
The debouncing is basically unchanged. Like in the solar charger design , a 74HC quad tri-state buffer is used together with some resistors and capacitors. Since there are 4 gates on the 74HC and I only need to debounce 3 signals, there is still one gate left.
So the enable signal only controls the input of that gate. Well, if you think so too, think again. More on that later. First of all nothing worked at all. I asserted the enable signal and nothing happened. Nothing was powered on. The error was soon found. I made a design error with the result that the respective gate was permanently in a high-impedance state. The mistake was corrected by cutting the ground connection and conecting the respective pin to the enable singal itself which was available from the pin right next to it.
Not pretty see below but problem solved. Then ok, power was there but when I tried to turn off the reset singal i. Again, the reason was simple. On the schematic the wire touched the respective pin but there was no connection. While that was really hard to notice on the schematic I should have noticed the problem when I laid out the board. There was obviously no connection to that pin. This was a bit harder to fix than the previous error.
I ended up soldering a thin wire accross the digipot to a resistor that is connected to VCC on the upper end. Even less pretty but problem solved anyway. Turning on the backlight basically worked as intended but the load was a bit much for the 74HC While it can supply up to 35mA according to the data sheet, its output voltage is nowhere near its positive supply rail when it supplies that much current.
As a result, the display as well as all the other components only get to see about 2. Another issue I noticed was that the LM op amp I had chosen is not a rail-to-rail op amp. The LM is inexpensive and I had quite a few left from another project so I used it without giving it much thought.
They make nice, pretty and affordable displays. But getting them initialized with the right settings is always a lengthy trial-and-error process. The entire initialization sequence needs to be written in one single I2C transmission.
Nor the timing of the reset singnal. The reset signal needs to be pulled low for 10ms. One then needs to wait for 5ms before the initialization sequence is sent. There is an older version in the net somewhere that mentions those timing issues and at least gives a sample initialization sequence. There are various contrast settings that must be set properly via I2C commands but there is very little information on those commands in the data sheet.
I wrote an email to their customer support asking if there is a list of commands the display supports. As so often, google was my friend and others have faced similar problems before so I managed to find some commands that make the display work properly. And the commands for this black-on-white display are different to the otherwise identical white-on-blue display. Have fun…. The logic is pretty much the same here except that I use different non-inverting gates here.
The reason for that is the need for 3-state outputs as mentioned before. Debouncing something like a pushbutton is quite easy. Just use a relatively long time constant i.
That will introduce some delay in the output signal but as a rule of thumb anything below 50ms is not noticable. And a time constant of a few milliseconds is totally sufficient so you might end up with something like 10ms of delay. With rotary encoders things get much trickier. The basic circuit is exactly the same but choosing the right component values is more difficult. So you face the challenge of debouncing the signal while still letting relatively fast transitions pass.
If you use a time constant of a few milliseconds like with the push button you will not be able to detect when the encoder is turned quickly. Toghether with the positive feedback via the k resistors that works very well. I expected to tweak those values a bit but found that they work so well that I just leave them as they are.
But with the hardware debouncing applied here we get a clean, digital output singal nevertheless. Very low standby power consumption was one of the key design goals. When in low-power mode only the push button pull-up and the 74HC is supplied with power. As long as the push button is not pressed, no power flows there so the only power consuming device is the 74HC Its datasheet specifies a maximum static current consumption of 8 microamps worst at room temperature.
When I measured it, this is what I got. Actually the measurement fluctuated between about 0 and 15 nanoamps. So the measurement works and it seems that the 8 microamps given in the data sheet are just a very conservative worst case. I mean CMOS is close to zero-power when static and only a single tri-state gate is active so essentially no current flows. After the two hardware fixes this user interface works quite as intended.
Using the spare gate to supply the rest of the circuit with power was not as good an idea than I thought.
On the positive side the debouncing works just perfect with the chosen component values. And as mentioned, the op-amp was not a great choice for the job at hand. But I like the look and feel of this universal user interface and think the overall concept is good.
So there will be a Rev B of this board with those issues solved. Here you find the eagle files as well as PDFs of the schematic and board. Requirement: Ultra Low Power State Another design requirement was to keep this a very low-power design. My final solution was as follows: Use the previous backlight PWM signal as an enable signal. Power can now always stay on. When the enable signal is high, the display is on, when enable is low, the user interface goes into its low-power state.
Add a dual I2C digipot to control both the reset signal as well as the backlight. Testing First of all nothing worked at all. Power consumption Very low standby power consumption was one of the key design goals. Next steps After the two hardware fixes this user interface works quite as intended. DIY Electronics.
Tag Archives: 74HC126
Plastic Package. The LM is inexpensive and I had quite a few left from another project so I used it without giving it much thought. Next steps After the two hardware fixes this user interface works quite as intended. I also considered adding a dattasheet PIC16 which could be programmed as an I2C slave and control both the backlight and the reset signal as well as giving the 74ch of getting the encoder input via I2C.
74HC/HCT126 Quad Buffer/line Driver; 3-state
FAIRCHILD SEMICONDUCTOR MM74HC126M Buffer / Line Driver, 74HC126, 2 V to 6 V, SOIC-14
74HC/HCT126 Quad Buffer/line Driver; 3-state