Pages

Monday, August 11, 2014

A pool cleaning robot custom electronic based on AVR ATmega8 microcontroller



updated to version 02

... 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.

Changelog
  • 02: added failsafe threshold to timer
  • 01: first release

Code

Notes
  • read risk disclaimer
  • excuse my bad english

15 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. Dear Davide,
    your project has been very helpful to me. I have a similar problem with my robot and if you look at the electronics it is stuffed with of course no information available, also no interface messages spec. Your project tells me that even without any sensors the robot can work.
    Many thanks, Ludo

    ReplyDelete
  3. This comment has been removed by a blog administrator.

    ReplyDelete
  4. This comment has been removed by a blog administrator.

    ReplyDelete
  5. hello very interested - i have two dc motors - is it possible to control them with esc?

    ReplyDelete
    Replies
    1. Hello, you have to change the code in order to make it works with two DC. It will be even easier to make it works with DC.

      Delete
  6. Hi David! Can I ask you a few questions about this project?

    ReplyDelete
    Replies
    1. Hello, of course you can. If I can I'll help you

      Delete
  7. Hi David

    Thank you for sharing your project!!
    My pool cleaner from time to time makes a pause and change its direction to better cover all the pool. Any ideia of how this is done with only one motor ??

    Best regards
    Jose

    ReplyDelete
    Replies
    1. Hello JM, if you can upload a new firmware, you just can pause after a certain random amount of time, the pause a little bit, than change direction.

      Delete
    2. Hi David
      My question was how to change direction. There's only one motor that i can move back and forth... both weels work in tandem...the robot it's a Dolphin Easykleen

      Delete
    3. Usually those kind of robot has a lever on the top, you can act on this lever to make the robot move slightly in one direction (left or right). In my robot it's the robot handle on top.

      Delete
  8. You chose to put the controller in the PSU, safely away from water, but I assume you didn't need to change the DC power cord to the robot and wonder how many wires you had available to drive your two motors. Mine only had two wires which means my controlledr would have to live in the bot. I was thinking of switching to a three core cable which would give me ontrollerbof two motors although I'd not be able to reverse motors without four wires I think.

    ReplyDelete
    Replies
    1. Hello. I have use just two wires cable. The outside of the water controller is just a timer. The "logic" controller is embedded in the robot ESC controller, which control one brushless motor. The DC motor is always on when the timer is on. Hope this helps.

      Delete