Thursday, January 28, 2021

Cleaning up the wires and experimenting with motion.

Alright so today, I installed the boards on the chassis using screws. I had to drill the chassis and now it looks much better with everything mounted. While I am troubleshooting the motion of the robot I took off the camera and the distance sensor. The battery packs are currently, hot glued onto the chassis, until I figure out something better. I didn't have enough screws, so each board is mounted with only two in diagonal corners.

 The super long motor cables are very annoying, but I don't want to cut them as I'm nervous about soldering them. Maybe I can zip tie them?

Currenltly I am working on motor control. I am using a raspberry pi and two L298n motor controllers.So far I am having trouble getting a consistent response and I suspect the GPIO pins on the pi. The creator of the Rpi.GPIO library mentioned that it is not suitable for real time applications, since python does some stuff in the background that messes up the timing.


As an option I am considering adding an Arduino to the project, to improve the robot's real time response. Eventually I want to be able for the robot to drive autonomously and it will be very difficult in that case to compensate for delays.

Also another thing that I have discovered is that pins 0-8 on the Raspberry pi start out as HIGH. Which is terrible, because it means if I am using them to control the robot, it will be spinning wheels while the program isn't running.

In the picture above I have an arduino nano clone inserted onto the bread board. I wonder if that will be enough to deal with the motor controller issue. If that doesn't work I can switch to an arduino uno I have lying around. But of course I need to think about how I am going to power it. They can be powered with a 9V battery, but I wonder if that will run out too fast.

Electrical components of the robot.


The goal of this exercise is to create an autonomous mobile robot that can drive around my house and maybe even perform a task such as pushing balls. In order to do the advanced computation required I'm going to use a Raspberry Pi 3 A. This little computer should be enough to take in data from the sensors (camera, ultrasound) and output the signals to drive the motors. 

The raspberry pi runs on 5 volts, but the motors require 12V. Furthermore the pi can not supply enough current. To solve this issue I am going to use the L298N motor controllers. These are fairly popular in the hobbyist community and can handle my voltage. They are also capable of PWM (Pulse width modulation), which is used to control speed of the motors.

In order to drive 4 motors I am going to use 2 of these controllers since each of them has 2 outputs. And to power the motors, I am going to use a simple battery holder that can house 8 AA batteries. When using non-rechargable batteries of 1.5V each I will be able to get 8*1.5=12V that I require. This is purely because I am being cheap and do not want to shell out for a bulky LiPo battery that is used to power drones, and RC cars. Eventually I can switch to rechargeable batteries. Those have the voltage of 1.2 volts, which will get me about 9.6V, this the robot is just used to drive around my house this will be fine as I don't need it to go as fast as it can.

The raspberry pi is powered by it's own stand alone battery, which is essentially a phone charger. But Peter, why can't you just use the main battery pack to power the pi??? I'm glad you asked. The reason for that is that the pi needs a specific voltage and current, which I can not accurately produce with the main battery. I have tried using a populu voltage regulator to step down the battery voltage to 5V, but it wasn't consistent enough power the pi.

I was really excited to get started with this project, so as soon as I put the chassis together with screws I slapped on all the electronics with tape and tested it.

 

 As you can see this is a huge mess. One of my favorite robot philosophies is BEAM. Which stands for Biology, electronics, aesthetics, mechanics. The idea behind BEAM is to build simple robots based on simple organisms such as instincts. As such just like insects these robots do not have a brain. Meaning the don't use micro-controllers, but instead use analog circuits to control the robots. This is very different from what I am doing, but the philosophy of aesthetics applies all the same. Aesthetics are important, because often times they are directly related to safety and overall sense of the concept. If a gazelle had its guts hanging out it would be pretty ugly right? Yeah! It's the same with the robots. Having a bunch of wires everywhere looks pretty gross and is not very safe.In the future I will install the board with screws onto the board. I also need to figure out how to mount the camera and the ultra sound sensor that will be used to measure distance.

But for the time being I can test this thing. Using a simple python script and the Rp.GPIO library I was able to test the motors. And the results were not great. Each motor spins backwards and forwards, but when I try to spin them together, they aren't synced up. Sometimes some of them don't turn on. I'm happy that all of them spin, but I need to work on making them more consistent.

Mechanical parts of my new robot project.


In order to keep myself busy and my skills sharp. I have decided to make an autonomous mobile robot. I wanted a sturdy chassis that could house many different components and support a fair bit of weight. I also wanted to have encoders so I could build closed loop control. And my most coveted feature is mecanum wheels.


For those of you that are not aware mecanum wheels have rollers that allow spin, thus eliminating the force of friction in one direction.

By Gwpcmu - Own work, CC BY 3.0, https://commons.wikimedia.org/w/index.php?curid=11440618

Because the rollers allow spin, if this wheel is turned forward it would actually travel diagonally, since the only grip it has is diagonal. By arranging four of these wheels together we are able to balance the friction forces and do some crazy stuff.


As the picture above shows a robot with four mecanum wheels can travel in any direction, including sideways and diagonally. Needless to say I am very excited to try them out. 

So to accomplish all of this I bought the moebius robot chassis from moebius tech in china. The cost was about 115$ CAD, which is reasonable in my opinion. Here is a picture of the components, prior to assembly.


The kit is meant to go with the solution that the company provides, meaning you're meant to follow their instructions exactly and install an Arduino on there. This is why you see a very specific pattern of holes on the chassis. They are meant to mount the electrical components that the company provides. We are gonna go off the beaten path and install different components, so hopefully at least some of those holes will line up with the mounting holes of my electronics.

Part of my decision to buy this also comes from the material of the chassis. Aluminum is an amazing material to work with since it is light, easy to machine and doesn't rust. My chassis is anodized to be a stylish black, which I'm very happy with. If I need to add more hardware onto it in the future such as a robot arm, it will be strong enough to support the weight and also to attach securely.


NEW Project Autonomous underwater vehicle!

  I have been more and more interested in Autonomous Underwater Vehicles and ocean exploration. I live on the coast with direct access to th...