-
1Step 1
The SF02 laser range finder module has become a popular sensor for distance and altitude measurement in autonomous vehicles. Most people don't know that this device was designed to be hacked and that the factory settings and memory downloads are accessible through the communications port. The SF02 also has analog ports where you can attach an oscilloscope to watch the laser signals.
For this project I’m using the SF02/F Arduino Shield that is available for the SF02/F. This shield makes it easy to get at all the port pins which means that you can test and prototype without needing a lot of external signal wires. Out of the box, the shield only has the power pins connected with all the other port pins isolated by means of solder jumpers on the bottom of the board. You can run the SF02/F without any interaction with the Arduino as a safe way to start experimenting, and then make connections when you’re ready.
-
2Step 2
The shield has a jumper on top that selects where the SF02/F gets its power from. I’ve chosen to use the Vin pin on the Arduino because my old Uno gets a bit hot if power is taken from the onboard +5 V regulator. To start with, I’m not going to bridge any of the solder jumpers on bottom of the shield.
The SF02/F has a digital expansion port along the back edge that this is designed to take a standard 0.1” pitch, 2x7 male header which comes in the packet with the Arduino shield. Here you can see where I’ve soldered it in place on the SF02/F. Make sure you put it on the correct side, away from the green connector and next to the buzzer. You can leave the other ports unconnected for now.
-
3Step 3
Hooking up the SF02/F and the shield to an Arduino takes a few seconds. There are plastic spacers included in the shield packet and these clip the whole assembly together without needing any screws.
-
4Step 4
As an experienced hacker I know that the most important piece of kit is a current limiting power supply. I’ve made a power cable that plugs into the power socket of the Arduino and to drive the SF02/F / Arduino combination the voltage should be set to 7.0 V and the current limited to 300 mA.
With the power turned on, the actual current consumption is less than 200 mA. Watching this current tells you whether or not you’ve made an error in the hardware connections and limits the possibility of damage if you’ve got it wrong.
-
6Step 6
The USB port
The SF02/F ships with a mini-USB port that can be used to enter settings into the unit. You can actually run the SF02/F from this port without using a power supply but for this project I’ll keep the power supply connected so that both the SF02/F and the Arduino are always on.
Data that comes out of the USB port is in human readable, ASCII format. To see this data on your computer, you’ll need to plug a USB cable between the SF02/F and an available USB port on your computer then run a terminal emulation program. I’m using the free one from the LightWare Optoelectronics website which has some nifty features, like automatically recognizing ports that use the FTDI driver chip found on the SF02/F. So to get the connection running I only need to press the “Connect” icon and distance readings start scrolling on the screen.
-
7Step 7
With the terminal program running, all key presses are directed straight to the SF02/F. By pressing the < SPACE > I can get the SF02 to stop taking readings and display the user settings menu. Pressing the < SPACE > again restarts the readings.
What to do with the settings is covered in the SF02 Manual so I won’t go into any detail here. However, the way that you switch from “running mode” to “settings mode” using the space bar is important to remember for what follows.
If you leave the SF02/F for more than 2 minutes in settings mode it will assume that you’ve forgotten about it and issue an irritated bleep before switching itself back into measuring mode. The SF02/F just loves to measure distance!
-
8Step 8
USB hack # 1
When a product is manufactured, it undergoes a bunch of tests to make sure that everything is working properly. There are also factory settings that need to be entered so there is a way of getting access to these factory functions. For the SF02/F you just need to know the passwords.
There’s always the chance that you could hack the SF02/F until it stops working, so consider this a friendly warning - be careful how you proceed from here onwards.
With the SF02/F running in measuring mode, press the upper case < U > character on your keyboard. The SF02/F will stop measuring and ask you if you are sure that you want to do this. I guess if you’ve got this far then your answer is going to be the upper case character < Y >.
-
9Step 9
The SF02/F carries on measuring as though nothing has happened but you’ve actually opened Pandora’s box. Press the < SPACE > to get to the settings screen.
-
10Step 10
The last line of this screen now contains the instruction <- Use arrow keys to navigate ->. Several different arrow keys can be used depending on the type of keyboard you’ve got. If you have the full keyboard with separate arrow keys then the left and right keys will work. If you’ve got a small keyboard with no arrow keys then you can use the < and > characters instead.
Every time you press an arrow key, it takes you to a different settings menu. Each screen has a particular theme relating to the hardware that it controls. If you keep on pressing the arrow, the screens eventually wrap around back to the user menu and each time you enter or leave this menu the SF02/F will bleep.
For this first hack, I’m going to change the automatic restart time. This is the time that the SF02/F will wait before going back into measuring mode and it is set to 2 minutes at the factory. The setting can be found in the “System settings” menu which is one arrow press to the right of the user settings menu.
The first item in this menu is the “Auto restart time” and by pressing the number key < 1 > it will allow you to enter a new time. If you set this value to 0 then the unit will never restart automatically.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.
Hi,
Is this module readable by a Raspberry pi? Is there a python SDK / module available to configure it?
Are you sure? yes | no
Thanks for such a quick reply! So I basically need to find the phase angle between the laser firing signal and the return signal?
Are you sure? yes | no
In principle, yes. Unfortunately, there may not be a direct measurement that you can make because on most range finders the modulation frequency of the laser changes in order to overcome aliasing. Some devices "chirp" the laser. However, you might be lucky and find that your particular model only uses one frequency in which case you might be able to extract the phase.
Are you sure? yes | no
Hi, I am trying to hack a laser distance meter here: https://hackaday.io/project/12767-peek-inside-uni-t-ut390b
Does the analog signal I have found look like something that could be used by a microcontroller to make distance measurements without needing to talk to the STM32F? Thanks for any help.
Are you sure? yes | no
Hey Simon, there's a big difference between the frequency modulated type that you're working with and the time-of-flight SF02. Frequency modulated devices do not show a direct return signal, instead they look for a phase shift at different modulation frequencies whilst TOF devices actually time a pulse of light.
Are you sure? yes | no