RoverBot Phase 2: Control Module and sensors

Components:    – PIC DEM 2 plus board

– PIC16f877

– SHARP gp2d12/gp2y0a21yk IR Distance Measuring Unit

This slideshow requires JavaScript.

Task:      Measure distance using sharp sensors and display it on the demo board’s LCD

Purpose:              To demonstrate the use and understanding of the MCU of your choice, and the distance sensors.

Objective:           Use the PIC microcontroller to get a reading from the gp2d12 sensors. Translate that reading into a distance value and display it on the PIC DEM board’s LCD module.

I have worked with the SHARP distance sensors on a previous ‘Radar’ project, so they weren’t very had to get working. But as was the challenge the last time, getting an accurate and constant distance conversion formula would be the hardest part.

The biggest drawback with the SHARP range sensors is the non-linear data output, so I had to work out a way to linearize the data while maintaining the reading integrity.

I ‘Google-d’ a few interesting articles and though they were very helpful, I still struggled with the conversion. It worked with large ranges but it wasn’t consistent and since I was running on a dead-line, I couldn’t work on it for too long.

I opted to work with the sensors analog voltage as a reference instead of converting it to a distance measurement.

By now I was pretty comfortable with using the ‘PICDEM board’ and our chosen programming platform, ‘mikroC for PIC’…(We had been given a few simple assignments to work on in order to familiarize ourselves with both the hardware and IDE).

I used the pic16f877a’s internal ADC to read the sensor output and after converting the ADC value to a float voltage value, I used that as a range reference for my wall detection functions.

References:

ww1.microchip.com/downloads/en/devicedoc/51275d.pdf

Rover-bot Phase 1: H-Bridge Motor Driver

Components:    – L298n full-bridge driver

                                – 1N4937 Diodes

                                – 100nF (104) Capacitors

                                – 7805 regulator

                                – Vero board

Task:      To build a motor driver circuit that will be used to control two 12V DC motors.

Purpose:              The control circuit will be used to move the rover-bot forward, in reverse, and turn either left or right. It will later be connected to a microcontroller, which will handle all the movement AI.

Objective:           The immediate objective is to be able to drive the motor/motors by manually switch the input signals to get the motor to spin forward and backward.

 Before started any soldering or even planning, I had to read up about all the major components I will be using, namely the L298n driver. I don’t know about anyone else but datasheets usually speak an extraterrestrial language to me, so I need more than just that. I always get a better understanding of anything if I see it in a practical application.

  After getting a basic idea of what to do I started my planning. I always make/use sockets for all my discrete IC components, partly because I’m not too confident with my soldering skills and just so that I can use them again. Plus it’s easier to replace just the one component instead of having to re-solder the entire circuit.

I decided to break down the circuit into sections. The L298n circuit on its own, and the actual h-bridge diode circuits separately as well. (Look at the pictures!)

This slideshow requires JavaScript.

I gave all my wires grace length just in case. It was a bit messy when I had to test it out, but since the final design of where and how my circuits will be mounted onto the rover-bot chassis hasn’t been decided yet, I put up with it. As soon as the design is sorted, I will have to shorten some, solder some down, and join some other wires.

All in all phase one wasn’t too much of a hassle, and it worked like a charm. Two thumps up for me 🙂