Off-road Vehicle
Project objective:
- Vehicle capable of climbing and overcoming obstacles.
- Use of recycled mechanical materials.
- Raspberry pico W module with Micropython programming.
- Detection of obstacle height for automatic obstacle clearance.
- Display of parameter changes via WIFI on PC or smartphone browser (useful for settings).
Supplies
Both images show the components needed for manufacturing. The first focuses on the electronics, while the second concentrates on the mechanical aspects.
The mechanical part consists mainly of Meccano parts. You can easily find lots of parts on the net at low prices. I bought 2.5kg of Meccano parts for 10€. The advantages are :
- Material recycling. No need to buy materials (rods, brackets, plates) to shape..
- Easy to assemble, with no need for drills or saws (or almost none at all). Ideal for an experimental approach. You can assemble and disassemble until you get the result you want.
Careful selection of some components:
- Powerful battery to generate the energy needed for movement. For information, the vehicle described weighs 3Kg.
- The quality of the wiring is essential to satisfy the high current demands.
- Use a 0.75mm2 lead from the battery to the circuit board, and from the circuit board to the motors.
- Use the rigid connection wires on the mounting plate to facilitate wiring.
Electronic Assembly
Assembly diagram
The schematic is simple and requires few components. For the mock-up I had used two L298N modules with PCB terminal blocks. Following false contacts and erratic vehicle movements, I opted for an integrated solution on a single mounting plate.
Installation features
The power supply includes a powerful battery that supplies direct power to motors and servos. A 7805 voltage regulator and a Mosfet transistor supply the circuit. If the circuit is powered via USB, the Mosfet cuts the battery supply (see pico-w-datasheet for detailed explanation).
Use of the 4069 inverter circuit reduces the number of GPIOs.
Electronic assembly
Prior to physical assembly, a wiring mock-up was created. PowerPoint software facilitates component placement and interconnections. On the mounting plate there's still room for any additions. The PowerPoint file is available in the project package.
The use of a solder mounting plate makes the whole thing compact.
The remote control
The assembly is controlled by Bluetooth via a remote control. The construction of the remote control is explained in the link: https://www.instructables.com/Remote-Controller-for-DIY-Robots/
Any other remote control that can send sequences of characters can be used. For example, the “Bluetooth Remote” smartphone application is free and easy to configure.
Mechanical Assembly
The pictures show how the Meccano parts I had at my disposal were assembled. They are given as an indication and should serve as inspiration.
The wheels are assembled as follows.
The motors are mounted on an A-shaped support. The top of the “A” is fixed to the chassis. The “A” can swing freely around this point (flexible mounting). A rod attached to the servomotor acts on the sides of the “A” to rotate the motors around the axis. This is how the wheels are raised and lowered to move up and down obstacles.
When the vehicle is in the horizontal position, the linkage is not in contact with the ‘A’. Contact will only be made when the servo has turned several degrees. This gives flexibility to the wheel mechanism. The vehicle can then pass over small obstacles without servo assistance.
There is no steering system. To turn left, for example, all you have to do is put the right-hand motors in forward gear and the left-hand motors in reverse. The vehicle then rotates on itself.
The Vehicle Program
The project consists of two files:
The “L293D_lib.py” file.
The program uses functions and “.self” classes to facilitate design and reading.
The motors class defines two families of functions. One for front motors and one for rear motors. The same applies to the servomotors class.
The “IR_read()” function reads the distance to the obstacle on GPIO26. A formula converts the measurement into cm. It provides the servomotor angles required to climb the obstacle.
The file starts with the Wifi connection. The module displays the IP address (DHCP) of the connection. Once the address has been established, it will remain the same thereafter. The microcontroller LED signals when the browser (PC or smartphone) can connect. When the LED flashes, it indicates a failed WIFI connection. The controller must then be restarted. The “sendmsg” function is used to display motor, servomotor and IR_read status information in the browser. This facilitates calibration. For settings, the model does not need to be connected to USB via a cable.
main.py file
The “motor_rear and front” and “servo_rear and front” functions define all the sub-functions required for manipulation (using “.self” classes).
Other functions such as “move, monte_av, monte_ar and detect” take these basic functions and turn them into more advanced functions.
On start-up, the program waits for Bluetooth information from the remote control. The sequence received from the remote control consists of three values: the position of the potentiometer (horizontal and vertical) and the button used.
Depending on these indications, actions are launched on the motors and servos (the image shows the relationships).
Download project files HERE.
The Remote Control Program
The remote control was the subject of a project published on this site (https://www.instructables.com/Remote-Controller-for-DIY-Robots/). The program has been revised and the version adapted to this project can be downloaded.
The main modification is the transformation of the voltage supplied by the potentiometers into values on the -100 to +100 scale. This makes it easier to use for motor control. Values between 0 and 100 correspond to power for forward travel and 0 to -100 for reverse travel.
Conclusion
The project took several months to complete, in order to find the right positioning for the wheels, motors and servomotors. This was made much easier by the use of Meccano parts. The successive assembly and disassembly stages were simple and pleasant, not to say exciting. I hope this will inspire one or two DIY enthusiasts. Enjoy-it!
References
https://circuitdigest.com/microcontroller-projects/build-your-own-mars-rover-robot-using-arduino
Document: pico-w-datasheet.pdf for the power supply
Inspiration l298n_lib.py (for the .self class) from peppe8o Blog: https://peppe8o.com
Webserver: https://www.raspberrypi.com/news/how-to-run-a-webserver-on-raspberry-pi-pico-w/
Document connecting-to-the-internet-with-pico-w.pdf