LCD Display with Backlight

There is a tutorial and code on the Arduino site on how to  use a 74HC595 shift register  to control a LCD Display here http://playground.arduino.cc/Main/LiquidCrystal.  The Garden Station project uses a modified version of this library which adds the facility to add a second shift register for a second set of outputs, which I used to control the LED statuses.  I’ve also used the QC pin to control the backlight via a MOSFET.   As part of this I added a few extra methods (void setSecondPins(uint8_t secondPins),backlightOn() and  backlightOff() ).   The code is checked into github:-

https://github.com/markmoro/lcd_display_backlight

The garden station code has also been updated to use this code.

 

USBtiny ISP

I ordered a USBtiny a few weeks ago from ebay to use to program the garden station and it arrived today!

Image

Got it up and running an it works great!  I was previously using a spare Arduino Uno board but this new programmer is simpler and doesn’t require a bunch of jumper wires via a bread board (also frees up the Arduino for something else).   The power also seems to work to power the board via the programmer.

I had to bend back the spare data pins on the prototype board (they were right next to the ISP pins), however I’ve already moved them on the SMD version of the board.

Garden Station

As mentioned on a previous post here are a few more details on the garden station project.   The aim of this project is to build a simple garden watering controller.  As part of this I also wanted to get some PCB’s made to try out getting some made and a sent to me.   I used seeed studio to get the PCBs made and they came out great (although they do take about 4 week to get).

The basic premiss of the garden station is that there are 5 watering sensors, a temperature sensor, 5 servos (used to control water), 6 LEDs, 3 buttons and an LCD display for setup.   I’ve also added ICSP with 2 extra pins to allow for ethernet or SD card expansion via SPI.  On the final version which is not yet built there is also a MOSFET to switch on and off the LCD back light.  I’m building a few of these boards and will probably use them as general purpose control boards for other projects.

The circuit diagram, PCB layout and code are available from github.

I’m still in the middle of this project but have a working prototype from the original through hole PCB:-

board

As you can see there is some hacks on the board around the shift registers as there were some error on the original circuit (confusion of Eagle’s 595 pin names..).

The working of the circuit is reasonable simple.   6 of the analogue pins are used to provide the input for the moisture sensors and temperature.  I’m using 2 nails which there are plenty of internet articles about.   These go to the screw connectors at the bottom right.

There are 5 PWM outputs to control the servo valves.  These are the bottom middle connectors on the picture above.  I use a small break out board to connect the servos which are all located together.   My original plan was to run long wires to near the plants but in the end I decided to keep them all next to the board (its currently all in an Ice Cream tub…).   The servo are connected to some Pope valves which connect to small 4mm hoses.   These are attached together with a hot glue gun and some paper clips agh the moment, although I’m getting a friend to 3D print some proper brackets:-

servo

I’m also looking to direct drive via a cog when the mounting bracket has been made.

Display and Buttons

At the top of the board there are some connection for the display and the input buttons.   These are not the same as a standard display pinout on the original prototype (hence the wire soldered straight in).   On the SMD version theses have been fixed.   The display is controlled via the first shift register in order to reduce the number of pins needed.

screen

The second shift register controls the LED’s on the board and uses the overflow from the first (hence no extra pins needed).  The last two outputs on the second shift register are used to control the backlight and provide the power for the moisture sensor in the SMD version.

Finally there is a set of 8 pins used for ICSP (6 pin with the 2 top pins being extra data output intended for SPI ethernet or SD card).

I’m still testing but will post some video of the prototype running in the future.   I’ll also be ordering all the parts for the SMD version in the next week so will post the details when thats done!

GardenStation Intro

This project is simple ATMega based plant watering system.    This automatically monitors the soil and water when necessary.

The current prototype is built on a through hole PCB (made at seed studio).  There was a couple of issues withe the prototype build.   The 74HC595 shift register was wired slight wrong and the display interface had a couple of issues.   These have been fixed in the SMD version (I will go and fix up the through whole version).

The moisture sensor uses a couple of nails and the water valve are made from an off the shelf hobby servo and a manual valve.  There is also provision for a temperature sensor and using the ICSP and a couple exposed pins it should be possible to add a simple SSD card for logging or ethernet module for networking.

I will post a more complete description in the next couple of days. The circuit,PCB and code is available on github – https://github.com/markmoro/garden_station.

Car Lights

Got a kids ride-in car with no lights or battery indicator?   If so this is the project for you.

The goal of this project was to create a simple microcontroller board that will control  some indicator lights, hazard lights and battery monitor for the kids ride on car below.

Kids car

Kids car

Circuit

The project uses an ATTiny84 micro controller to control all the lights an monitor the battery level.  This can be build on a simple piece of stripboard.  Here is the original circuit diagram and stripboard layout. There was a couple of minor change in the final version which we’ll discuss later.

circuit_layoutstrip_layout

Firtzing was used to create the circuit and stripboard layout.  The circuit diagram was created first which caused some issues when trying to layout the stripboard.

Design

The build was started with a breadboard layout of the LEDs and a potentioner to simulate the battery level.

breadboard

This was connected to a standard Arduino UNO board in order to write the firmware for the ATTiny.  The firmware  (and circuits) are available from github (https://github.com/markmoro/carelec).   The firmware is super simple as its basically blinking some lights so it should be easy for anyone to follow and makes a great introduction to Arduino coding.

Once the firmware was complete it was time to build the ATTiny version.   The first thing to do was to write the firmware to the ATTiny.   To do this we used the Arduino as an ISP.  There is an excellent tutorial on instructables on how to do this here.  There were some issues with pin mapping with the Arduino pin numbers.  The actual pin numbers are shown in the diagram below:-

ATTiny84 Arduino Pin map

ATTiny84 Arduino Pin map

Build

Once the stripboard layout was built and the ATTiny programmed the the build into the car can be done.

Circuit on Board

Circuit on Board

We soldered the LEDs on to wires and ran them back to the main board were we had header connectors to plug the in to the board.   The following section were made:-

  • Left Indictor
  • Right Indicator
  • Hazard Lights
  • Battery indicator lights
  • Switches

We’ve simply taped all the wire runs in the short term but will probably secure them up more in the future.

Issues

The majority of this build went pretty smoothly, however there were a couple of issues.

The first issue was that when plugged into the main car battery the ATTiny kept reseting.  We had previously tested using a 8 AA cell battery back so the power was the main suspect.  A small value capacitor was placed across the ATTiny’s power and this solved the issue.  Its important to note this need so be as close to the ATTinys power pins as possible.

The second issue we had was wiring the power on/off to the cars on/off button.  The cars on off button seem to have so strange ground wiring (I assume this is for the motor to run back and forward) and it turned out we couldn’t wire the circuit on/off to this.   As a simple solution a second switch was added.  The main switch could be replaced with a dual-pole version however we will probably not do this.