This page has three parts. Part one (this one) covers the disassembly of the Dirt Devil and the replacement of its chip with a WEMOS D1-D2. This adds the feature of controlling the Dirt Devil over Wifi. I think it works pretty well, but lacks some features like automatic homing in and charging.

Part two will describe how to replace the WEMOS D1-D2 with a LOLIM32. This will keep the OTA possibilities, but has a lot more pins.

Part three has some links to other sites that describe the Dirt Devil and the hacking of the hardware.

Part one

The Dirt Devil is a cheap robot vacuum cleaner. I bought mine in september 2017 for 70 Euros, postage included. It is not very smart, no automatic coupling with a reloading station or stuff like that. You turn it on, put it on the floor, and hopefully it will have cleaned most of your living room before the batteries run out.

The good thing is: it is (relatively) cheap and simple, you can rip it apart and have fun with it.

    Before we tell more about the fun we had with the DirtDevil, it is good to know the limits of not only the robot but also of yourself. Take me as an example: I am a rather good programmer but absolutely not comfortable with a soldering iron or electronic components that have more than two, clearly labelled exits. Resistors I can handle. Solenoids too. Diodes and condensators... sometimes. Transistors? No way!

    Enter the Arduino.

    Arduinos and its descendents are small and simple programmable 'computers' consisting mainly of (from my point of view) 'ins' and 'outs'. You can plug wires into those ins and outs and attach those wires to e.g., a thermometer module, and from that point the output of that thermometre is just another variable in a program. Plug a LED in a different set of 'ins' and 'outs' and if the thermometer variable drops below a certain value you can light the LED by a line like

    if (thermometer<0) digitalWrite(led,HIGH);
    
    OK, it is a bit more complicated than that, but not very much so. Programmers like me are used to adding libraries and the selection of the 'ins' and 'outs' generally are described very clearly by the documentation of the particular sensor.
From this point I will assume that you can program an Arduino and attach simple devices to it, with one difference: I will go on calling a programs a program and not, like the Arduino crowd, a 'sketch'. Life is complicated enough. You can use an Arduino, in which case you don't have to worry about the WIFI and OTA parts. If you use a WEMOS (see below), you will have to load the correct extensions to the Arduino programming environment. How to do that also falls outside the scope of this tutorial.

Now the Dirt Devil robot. Ignoring the 'intelligence' in its central processor, it is nothing more than two motors that drive the wheels, left and right, that can each go either forward or backward. There is a bumper in the front that can either be free or activated (when it bumps against a table leg). There are three LEDs. And a battery. The aforementioned intelligence sees to it that the robot travels more or less randomly through your living room and when it runs up to a table leg, the bumper will send it a signal to back up and choose a slightly different route.

Can you do better? That is up to you, but to reprogram the thingy a lobotomy of the old brain is needed and then the replacement of that old brain by something that you can program yourself like an Arduino board. We selected a WEMOS D1-R2 as the new brain. Think of the WEMOS as more or less similar to the Arduino (actually based on the esp8266), but with a WIFI chip added. This opens the possibility to command the WEMOS by a smartphone, plus (and more important to me) you can also reprogram the WEMOS 'On The Air' (OTA), i.e. without having to connect it to an USB port every time you want to change the program.

Step 1: lobotomy

The first, and most difficult part is the removal of the brain of the Dirt Devil. Taking apart the victim is easy: six screws on its belly and two on the bumper. You will have to remove an anti-slip strip before you can find these last two. The electronics are on a crescent shaped PCB (Printed Circuit Board) in the front. See here for a Youtube movie of the proceedings.

Don't get me started on Youtube as a medium for the transfer of facts and knowledge. No! Don't!

While you take apart the Dirt Devil, you may want to poke around in its innards. In that case you should realize that there are some failsafes that prevent the motors from running. One is if the sensors underneath do not "see" the ground. Also there is an optocoupler on the PCB that has to be interrupted. Normally this happens when the dirt container is in place, but otherwise you should put something between its contacts (I just used a piece of tissue; see the red arrow in the photograph of the PCB). There are a dozen connectors that attach the motors and sensors to the PCB. I dug out some color markers and marked them before removal so I could easily put everything back later. Pull each of them off the board with a small pair of pliers. Then remove the four screws on top of the PCB and you have the brain of the creature in your hands.

So far you have done nothing that cannot be reversed. But now you have to remove the old intelligence. It resides in a chip marked RV285R which you will not find on Google, but actually it is a EM78P153K (which also tells me nothing). Anyway, the 'ins' (the bumper) and the 'outs' (the motors and LEDs) are connected to this chip.

P50Blue LED P51Red LED
P67Bumper P52Wheel motor
P66Speaker? P53Wheel motor
Vdd5 Volt VssGround
P65nothing P60nothing
P64ventilator V61Wheel motor
P63nothing P62Wheel motor
The original chip and pinout

    
You have to replace this chip by an Arduino or WEMOS. Also, you can solder the wires right on top of the connections of that chip and leave it in place, like Markus Mueller (of the Youtube movie) did. The Arduino is strong enough to override the RV285R and if you are careful, you can reverse the procedure.

PCB with chip removed. You can see the 2 x 7 holes in the center of the board (blue-green line). The red arrow points to the optocoupler with a fluff of tissue between the prongs

I myself preferred to take the original chip out. For me this was the difficult part: as I said, I am not comfortable with a soldering iron and indeed I damaged some traces of the PCB in that they came loose from the substrate.

Step 2: the braintransplant

I then soldered Dupont wires with connectors and all into the holes where the RV285R once lived. After that I hotglued the PCB traces and the dupont wires into a solid mass so that the damaged PCB traces could not work loose. Of course I also noted the color of the wires and marked wires with the same color extra with a felt marker. I then connected the WEMOS to the wires, powered it on, checked for smoke and then started programming it.

Dirt Devil reassembled with a medusa's head of wires protruding.

If you use OTA, you have to attach the WEMOS to the USB port of your computer for the first download. After that you can attach the board to the wires of the Dirt Devil and leave it there while you tinker with the program. Note that the WEMOS then gets its power from the same circuit as the original chip just by inserting the wire that you soldered to the PCB into the V5 connector and the opposite ground wire to the GND of the WEMOS. If you follow my setup, the other wires get connected to D0-D7 and, of course to V5 and Gnd.

Note that some pins are not connected. They may or may not have had a function in the original PCB, but the WEMOS has no pins free any more. I wonder whether they had something to do with the battery reload circuit, because there are some issues on that point.

After I got my program reasonably well up and running, I cut a hole in the top cover of the Dirt Devil, eased the wires through he hole and screwed the Dirt Devil together again. I then cut a hole in the lid of the dustbin, so I could lower the WEMOS into it, as I wanted the silhouette as low as possible. For the same reason I bent the pins going into the WEMOS in an angle op 90 degrees. Still, some sticks will have to be added to the bumper, so the Dirt Devil will not knock its new brain out under a cupboard. In any case you will have to increase the height of the bumper by a strip or pins sticking up...

Hole cut into the lid of the Dirt Devil

Arduino sitting in its hole. PVC strip fitted to bumper to increase height. Note the hole up center for the IR sensor

Step 3: The programming

Now you can just download my program into the WEMOS, load the appropriate website in your browser and check whether the Dirt Devil reacts. Start with the ventilator of the vacuum cleaning function, it is an easy on-off switch and the Dirt Devil will not do a lemming from the top of your desk to the floor. If nothing happens and not even the lights blink, check and recheck your wiring. Or perhaps your battery is dead and you have to recharge it?

    This is a link to an intermediary state of the program, where the basics are enabled, but no IR sensor yet. Use at your own risk!

    The program expects a webpage on your home server (servername) with the name 'dirtdevil.php' to get the time. It displays te time for the Dirtdevil to read and will accept output that the Dirtdevil sends (time, voltage and a message):

        <?php
        $remote_addr=$_SERVER['REMOTE_ADDR'];
        $password=$_REQUEST['password'];
        $lading=$_REQUEST['lading'];
        $tijd=$_REQUEST['tijd'];
        $message=$_REQUEST['message'];
    
        $datum=time()+3600;
        if (date('I')==1) $datum+=3600;
        echo "Time:".$datum."<br>";
        echo "dirtdevil";
     
        $fp=fopen("lading","a+");
        fputs($fp,$tijd." ".$lading." ".$message."\n");
        fclose($fp);
    
        

I will now describe my program and the problems I encountered, so you can improve on it. Please note that my examples for the moment only cover the basics. The best strategies for traversing a room with obstacles I leave to you.

  • The wifi part was easy because I already had completed other simple projects that featured small servers on a WEMOS board. I will not go into detail here: check the code.

  • However, programming by OTA means that the Serial link cannot be used for debugging. I suggest that you make use of the server capabilities of the WEMOS to report on the values of variables, turn motors on or off individually etc.

  • The OTA stuff I just copied and pasted from the examples that came with the Arduino programming environment.

  • The pins of a WEMOS are different from the Arduino. There seems to be ony one analog port (A0) and 9 digital ports (D0-D8). Most other pins duplicate the digital pins for, e.g. I2C and similar stuff. So with four connections for the wheels (back and forth), one for the ventilator, two for the LEDs and one for the speaker there is nothing left apart from the A0 (which has its own limitations). I wanted to add a docking facility, so I discarded the speaker in favour of an IR sensor. Then, I will want to measure the level of the battery, where the A0 comes in.

  • A different problem was the interrupt needed for the bumper. On the Arduino site it says that the Arduinos have just a few interrupts on particular pins. The WEMOS however is based on the esp8266, where almost all pins have an interrupt. That makes it easier to allocate the pins, because you don't have to reserve, say, pin 2 for the bumper. I had some real trouble in fixing this interrupt and finally settled for a simpler construct that just read the bumper.

  • To build a docking station, you will first need an indication of the power left in the batteries (or else how do you know that docking is necessary?).

    A voltage divider with a 100K and a 10K resistor connected to the WEMOS one and only analog pin (A0) did the trick. The 100K resistor got wired to the positive pole of the battery and the 10K to the negative side. The Dirtdevil will run fine for more than an hour, dropping from 14V to 12V, after that the performaance will deteriorate and the machine will stop in a few minutes.

  • The docking station consists of a IR emittor (LED) in series with a 47 Ohm resistor on 6 Volt. Of course I will have to build some contacts with a current of 18 Volt against which the loading contacts of the Dirt Devil will rest. Mmmmm....

(To be continued)

Part two

TODOS and PROBLEMS:


An obvious improvement would be to attach a sensor for finding a loading station when current is low

However, at this moment the current to the Wemos is cut when a loader is attached. No idea why this is so. Probably to prevent high currents from damaging the original chip. That means that even if the battery is reloaded, the Wemos will not react until the current is cut again.

Also, if the switch on the Dirtdevil is in the off position, and power is connected, the ventilator will start running until I disconnect the positive lead from the Wemos board. In that position the battery will load, but it is very hot after a nignt at the loader and has to be taken out and reinserted before it delivers its power again. Possibly the original chip took care of that, but how?

A problem is that the WEMOS offers easy OTA updates and lots of memory, but not enough IO pins. The UNO/ESP8266 combo on the other hand has lots of pins, but no OTA. So I will be using a LOLIN32.


Part three

Acknowledgments and further information.

Thanks to Markus Mueller (of the Youtube movie) I could figure out which was which.

More about the Dirt Devil and the Arduino (dutch): on the site of Thijsmans. For the moment nothing new, but hopefully that will change soon. Meanwhile there is a discussion between him ane me over email (also in dutch). The two pictures mentioned are here and here.

Also this site with a more negative review of a Dirtdevil-like robocleaner. This site has more information on the pinout.
I think this last author is overly negative. Sure, the Dirt Devil is lacking in bells and whistles, but this makes it more suitable as a hacking platform, not less.

I can be reached as paai @ paijmans.net