Second life for cracked smartphones – bicycle rearview mirror

I own few of those myriads of smartphones having succumbed to the “spider-app”. It is unfortunate to have a phone broken in such a way. They are often technically completely fine, but not properly usable any more. What a waste!

Unfortunately my attempts of replacing broken screens of tablets where sobering at best, so I do not see much reason to even try that on smartphones. Breaking the phone completly (and potentially the replacement screen) is no gain for anyone. As I always buy used phones (capable of running lineage OS) a professional repair is not economical either.

So I always think of ideas of what to do with broken and/or old phones which would have a real benefit.

One idea of mine was to use a phone as a free-of-cost rearview mirror (or camera) for my bicycle, so that you are always aware of what is going on behind you. Fortunately this works and is quite easy to do – especially with my guide here.

1. Requirements

Preparation

You need two smartphones: One for streaming the rearview video, one for displaying it on your handlebar. This guide assumes two android phones. The one the handlebar can also run any other OS as long as a capable video player is on available in which you can disable buffering.

Choose a smartphone with a sufficient amount of remaining battery power. In my case it is a Galaxy A5 2017, but there are other and even older potential candidates. The phone does not require a mobile connection and you should probably turn off anything else that might increase power consumption.

I guess you have the easiest time if you use a phone running an Android version < 9. Since Android 9 the internal wifi hotspot function is assigning random IP addresses to the phone what breaks the usability of this setup. To counteract this you need a rooted phone. Rooting has also become more difficult, the recent solution is Magisk. If you cannot root your phone and have phone running Android >9, my guide here will probably not provide a usable solution (as probably most other up-cycling guides).

Note: It is NOT required to break the screen of the phone like seen above to follow this guide.

Technically you probably need some brackets to hold you phone either on your handlebar and the saddle bar. I used the cheap and universal Finn.

2. Stream camera image

Android has several apps that open up a local webserver on the smartphone which streams the camera into the network and put it in some kind of a surveillance mode. I ended up using the popular IP Camera app, but others will probably work equally well. In the configuration you can (and should) reduce the resolution of the video stream and deactivate audio transmission. Low latency and power saving is much more important than quality in this case. You should also check the options for continued streaming during sleep.

You can also turn on the function to start streaming on each startup later. This reduces the setup time for this rearview mirror.

3. Display video stream with low latency

IP Camera will inform you about the IP address and port where the camera stream is available. On your second phone you need to make sure to be in the same network as the first one. You can point most video player to the IP camera source and you will see the camera stream from the first one.

But you will probably notice a latency lag between the camera and the image on the screen > 1 second. That is TOO much for a rearview camera because you do not need a historical recording of your back but the current situation.

My first working solution for this problem was the VXG Low Latency Player Demo, which was able to show a close to instant image of the camera. Unfortunately it does not support androids split-screen feature.

Instead I used the VXG Video Surveillance – IP Camera Viewer which can also be configured to use a 0 second buffer and allows easy access to multiple configurations. Probably any other video player which can be forced to stop buffering is a solution here – suggestions welcome.

4. P2P Wifi between the phones

Now we just need a wifi connection between the phones which also works during your ride. The home wifi is not an option here. You could use a mobile router but that would increase the amount of devices you need to carry, power and setup for your rides.

Fortunately Android provides the wifi hotspot functionality, which we can use here. Just open up a wifi like you would when sharing a mobile connection. You can start up the IP camera server afterwards, connect your second phone to the hotspot wifi and point to the provided address. This will work!

5. Fight the dynamic IP address of the hotspot

For anything below android 9 the IP address of the smartphone running in hotspot mode is always 192.168.43.1

That is perfect for this setup as you just need your second phone to connect to the hotspot and point your video player to the always static IP address.

Unfortunately Android 9 changed the behaviour and the IP address of the hotspot became dynamic. This means you need to check the new IP address each time you start the hotspot and type into your phone on the handlebar. That would be very annoying in daily use.

To continue you here you need a rooted phone! Using a root shell on the phone (or via adb) you can run the following command to set a second IP on your phone:

# ip address add 192.168.43.100/24 dev wlan0

Unfortunately you need to run this every time the hotspot functionality is enabled. This is an explanation how you can make this run automatically when the hotspot starts up. But it requires a writeable system partition and this seemed to have become that much complicated that I have up here.

Instead I added that command as a script to script runner and run it as root. I have to do it every time after starting up the hotspot. But it is fast.

The main phone on the handlebar can afterwards connect to the hotspot and stream the video using that knwon address.

6. Enjoy your ride

Using a splitted screen you can now have navigation and your rearview on your handlebar. Pretty neat.

Rearview image and navigation app in split screen

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s