Monday, August 11, 2014

A pool cleaning robot custom electronic based on AVR ATmega8 microcontroller


... Once upon a time, i had a working pool cleaning robot, then, it get's broken by the evil chlorine....

Chlorine damage a gasket on the robot and cause the shorts of the electronics embedded. It is obviouslly out of warranty, and the manufactuer does not send me any information to repair it, moreover a new board will cost me more or less like a new robot, cause i've to sent it to a certified repair center. For information only, original board was based on a dsPic.
So, i decided to get it back to life, replacing the electronics that gets damaged.


My replacement electronics it is based on ATmega8 micros.
The project is divided into two parts:
  • timer
  • cleaning robot
The timer contains the 220 AC to low voltage DC current, and it is out of water, his purpose is to start and stop the cleaning pool robot, which of course is inside the swimming pool.


The timer is an ATmega8 based countdown programmable timer, it is like the one you can find here: http://davidegironi.blogspot.it/2013/10/an-atmega-countdown-programmable-timer.html
It alternates a "working" period, and a "pause" periods. So i can run the robot at a predetermined interval of days, for an amount of minutes you can chose. Let's say for example 30 minutes every day.
It shows time using a double seven segment display. Periods can be selected from predefined values, stored in the firmware.
There are five buttons:
  • pause +/-: select the pause period
  • work +/-: select the working period
  • start and stop: iterate through perdiods.
Both period are stored into internal avr eeprom, so that if the main power goes down, user settings are restored at next bootup.


A green led indicates that the robot is working.
A red led it is used for over/under current detection: Indeed it may happens that something goes wrong, maybe one motor of the robot does not starts due to dirty. The timer checks the current consumption and evenetually stops the working period, until the next iteration.


The cleaning robot runs with two motor.
One that suck water from the bottom of the robot, the water then passes through a filter stage that cleans it, it also produce the suction effect that makes the robot climb the pool wall.
The other motor makes the robot move back and forth. Above the box of the movement motor.


The first one is a DC motor, it actually runs at almost 20 volts, the second is a brushless sensored motor.
The eletronics on the pool robot just drive the BLDC motor back and then forth for a period chosen semi-randomically that goes from 20 to 60 seconds. When the robot is running, the suck motor it is always on.


I've used a brushless driver i've previously implemented, you can find it at this addess: http://davidegironi.blogspot.it/2013/09/a-simple-brushless-sensored-motor.html
The board used for the cleaning robot is a ESC Mistery FM30A reprogrammed with my custom firmware. This ESC board is cheap, and use a ATmega8 running at 16Mhz.


In that way i can use a small and cheap brushless board, without soldering anything new, i just have to program it with my custom firmware to be indipendent.

It actually 1 years that works without problems.

You can fine code, hex and schematics, in the attached file.

Code

Notes
  • read risk disclaimer
  • excuse my bad english