My desk gets dirty from eraser marks and dust. It gets especially dirty after I finish my homework. I use a small, handheld vacuum to clean it. So what if I could put wheels on that vacuum and make it clean my desk by itself.
This is a diagram of the original proposal's logic.
Going more in-depth with a light sensor and boolean flag, this is a more descriptive diagram. The photosensor provides information about how much light there is with a resistor whose resistance depends on the level of light. Low values for darkness and high values for brightness. Originally, the vacuum would begin to work when the light is off, meaning I could set up a threshold and if I got a light value below it, the vacuum would run. However, this means that it would keep running in the dark over and over. To prevent this, I made a start condition that involved a boolean flag. The flag becomes true when the light turns on and false once the vacuum runs. This way, the vacuum runs only if the light is turned on first and then it goes dark.
Here I initialize my variables for my servos, pins, and the boolean flag.
Here I get a value from the photosensor which determines the state of my flag, lightOn. I publish the value separately for debugging.
This is the code for the vacuum running. Each block is a certain part of the path it takes. In each block, each servo is set to spin at a certain speed for a certain time, thus spinning the wheels and moving the vacuum.
VideosLimitationsThe frame is relatively weak and thus the wheels wobble. This causes inconsistent results, and makes it hard to program a better path that would pick up more dust and eraser marks. I would fix this by changing the frame to be made of hard plastic and I'd make it more symmetrical. Another issue is that the vacuum cannot reach my whole desk as a result of the length of the cord, however, that likely cannot be fixed as a longer cord would still need somewhere to go or something to support it.












Comments