-
Log Entry #4 : The Water Wheel Display
08/10/2014 at 20:21 • 1 commentSo, I got a little distracted. I was thinking about the user interface for the receiver end of this project. I've always planned on using a 4-line LCD ( or VFD ) display to present water consumption data to the end user. But it occurred to me that once a person is used to the box sitting there they won't notice it much. Since the whole point of the project is to remind and notify users of their water consumption, I'd need to add something a bit more obvious as an output device in addition to the text display.
I decided that what I needed was a ring of LEDs. One LED would always be lit, and it would step around the circle at a rate that corresponds to the water flow rate as measured from the meter. When the user walked through the room containing the display it would be difficult to not notice the moving display, particularly if it's spinning madly indicating a large flow of water.
I felt that using 16 LEDs would present a nice, contiguous circle. If you look around the web you'll see dozens and dozens of people driving rows of LEDs with shift registers, like the 74HC/LS595. Unless they only ever turn on one or two LEDs at a time, they're all doing it wrong. The '595 can't handle that much current. To drive my display, I chose the TLC59282 from Texas Instruments, available from Digikey. This part is a 16-bit shift register, but it adds constant-current sink drivers to all the outputs. Choosing one resistor sets the current for all of the LEDs. Further, it has a "BLANK" input which enables/disables all of the LEDs.
It also occurred to me this circular display could be handy in other circuits and applications, so decided to make it a stand alone sub-assembly. I almost always breadboard my circuits before committing to a PCB design, but this chip is so simple that I went ahead and ordered PCBs and components at the same time.
NOTE: You can buy these boards! I will post links to the gerbers (when I figure out how) but in the mean time, if you would like to use this display board for one of your projects you can buy them (in sets of three) from OSHPark.com here. I do not make a penny off of this! I simply set up OSHPark to share my design, and others can order board sets directly from them.
You COULD install all of the parts on the same side of the PCB, but my intent is to install the LEDs on the front side, and everything else on the back. If I end up installing this behind something like a tinted panel, I may want to paint the front side (before installing the LEDs) with flat black paint so that you won't see anything but the LEDs through the panel.
The single resistor sets the current level provided to all of the LEDs connected to the display. The data sheet provides a large table to select this resistor value based on desired current and supply voltage. In my case (5V supply, 20mA) the value came out to 2.5K ohms.
It took a little time to select the LED I used. I wanted it to be blue ( because ... well ... water), I wanted it to be in a diffused package so it wasn't glaring, and I wanted to to be fairly low power. I finally found the MT5470-BL, available from Digikey. I am very pleased with these LEDs except that they are still VERY bright, far too bright for this application. Luckily there is the "BLANK" pin on the driver chip. I set up the microcontroller (PIC16F1509 in this case) to generate a PWM signal, and applied that to the "BLANK" pin of the display driver. This approach worked very well, and I found that providing a duty cycle of about 5% on time gave me the brightness I wanted. What's more, if I have time this opens up the possibility of including an ambient light sensor and have the system automatically set the LED brightness based on how light it is in the room.
Now, in this application, there will be a single LED lit and it will progress around the circle indicating water flow. But, having the working board sitting here I could help but play with some other possibilities. Here's a video of a little demonstration program I wrote to show gratuitous flashing of LEDs. :-)
And finally, here is the schematic of the LED Circular Display.
This LINK will take you to a better printable version of the drawing.
UPDATE:
I've written a fuller description of this display board on my main website. You can view it HERE.
-
Log Entry #3 : The Sensor Works!
07/15/2014 at 21:35 • 1 commentSome notes to go with that video...
You'll probably notice that the display jumps around quite a bit. The sensor itself does 80 measurements per second, but sending the data out the serial port, and through the LCD serial backpack is VERY slow. Bear in mind that in the final design the sensor will not have any display so the microcontroller will be able to accept data at a MUCH greater rate. Further, the actual data does not get sent back to the display module, the microcontroller just uses that data to determine revolutions of the meter shaft.
The sensor also allows for over-sampling (kinda like averaging) which I have turned off for this test. I'll probably set it to 4:1 over sampling or so in the final unit which will make the readings much more stable.
So next, remove the display electronics from the breadboard and replace them with the transmitter, and then breadboard up a test receiver. I'll also be working on the solar charged batteries at the same time. More details about that in the next build log.
-
Log Entry #2 : Sensor Testing
07/10/2014 at 15:52 • 0 commentsMy entire project depends on the MAG-3110 sensor being able to detect and measure the field of the magnets buried inside my standard water meter. To test my presumption that it would I had to build a test system. It's really pretty simple. The brain of the tester is a PIC12LF1840 microcontroller. I'm using this because it's what I plan to use in the final design and software I develop for the tester can be recycled into the final unit. I chose the 12LF1840 8-pin PIC for a few reasons: First, it is a VERY low power part (expected to draw about 10uA with Vdd at 3.3V) and since this will be a solar charged battery powered circuit, low power consumption is crucial. Second, it has plenty of program memory (4K words). My background is electronics, not software, so having a little extra breathing room in the code space may be handy. And finally, this microcontroller contains a "MASTER SYNCHRONOUS SERIAL PORT" (MSSP). In short, the MSSP hugely simplifies programming the I2C bus, which is how the controller communicates with the MAG-3110 sensor.
For this test I'm just going to me moving the sensor around the water meter, so obviously I need so way to see the readings in real-time. To accomplish this I added a 4 X 20 character LCD display. I also added a serial backpack to the display which allows the microcontroller to output data as RS-232 (as opposed to have to deal with all the pins required for a direct LCD interface). Again, this also allows for code reuse since the transmitter I've selected for the project accepts serial data. In the final design there will be no display at the transmitter end.
The microcontroller and sensor both operate at 3.3 Vdc, but the LCD display and backpack require 5Vdc. I chose to run this evaluation circuit off of batteries so I didn't have to drag an extension cord and a power supply out to the street for the test. The battery power is directed to a 5V regulator to provide power to the LCD and serial backpack. The 5V also feeds a 3.3V regulator which powers the rest of the circuit.
The final issue is that the microcontroller outputs a 3.3V RS232 signal, and the serial backpack requires a 5V signal. I dropped a level shifter chip in the signal path to boost the serial line to the proper voltage for the backpack. And as you can see from the photo below, it all works.
The source code for this evaluation circuit can be found HERE.
The next thing I need to do is build an extension cable for the sensor to get it off of the breadboard and allow me to position, and move it around the water meter. Since this is a one-time-use evaluation circuit I am just going to leave it on the breadboard. Once the test is done I'll be removing the display and backback, and replacing it with the RF transmitter (as well as rewriting the software for the microcontroller).
-
Log Entry #1 : Initial System Design
06/18/2014 at 21:01 • 0 commentsIn the above video I go over the basic system block diagram, review the components I've selected, and discuss the next step in the project.
MAG3110 3-Axis, Digital Magnetometer (datasheet)
MAG3110 3-Axis, Digital Magnetometer (breakout board, Sparkfun)
TWS-BS Transmitter Module (datasheet)
TWS-BS Transmitter Module (Sparkfun)