Robotics sensor - 360 scan of environment

A turrent which is an array of 4 lidar sensor's along with two compasses and a servo that scan the environment and dump data into database.

Similar projects worth following
I am using 4 lidar sensors which are connected via a i2C multiplexor to a Pi. There are also 2 Compass modules - one fixed and one on the moveable turrent (Rotated by a servo) that allow calibration. Upon receipt of a Scan command (via MQTT), the Turrent will calibrate via the two compasses, then take readings at 1 degree intervals. Because the Lidars are fixed on the moveable turrent every 90 degrees, the turrent will only need to move 89 degrees to capture the full 360 lidar distances. The data is fed back via MQTT to a program that dumps the data into a mysql database. Finally (time given) I will via simple triganometry calculate the x,y of each sensor reading and plot the data via a simple x windows program.

Comma-Separated Values - 3.67 kB - 05/04/2018 at 07:23


Portable Network Graphics (PNG) - 24.20 kB - 05/04/2018 at 07:22


Raw setup.JPG

Picture of ugly as sin turrent and rest of components- still to have compass and lidars mounted.

JPEG Image - 106.25 kB - 04/27/2018 at 11:25



Overview of architecture

JPEG Image - 46.03 kB - 04/26/2018 at 21:48


  • 1 × Raspberry pi zero
  • 1 × Raspberry pi plus 2tb hard disk
  • 1 × Power supply for servo
  • 4 × VL53lox Lidar sensors
  • 2 × hmc5883 Compasses

View all 11 components

  • Success

    Stan05/16/2018 at 23:13 0 comments

    FOund out mu calculations (basic trig were stuffed!)

    Have rectified and did a scan of the cardboard box.

    When plotted - I saw the outline of the cardboard box.

    The lidars did return a few weird readings (outliers)  - I believe I can set the lidars for long range or short range. Going forward will have to consider if the turrent would be used in robotics projects what is the range required - suggestions?

  • Found out the issue with plotting

    Stan05/13/2018 at 22:44 0 comments

    Have an issue with the calculations - Did a scan with a square box over the turrent.

    After scanning and running thru the calcs the plot looked like;

  • Progress and a 'Doh!'

    Stan05/09/2018 at 20:59 0 comments

    I have been testing with using the turrent to just scan a corner of my office - on a desk with a screen to the left and 2 corners of the room. I am sitting at my desk within scan range and the rest of the room appears to be out of range.

    To test this, I am dumping the data out in .csv format and running it thru excel to perform the calculations to get a x/y coordinate centred on the centre of the turrent.

    Had some dumb moments getting the formula correct in excel but eventually got what I believe are the correct x/y which I then produce a scatter plot.

    First issue is that the scan steps may be too big - so may have to refine them. Also having difficulty in fully relating what the scan does with reality. 

    So I decided to simplify things by enclosing the turrent with things like a cardboard box and something circular.

    Didn't have a box handy but did find one of my wifes large saucpans (about a foot in diameter (don't tell her please).

    DId the scan and the turrent compass data was weird in a lot of readings. Realising that enclosing a electronic compass with a metal shield is probably not the best plan! (That was the 'Doh!' moment.)

    Anyway, after taking out the erroneous readings, the plot does show a pretty good circle - so getting there. 

    Next test will be with a (non ferrous) cardboard box!

  • Brief update

    Stan05/07/2018 at 21:18 0 comments

    In summary, the hardware is complete. 

    I have dumped the readings and now have to perform some transformations to convert the readings into x/y coordinates centred on the middle of the turrent.

    Unfortuantly, recovery from surgery has taken a tad longer - and perhaps the after-affects of the anasthetic my mind has been a bit fuzzy.

    WIll try to get back to it tonite!

  • First set of tests results

    Stan05/04/2018 at 07:22 0 comments

    OK finalised the build (managed to 'obtain' another hmc5883 compass which gave me a set of 2.

    Finalised the current servo code.

    Integrated the lot and dumped the data into a CSV file.

    If you wish to play - go for it!

    I did some simple calculations in the data imported into excel and can see the corner of my office with the screen in the corner.

    Still a bit of work to do

  • Teeny setback

    Stan05/03/2018 at 11:46 0 comments

    my original compass was a HMC5883 - I purchases 2 new compasses and started testing.

    They didn't work.

    After careful checking the supplier has now substituted MAG3110 based compasses - different I2c address and different codes.

    Have them working under python now have to decode what the python module is doing and transcribe to C.

    (Also just got out of hospital having gallstone removed - so that has slowed me down a tad!)

  • Assembly of final prototype

    Stan05/01/2018 at 22:27 0 comments

    No picture (as yet) - Sorry.

    Made a new prototype and installed turrent compass, and lidars and connected it back to Pi Zero. SHould be getting servo controller today and will replace cludgy pi controlled servo with servo on i2c!

    Once again one sensor didn't work - normal issue of SDA/SCL being wrong way around.

    Also mounted sensors 90 degrees out of phase - 5 minite job to resite (glad I used mounting tape to temporrarily hold them.

    If all goes well, will integrate all my code-stubs together and commence final testing.

    Then to set up my github with all the source code - and finalise the documentation here.

  • Added a component

    Stan04/30/2018 at 21:53 0 comments

    I have added one component - an external servo controller (in I2c) - makes life a tad simpler (although it is a bit of overkill - 16 channel servo controller for 1 servo).

    Note that I do have an Onion Omega2+ with a servo hat - the trouble is that the Omega seems to have issues with MQTT in particular doing DNS lookup (I don't want to hard code IP addresses) so that is on the back burner for the moment.

  • Minor whoopsie log

    Stan04/30/2018 at 21:50 0 comments

    Minor whoopsie - the compasses are on a fixed address - therefore both compasses will be connected to the I2c port expander and selected in turn.

    (for some reason I thought you could add vin to one pin to change I2c address)


  • Project log - physical construction

    Stan04/27/2018 at 11:20 1 comment

    OK Servo and current physical construction complete - POC so ugly as sin!

View all 15 project logs

  • 1
    Turrent Physical design.

    As mentioned, I am using two storm water end caps for the physical turrent. The first test just eyeballed the centres however I now need to get a better version. The caps I have have a 11cm inside diameter (with a lip about 2cm high).

    To get a decent template, I fired up Visio, drew a 11cm circle then placed two lines thru the centre (one vertical and one horizontal). The ends of these lines give me the LIDAR centre positions. At the centre of the 11cm circle I put a little tiny circle - this is a drill guide spot.

    Printed it out and made work with the scissors and dropped it into one of the end-caps. Fitted perfectly so now have the drill template and the exact positioning for each lidar.

View all instructions

Enjoy this project?



Stan wrote 05/09/2018 at 21:00 point

The testing shows that the compass's are returning good readings - so the servo does not appear to be interfering. Note that I only issue compass reads when the servo is still.

  Are you sure? yes | no

Stan wrote 05/02/2018 at 09:39 point

possibly - in the process of testing - however....

I am not using the compass's for absolute direction - I am really interested in comparing the two compasses in order to determine how far the current has rotated in relation to the fixed compass. Also FWIW - I would look to have the servo settle before reading the compass.

Time will tell......


  Are you sure? yes | no

deʃhipu wrote 05/02/2018 at 09:37 point

Do you have problems with the magnetic field from the servo interfering with the compasses?

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates