I started this project so that I could easily dispense a preset amount of water into my brew kettle when brewing beer.  My local brew club has a brew house and currently has hoses attached to the water filtration system.  Instead of waiting to fill up jugs of water this device will allow me to set 6.5 gallons, turn on the water and it will automatically shut off at the preset volume of water.  This lets me get started on other things while the water is dispensing and assures an accurate water level.

Parts include:

Arduino Uno $25 but will be replaced with a $3 ATMega Chip Later
YF-S201 Water Flow Meter $11
LCD Display Panel $5
ECHOTech Solenoid Valve $9

WP_20130310_001

The flow meter is hooked up to the Arduino and there is a basic program uploaded that displays the flow rate and total volume of water that has passed through the flow meter.

Below is a video of the flow meter working.  I had to tweak the program to take measurements every 1/8th of a second.

The flow meter in action.

TODO: Wait for solenoid to arrive.
TODO: Code the reset button, Volume Up and Volume Down buttons.
TODO: Hardwire circuit to breadboard for compact mounting.
TODO: Mount in project box (waterproof).

This version of the board looks a little better.  Wired the ground and +5v on the back (and one data line) to reduce the number of line crossings.  There are still two but far better than the first layout.  It follows the same schematic from the original post.  I also added a 470 Ohm variable resistor between the backlight (Pin 15 of the 16 pin header) and the +5v.  (My Dremel skills need reevaluation.)

WP_20130203_003

WP_20130203_004

Here is a video link of the backpack operating.

The completed project with a glimpse at the breadboard prototype version.

This is not the first serial backpack for Arduino and it wont be the last.  I wanted to build one of these because I did not want to pay $16.95 plus shipping for something that could be built for $1.11.

Here is the parts list:

1 x Small Stripboard $0.66
http://www.taydaelectronics.com/small-stripboard-94x53mm-copper.html
1 x 74HC595 8 bit shift register $0.20
http://www.taydaelectronics.com/74hc595-8-bit-shift-register-ic.html
1 x 10pf Ceramic Disc Capacitor $0.01
http://www.taydaelectronics.com/capacitors/ceramic-disc-capacitors/10-x-10pf-50v-ceramic-disc-capacitor-pkg-of-10.html
1 X 40 Pin Pin Header $0.24
http://www.taydaelectronics.com/40-pin-2-54-mm-single-row-female-pin-header.html

The finished product looks like this.  I did a pretty bad job of laying out the wires so there is some overlap.

WP_20130202_003

 

 

 

WP_20130202_006

 

 

 

Here is my feeble attempt at drawing out a schematic.  I used visio so I did not have the luxury of rerouting tools like Eagle has.  Maybe I will try that next.

SerialLCD3Wire2

I used the LiquidCrystal_SR3W.h from here: https://bitbucket.org/fmalpartida/new-liquidcrystal/src/bebe49d613c15933d3c2f41721f707526adc32dc/LiquidCrystal_SR3W.h?at=default

I wound up with this Arduino sketch to do a simple hello world app that outputs the current millisecond and animates an X across the second row of the LCD.  It’s pretty basic but I can now use this in my projects that need to provide the user with a display.

I got the schematic from this link: http://www.electronics-lab.com/projects/mcu/015/index.html

My previous post has a description and laundry list of parts I used.  I wanted to learn how to use the 74HCT595 shift register chips.  These chips are really cool because you can daisy chain them together and then simply shift bits of data into the DS serial input.  The data will write out across all the chips in the chain and you only need three digital IO ports for any number of 595’s in the chain.  You just write out 8 bits of data for each chip.  So if there are 4 595’s chained together you write out 32 bits of data. 

The 595’s operate 8 active low output ports which means they are LOW when there is a (0) bit shifted in to the corresponding pin’s register and HIGH (Vcc) when there is a (1).  So 2 chips let me turn on the positive columns of the cube.

The MC74HC138A I used let me turn on and off the connectivity to the negative voltage.  I only needed 4 of the 8 pins because I only have 4 horizontal rows of cathodes to switch.

The code attached to this only runs a test pattern that appears to turn on all the LED’s in a layer and cycles to the next layer.  I did this to catch some solder points that came undone.  Next I am going to work on building some animations for the cube like rain, sinking letters, bouncing ball…etc.

Here is my parts list with prices:

2 X 74HC595 Shift Registers @ $0.20 each
64 X Blue 5mm LED’s @ $0.038 each
16 X 470 Ohm resisters @ $0.01 each
1 X MC74HC138A @ $0.29

So that was $0.88 in parts if you don’t count the $29 Arduino.

Previous post:
http://davidsandor.com/blog/post/2012/04/29/Notes-on-4x4x4-Arduino-LED-Cube.aspx

Arduino Code

So I decided to jump in to serial communication.  Why not?  I have a ublox LEA-5H-0-009 GPS Receiver and a GS407 break out board from sparkfun.com. I connected the red (3.3v) and the black (gnd) from the GPS to the netduino.  There is a TXO and RXI pin and a GPIO pin on the GPS break out board (BOB).  I admit, I had to google a lot.. I mean a LOT to figure this one out.  Eventually I found a great article from blog.bobcravens.com with 99.9999% of the solution.

http://alphafn.com/oldpics/2011-08-05 15.35.28

I learned a lot about serial communication from reading Bob’s article.  In summary, what I learned is that I can use D0 and D1 on my netduino as a serial port COM1.  D0 is COM1 IN or RX and D1 is COM1 OUT or TX.  The last piece of the puzzle was the GPIO pin on the GPS.  Clueless me had no idea what to do with the GPIO pin.  After reading his blog, it seems that is used to turn on and off the power.

Here are a few better views of the connections.  Ignore the IC chip and the three axis sensor on the project board.

http://alphafn.com/oldpics/2011-08-05 15.35.38

http://alphafn.com/oldpics/2011-08-05 15.35.28

When I first connected the device I was getting nothing from it because the TX and RX were flipped.  Then, I started getting bytes from the serial port but they were poorly formatted and I could not convert them to UTF.  This caused errors when using the System.Text.UTF8Encoding.UTF8.GetChars(buffer); code.  As it turns out the baud rate needed to be 9600 and I had it at 4800.  After that fix I was set and I was getting NEMA messages.

It does not look like it is picking up a signal yet but that is my next step.  Get the messages decoded and get the device to lock on a few satellites.

Here is the code I used which I got from Bob’s post and tweaked a bit as I was running into issues decoding the bytes because of the baud rate issue.

So the Variable Resistor (POT) was cool and really easy.  So there is another sensor in the box which should work pretty much the same way.  The thermometer also has a red, black, and white wire so this tells me it works the same way.  Analog circuit based thermometers are called thermistors which mean they are variable resistors that change the impedance based on a temperature.  So my code should look the same as my Day 1’s blog entry.

I added a debug statement to output the actual thermometer value.  I quickly noticed that my room temperature reading was a 422 or 424.

The output window looked like this:

So breathing on the thermometer yielded about a 500 reading.  So there was a 78 point difference, the LED was blinking slower as the temperature went up but not noticeably.  So enter some math to make the spread more apparent.  I decided on a simple algorithm, take the value from the thermometer, subtract 422 to get the difference and multiply by 10.  I figure this would generate a more obvious change in blink rate.

I added the System.Math.Abs() method call to ensure that I did not pass a negative number to the Thread.Sleep() method call.  The code looks like this and flashes faster as the temperature nears room temperature and slower as it gets warmer.

My friend Todd stuck four red boxes in the trunk of my car and told me I needed to master embedded programming against one of the three boards in the boxes: Netduino, Arduino, and a FEZ Panda II.  This is the beginning of my endeavors into embedded programming.  I have tinkered with electronics in the past but could not quote any of the electrical laws.  I have been programming for 15 years though most of that with .NET / C# since it was in pre-beta so this should be pretty simple.  I decided to blog my learning process in case another electrically challenged developer finds him(her)self in the same position as me.

My first blind project I decided to tackle is blinking an LED on the netduino board with a delay controlled by a variable resistor (knob).

So I grabbed an E-BLOCK POT VARIABLE RESISTOR which has 3 wires: red (positive), black (negative), and white.  The red and the black were pretty obvious.  I hooked the red up to the 3.3v on the netduino’s power block and the black to ground. 

image

The white I figured was the output.  This is clearly an analog device so I figured I should hook up the white to the Analog 0 (zero) pin on the netduino.

I saw some articles on flashing the LED on the board and that seemed pretty simple so I just needed to figure out how to get the resistance value from that white wire.  I quickly found the AnalogInput class and with some intellisense I found out that the constructor took a Cpu.Pin value to read the analog input.  Further object browsing showed me a higher level class supplied in the netduino SDK that humanizes the Cpu.Pin enums.  The SecretLabs.NETMF.Hardware.NetduinoPlus.Pins.GPIO_PIN_A0 pin looked like the one I wanted.

Next I found the OutputPort class that let me play with the LED.  I passed SecretLabs.NETMF.Hardware.NetduinoPlus.Pins.ONBOARD_LED to the constructor there and this lets me set the LED on and off.

Executing the code resulted in the video below.  As I turn the knob of the POT the value read from the analog input changes thus changing the value input into the Thread.Sleep() method. So the LED flashing is relative to the amount of resistance on the variable resistor.

The final product, I showed the wife and she was not that impressed 😉