The code is far from complete but I think I've got all the components together and built up. Take a look:
I ended up tossing out the top portion of the robot kit and just used the base and motors. I designed and printed three custom tiers to hold everything vertically.
I added an infrared sensor for low level obstacle avoidance and redundancy.
I've been working on this site rather than working on the code this past week. I find it hard to do both. I'll update the repo eventually, right now I've just been working out of a local copy. I have to finish driving the individual components then I'll push.
Okay, okay, time to get serious. What can I do with the LIDAR data?
Autonomous Car. That's popular these days.
With it's capabilities, the LIDAR I bought works best indoors. I will make an indoor rover. It wont necessarily do anything except roam the apartment but it should be fun to make and keep me busy at nights...
The idea is that a rover type bot will have a LIDAR scanner on top of it. It will use the data from the LIDAR to capture a scan of the room and then move to the furthest available distance which should be a wall or open area the scan couldn't reach. When it meets resistance, it should make a new scan and go towards the next furthest distance/wall. Something like that...still a work in progress.
Here's the stuff I'll use:
Jameco electronics has this robot base on clearance, they're out of stock on the 2-wheel version so 4-wheel drive it is. Turns out to be the DFRobot Pirate; just without the box. Neat.
Next I need something to drive the motors. I've made my own motor controller in the past so I'm just gonna use this controller from Adafruit. It's meant for Arduino based C++ libraries but I can make the board work using C just like I did the SD card. It will just take time. It's nice and small and with individual h-bridges, it's spec to do the right job.
For power I'll use a 5-volt rechargable battery pack. 5000mAh.
I also bought a new type of IMU that will supposedly spit out Euler angles and acceleration rather than just raw 9-axis measurements. The BNO055. It makes my Senior Design Data Analysis look trivial, but that's what 6 years of improvements will get you. I know how complicated it can be to try and extract linear acceleration for a single vector using raw sensor data [accelerometer, gyroscope, magnetometer]. This thing does it for you.
Alright, I'm talking to the LIDAR just like I said I wanted to. I can complete a full 360 scan..now what?
I'm not totally sure. I am happy that I got things working but I should probably do more with this device than just prove it out. I guess my next step depends on the application I want to use the LIDAR for. Until I figure that out, I just have an endless data stream that does nothing.
One thing I can do to that data is store it for later analysis. So that's my next step. Store data.
I had a feeling I would want to store the data, so when I bought the LIDAR I also bought this little microSD and RTC breakout board. It uses SPI to talk to the SD card, so I needed to go back and initialize SPI and its respective clocks and interrupts.
I ended up using FATFS to save the data in a human readable format. That's another abstraction layer. I save the data as a comma separated variable list so that I can easily import into Excel or Matlab later on.
I get 4000 samples per second, each 5 bytes long [20,000 bytes per second]. I don't think offloading the data to the SD card for later analysis is practical but it works for now. The unit is stationary so hours of data are not needed to be stored, just a second or so.
The LIDAR arrived. I first used the associated PC software to test that it works and it does. While I was waiting for the part to arrive, I had been reading the about the protocol necessary to talk to it. Seems pretty straight forward. A quick and dirty test proves fruitful; I can read the Device ID and start the motor…yahoo!
Though meant to be a development kit, the LIDAR unit doesn't sit flat on my desk. It has a cable that sticks straight down. So I designed and printed a bracket to hold the device.
I ordered the LIDAR from Adafruit along with some other goodies. It's going to take about a week to get to me. No worries, there's plenty of planning and initialization I can do before I actually get the parts. Lots of reading to be done.
I have a STM32F767ZI development board I was gifted. That's a pretty powerful ARM M7 processor in there and it's just collecting dust. I am going to use it as the main MCU for the project. That's a big choice actually. I could just hook the LIDAR up to an Arduino, use a bunch of people's code libraries and say I built something...but what fun would that be?
I did end up deciding to use some abstraction to start. ST has a code generation app called STM32CubeMX that helps with board initialization. There's board support files and examples so I don't have to do everything raw. While I am waiting for parts, I've gone ahead and made some tasks. There's a heartbeat timer (blinky light) and other timers, a couple UARTs and I2C. I set up and tested stdio's printf function to use UART3 as stdin. I'm not a big fan of printf for debugging (just set a break-point), but I don't have a problem with it for making console interaction. Just plug in the USB cable and open TeraTerm.
I've been itching to talk to some sensors lately. Check out this inexpensive LIDAR [ Light Detection and Ranging ] system from Adafruit:
I keep thinking about it. Wouldn't it be cool to scan a room? Even if it's a 2D map, it looks pretty neat. I think I want to build something that uses LIDAR.
Enter my new project: Make'n Something that uses LIDAR.
Now, there is already Computer software for the mentioned device that will show a point-map of the data. There is also a tutorial on Adafruit but it uses python and a raspberry pi...basically a computer. Computers are cool and all, but I would really like to use a micro-controller to talk to the device directly and see how far I can take it. None of this SLAM, ROS or Arduino stuff, just a bare bones system. Maybe one abstraction layer for dealing with initialization and controlling things like UART, but nothing too crazy.