Posted: November 6, 2021
This project answers the question of "what can be done with an old obsolete phone". The idea came about when I was skimming the As Seen On TV website for things I could modify. I had previously done a project with Snax The Sloth that they were selling and thought it might be fun to mess with something else. I ended up finding The Sticky Buddy and thought it might be funny to put wheels on it and have it drive around my living room picking up dust.
I was originally going to use an IMU board to get the rotations perfect, but after my Pixel 4 phone (not even 2 years old) was destroyed by the battery swelling up and I had to revert back to my old Pixel 1 until I could get a new Pixel 5 (which of course became obsolete the day I bought it since the Pixel 6 was about to be released)... I remembered the phone has all the IMU stuff build in and from an artistic point of view I figured making a Pixel Janitor would be a fun way to express my disappointment.
The circuitry is based on an MSP430 microcontroller with firmware written in Java compiled with Java Grinder. The code on the phone is written in Java and communicates with the MSP430 over a simple UART Bluetooth module. I ended up having a disappointing experience with the sensors in the Pixel (more on that below) but the communication between the phone and the circuit works great.
Further explanation plus a video and source code below.
Here's a video showing the Pixel / Sticky Buddy in action rolling around on my floor. I didn't take the protective film off the roller because I didn't want it to get gross while I was testing it. The system moves forward for about 3 seconds, drops the caster to lift up the roller off the floor so it can turn, turns 90 degrees, moves a little forward again, turns 90 degrees, and then repeats. The solenoid had enough strength to hold the roller up, but didn't have enough force to lift, so the phone gives the motors a short command to lurch forward so the roller does properly lift off the floor. YouTube: https://www.youtube.com/watch?v=tGdz93pnkfU
So the main part of this project consists of a "Sticky Buddy". It's some kind of sticky roller that is used to pick up dust and such. It's hot glued to a popsicle stick with two Pololu motors / wheels. On top of the popsicle stick in the middle is a cheap phone tripod mount.
The circuitry itself is pretty simple: an MSP430G2553 is connected to a Pololu motor driver along with an electromagnet solenoid through a small MOSFET. When a voltage is applied to the solenoid it's supposed to push down a caster which will lift up the roller so there's no friction when it rotates. The solenoid was supposed to be able to push 5N of force at 12v (this is around 11.1v) which wasn't quite enough to lift it, however once it's lifted, it can hold it. Because of this, after dropping the caster, the phone is programmed to give the motors a short pulse forward which causes the front end to come up and lift it properly. There is also a cheap Bluetooth module connected to the UART of the MSP430 to take commands wirelessly.
Now for the phone. I think the Pixel 1 had been one of the best phones that I've owned, but unfortunately Google quit supporting it and I had to upgrade to a Pixel 4. That phone didn't even make it 2 years when the battery puffed up and broke open the case (lucky it didn't catch fire too). I needed a phone so I ended up ordering the Pixel 5, which since the Pixel 6 was about to be released they probably won't be supporting it much longer. While waiting for the Pixel 5 I had to use my original Pixel so during that it triggered in my head that thing already has a gyroscope, accelerometer, magnetometer, and other senors and accessing them in Java should be really easy (which it was).
UPDATE December 21, 2021: The Pixel 5 got hit with the "black screen of death". It was on the charger all morning and by noon when I went to pick it up to check some news, just a black screen. No noises, no vibrating when pushing buttons. Dead. I tried charging it wirelessly in case the USB port was broken, but nothing. Tried hooking it up to a Linux system, nothing in dmesg or lsusb. Lasted only 3 months and now dead. I'm officially done with Pixel phones.
So using some sample code I found on the Internet, I put together a small Android program in Java that would figure out its orientation to magnetic North and could send a rotate command to the system until it's facing a particular direction. I had that just about working perfectly and decided to try the gyroscope (game rotation vector) to see if that could be better. After getting that working I decided to turn the phone off and mess with it the next day. The next day none of the sensors worked. I downloaded some other program from the Google Play store and that didn't work either. After spending some time searching the net, I found out that upgrading to Android 10 on older Pixel devices trashes the sensors. Appears to be a well known problem that will never be fixed. What's weird is if I reboot the phone, the sensors seemed to work for a minute or so and then the onSensorChanged() method just stops receiving callbacks. So disappointing.
I had some choices to deal with it. It seems people say if they downgrade to Android 9 it starts working again, but that's a bit of work. I could have also rebooted the phone every time I wanted to make a test run, which sounded again like a lot of work. My last choice was to rotate based on time and hope for the best. I was getting kind of sick of working on this project and I have others I want to start so I went with just using timings. All the sensor code is still in the Java source file below, but parts are commented out and such.
Copyright 1997-2022 - Michael Kohn