Tuesday, 6 November 2012

Evaporative air conditioner repair

I spent a few hours on the weekend giving the evaporative cooler (swamp cooler for some) it's spring clean, ready for the first hot day of the season.  Usually this just involves flushing all the dirty water out, giving the pads a bit of a spray with the pressure washer, and checking the belt etc.

This was all done in a few short hours, and I happily turned everything on to be greeted with nice cool air throughout the house.... until an hour later, when the air turned suspiciously warm.

The fan was still running happily, but turning the pump on and off didn't seem to make a difference. (If the pump is on, there is water running through the pads, which cools the air on the way past)

The date on the top of the pump was 20 years old... so it was time to take it out and have a look.  There was a noticeable rattling sound when I shook it.

This might have had something to do with it :

This is the source of the rattling sound...


Pump motor, just a little rusty!
I've since replaced it with a Breezair 'Tornado' pump - only $150 which is cheap in HVAC land - and it worked perfectly. Bring on the hot weather!



Wednesday, 31 October 2012

Fish Tank Part 3 (continued)

Here are some pictures that were missing from the first post

This shows the controllers roughly fitted roughly into the spot where the old switches were.  The IR controller is just sitting there, not fixed in place. The IR sensor is visible to the left of the picture.

The white LED controller was from ebay (http://www.ebay.com.au/itm/261097677600#ht_2763wt_1255) It has lots of flashing and fading modes that I don't need, I just need a simple dimmer, but for the price I couldn't go wrong.

The RGB LED controller is common as dirt on eBay, it came with the LED strip, something like this : http://imgs.inkfrog.com/pix/stephunt/111_001.jpg

Here's another pic of the lights in action, reflected off the top of the water. This is at about 75% intensity.

Tuesday, 30 October 2012

Fish Tank - part 3


Stage 1 - COMPLETE!
After a solid Sunday afternoon's work, stage 1 is complete. Here is a picture of the aquarium under full light - thats 6 strips of cool-white LEDs, and two strips of RGB colour LEDs - not that you can see them against the white.  If you turn the white off, it looks something like this :
Cool-whites OFF, RGB showing White


Blue (moonlight)

Enough of the pretty colours - here's how I did it :
The old hood looked like this :
Two tubes already down, only one working and I'm not even game to turn that one on!

And this
First, I stripped the old fluorescent lights out of the hood.  You can see the state of the ballast, and the spots where water has damaged it, and the mould also caused by water ingress.

Old ballast - looking a bit worse for wear
All this has got to go

Next step is to cover all those ventilation holes, and the rectangular holes where the tube fittings were held. This is where the condenstaion was getting into the electrical compartment - don't worry, the plastic top of the hood still has plenty of air vents.

Old ventilation and tube bracket/starter  holes all covered, with new holes drilled ready for grommets


Flip side - some scrap sheet metal  bolted in place

Now - time to prepare the strip lights.  The strip can be cut every 3 LEDs in a clearly marked spot, the silicone cut off, and the coating scraped back to reveal the copper underneath.

Some quick soldering and application of heat shrink and here's the result.  The termination on the strip at the top was by the supplier, the one at the bottom is mine.

I bought some clip-on connectors that attach to the cool-white strips (only 2 contacts needed) - but isntead of using them to join two strips together, I soldered wires to one side.  The contact with the strip didn't seem too reliable, so I ended up soldering that side to the strip as well.

Since some of the copper strip was exposed after cutting, I covered the other end with heatshrink and flattened it while still hot, forming a nice seal :

None of there connections have to be 100% watertight, but after seeing what happened to the previous lighting system I'm not taking any chances.

Here is the back plate with all of the strips installed.  Each tube has been replaced with two strips of cool-white LED, and there are an additional two strips of RGB LED, one on each side.

And I even remembered to leave space along the middle for the bolts to mount the power supply and terminal strips!

Now - first light test!  This is with my bench power supply which doesn't quite have the oomph to push it to full brightness :

All LEDS working great! Now to install the power supply. And here it is :

Even though it will be living above the backplate, it still could get some condensation, so I bought one that is IP65 rated.  100W is more than enough for the lights I'm running.

Installed, it looks like this :

And the other end, with a small PWM dimmer for the white LEDs and a controller for the RGB LEDS :

Even though the wires are blue/brown, this is the 12V side not the 240V !

Each white LED strip is brought out to a separate connection on the strip - so on the next stage it can be controlled individually.  For now, they all end being paralleled to one of the 12V outputs, and the other output goes to the RGB led controller.

Putting it back together :

There is a clear plastic cover (not shown) that goes over the top of this.

And there we have it : all done!

The controls sit on top of where the switches used to be - this is supposed to be temporary until the next stage, where they are replaced with an LCD and some buttons connected to an AVR microcontroller.

Monday, 22 October 2012

Fish tank Part 2

Ok some more about the fish tank.

Why settle for a manual control of the fishtank lights when you can automate it?  (OK there's a bunch of valid reasons, but we're hackers so you already know where this going)

Just by adding a simple Arduino controller, a little bit of hardware, and a little bit more software we can provide the following features:

  • Tank lights turn on automatically at sunrise/sunset,  with a gradual turn on and turn off.  Plants and fish apparently like this. 
  • Monitor the temperature of the tank and sound a warning if it gets too low or too high.  Even though its a 100W heater in a 400 litre tank, a stuck thermostat could make things uncomfortably warm for the fish.  This doesn't require any changes to the thermostat - but if we want to take over temperature control we can do that too with a Solid State Relay connected to the heater. (We can still set a maximum temperature using the heater builtin thermostat, the controller will then have a temperature range of ambient up to the maximum set by the thermostat.  Changing temperature and/or other water parameters can be used to trigger spawning in some fish) 
  • Turn on blue 'moonlights' during the night, so you can still see the fish but it's not a bright.  Looks cool, but the plants won't care.  For bonus points, have the intensity vary over the night and over days to signify the moonrise/moonset times and the phases of the moon, using some almanac equations and a real time clock. 
  • Sound reminders when its feeding time, just in case we forget 
  • A small LCD with a few buttons, or a touch LCD can improve the useability.

A 12V LED string can easily be PWM controlled from the Arduino using the built in PWM features, and a power MOSFET, or bipolar transistor.  A timer just needs a simple RTC chip that interfaces with just 2 wires.

Future enhancements could include the following:
  • Control over the filtering system to run different pumps at different times of the day or to turn them off during feeding time
  • Control over the heater elements (already mentioned)
  • Control of an automatic feeder. A servo motor and a sensor or two could turn a small food hopper at a certain time every day, dispensing a fixed amount of food. Mechanical design could be tricky, this would work well for pellets but probably not well for flakes, which is the actual food I use in this tank.
  • Water condition monitoring - e.g. turbidity, salinity, pH, etc.  Not worth it for this tank, but might be worthwhile if we had a marine reef tank.
 Someone's already written software that does all this - with the Jardiunio Aquarium Controller.  Video here. That looks like a great system but is more designed for large marine tanks - plus it needs an Arduino Mega, and I'm trying to keep this small.  I might end up building a Jarduino Mini, if I can get it all to fit into the smaller flash of the 328P.



Ok as promised, some more details on the home automation setup I've been working on.

The first step was to learn about how RS485 worked, so I breadboarded up a MAX485 RS485 transceiver chip with my Arduino Eleven.  That was enough to prove that I understood how to drive the chip.

RS485 (in multidrop mode) is a little harder than RS232. It's more like Ethernet really - everyone sits on the same two-wire bus, and only one can transmit at any time.  If two nodes transmit at the same time, if one node is driving high while the other is driving low, the bus ends up in an indeterminate state.  So - some sort of protocol is required to ensure that nodes take turn in transmitting, and if two nodes to transmit at the same time, it is detected and the transmision can be retried after some arbitration to work out who transmits first.

I've connected the MAX485 to the hardware UART on the Arduino, with the Tx and Rx enables connected to other digital outputs.  The controls are pulled up to ensure that when the Arduino is reset, the MAX485 won't be transmitting on the bus, and the Rx line won't be driven by any data from the bus.  This is important, otherwise software downloads wouldn't work, as the FTDI chip (or the Mega8U2 on the Arduino Uno / Eleven board) would be conflicting with the MAX485 driving the Rx line.

I could have avoided this by using a software UART on the Arduino, but I'm planning on pushing the CPU enough as it is, without trying to get high speed RS485 as well.  RS485 can operate up to 1Mbps provided proper care is taken of the bus - i.e. termination, topology etc.  I'm using passive termination at each end of the bus, and using a bus topology with very short stubs, over a pair of Cat5, so there's a good chance I can get close to that rate if need be.

Once I was happy with driving the MAX485, I was sick of wiring up the breadboard, so it was time to make something a little more permanent.  This was the result :

This is a FreeTronics RF Receiver shield, which as well as holding a 433Mhz ASK receiver, also has a heap of prototyping space.  Jammed in there is the MAX485, a DS1307 Real Time Clock chip,  a connector for the LCD (shown), a connector for a DHT-11 Temperature/Humidity sensor (not shown), a connector for the 1-wire Bus (with a DS1820 temperature sensor attached), as well as wires for the RS485 bus (D+, D-, Ground)
The RF receiver just detects any CW signal around 433Mhz and drives an input pin on the arduino.  A surprising amount of stuff uses this frequency and can be read from this board.  X10 RF devices use it - so my WinPlus X10 remote is capable of sending hundreds of different commands to my software via this board. (I'm using the Arduino IR library to read the data in the same way that IR codes are read).  Some home weather stations use this frequency to transmit their readings to the base station - I've got one but haven't been able to decode its bit stream yet.

The LCD module is used during debugging to dump things out the screen, it also hold a micro-SD card for file storage.

This board is my general protoyping board, it's not intended to be part of the final home automation solution.

The next board (which IS part of the final solution) looks like this :

This board also has a DS1073, MAX485, and connectors for the DHT11 and one-wire bus. And a connector for a Nokia 5110 84x84 pixel LCD.   The LCD is removable - it's only there during development since this board (and more like it) will live in a box somewhere up in the roof.

 The FTDI board (the small red PCB) is only used during download, and is removed later. The LCD board is also removed later. The LCD is very cheap (less than $10) but it's a 3.3V part, and I'm running everything at 5V, so I built a small 'debug' board that has the LCD, level converter, and some status LEDs for use in RS485 debugging.

Coming back to the main board - a bunch of the digital I/O lines and analog input lines aren't commited yet - there's room on the board for things like driver transistors so I can use it to drive large LEDs, or relays for controlling lights etc, or sensors.   

The first goal for this board is to get it to read a bunch of temperature sensors via the 1-wire bus, and transmit the values back to another node via RS485 for display and/or logging.  The server PC should be able to read these values too.

So right now - I've got both of these boards connected via RS485, with one board reading from the DHT11 Temperature/Humidity sensor, enumerating any sensors it finds on the one-wire bus, and then polling them all regularly and sending the readings to the other node via RS485.

The protocol (when I last tested it) was successfully detecting collisons and garbled transmissions, so I had semi-reliable comms between the boards.

That's enough for now - what would you like to see next?

I can give details of the RS485 bus protocol I'm using, or some rough circuit diagrams of the boards - or maybe some details on the final application, or what devices I could interface to these boards?


Saturday, 20 October 2012

KL25Z Freedom board, broken?

A few weeks ago I received my Freescale KL25Z 'Freedom' board.  The board uses something called OpenSDA, which means that it actually has two CPUs on board, one that runs the debug interface, and then the main CPU (an ARM Cortex M0+)

I followed the instructions but it seems that I've somehow bricked it.  I can connect to the SDA USB interface fine, and I can download some of the precompiled examples that come with it, but all I get is a blinking green LED, and no response from the host CPU at all.

Does anyone else have this board and have you had more success than me?

Wednesday, 17 October 2012

Fish Tank Disaster

Relax it's not as bad as it sounds...

Those of you who have ever been to our house will know that we have a growing collection of fish tanks present in our lounge room.  The second largest tank is an AquaOne AR-980 - which looks something like this :

The top of the tank is covered by a plastic hood (ours is black) that contains 3 individually switched fluorescent tubes, behind a plastic cover.  As you may expect from a tropical fish tank, there is quite a bit of moisture about the place, and cheap-ish electronics and water tend not to mix very well!

In May 2012, we noticed a rather strong burning smell coming from the lounge room, which we fairly quickly traced to the fish tank hood.  One of the fluorescent ballasts had become very hot, and was in fact starting to smoke. The ballast has since been removed, and we continued on with just two lights instead of three.

Then in October 2012 we noticed another burning smell, and found that the ballast on one of the other lights was going the same way as its sibling.  We haven't been game enough to turn on the third light any more!  So - no more fish tank lights for the time being.  The fish themselves get enough light from the room, but the plants in the tank are not going to be happy for long without their daily dose of light.  So the decision came down to - replace the whole hood (expensive - and likely to lead to the same problem in  a year or two), replace the ballasts (if I can find one - and again, likely to fail again in a few years) or go the DIY hacker route and replace them with LED lights, and a custom controller.

Of course you can guess route I've chosen!

To work out if this is even feasible with LEDs first I looked at the specs of the current tubes
The tubes are :

1x Atman 15000K 25W tube
2x Atman 8000K 30W tube

Using a value for tubes of 60 Lumens per Watt, that gives us

1500 Lumens at 15000K (pink/violet light)
3600 Lumens at 8000K (cool white)

We rarely have all three lights on at once, so these can be taken as a maximum requirement, and not a 'must have'.

I've considered two options for the LEDs - either using a small number of high per LEDs (such as the Cree 1W or 3W Star LEDS) or using a large number of smaller LEDs in a strip configuration.

The high power LEDs are probably more efficient, but they require a bit of work in heatsinking, and possibly active cooling such as a fan, or even running piped aquarium water through a heat exchanger, which I've seen somewhere (hack a day maybe?)  The hood does contain a sheet metal plate that the tubes were mounted on, so that may be sufficent heatsink, but again I'm worried about water ingress due to condensation, which is probably what killed the original ballasts.

Some eBay research shows that the Cree 3W (nominal) Q5 LEDs can produce 107 Lumens when driven at 1.2W, and up to 228 Lumens when driven at 4 Watts.  Guesstimating at 200 Lumens when driven at 3 Watts, that means I would need 18 to give me my 3600 Lumens of cool-white light, for a consumption of 36 Watts.  (Noticeably less than the 60 Watts that the tubes would use)

The LED strip lights can be bought in waterproof strips, and because they are more distributed, the heatsinking isn't as much of an issue.  There are two types of LED strip out there, one uses the 3528 SMD LEDs, the other uses the larger 5050 LEDs.

3528 LEDs produce about 4 Lumens each - so a 5m 300 LED strip gives me about 1200 Lumens.  They do come in 600 LED strips too, which would give me 2400 Lumens for 48 Watts.

The 5050 LED strips give me about 780-900 Lumens per meter, so 4000 Lumens for a 5 metre strip.  A 5 metre strip uses about 72W when driven fully.

I was able to pick one up on ebay : http://www.ebay.com.au/itm/130783783740 for about $16.

That takes care of the main light, additionally I'd like to have a little extra light when showing off the tank, and a blue 'moonlight' to use at night.  A strip or two of the 5050 RGB strip will take care of this - I can use it to add some tint to the colour during the day (additional red and blue to help the plants), or just run it as blue at night.

The strips of course need some supporting hardware - the white strip will need 12V 6A (72W) at full power, and  a metre of two of the RGB strip will require another Amp per meter.

To control 6A,  PWM is the only way to go - so I've purchased a cheap PWM dimmer that can handle up to 8A.  The RGB strip comes with its own small controller that lets you dial up any colour, so I'll be using that as well.

That's enough to solve my immediate problem of no light in the fish tank.

Stage 2 is where it gets more interesting - and I'll write about that in the next post.