Wednesday, February 3, 2021

Motor control success

 Hooray! I got the motors to work!


So previously I was having a lot of trouble with the raspberry pi to achieve consistent motor control. I decided to try an arduino, the hope was that I could get away with an arduino nano, however it's votage of 3.3 was not enough to drive the 5V motor controller. Since then I switched to an arduino Uno.


At first I was having a lot of trouble with the motors turning on and spinning in the right direction. Then I moved the line that activates pwm outside of the loop that controls individual wheels. This helped the timing a lot and I will use this method going forward. Presumably I won't need to have the wheels at different speeds.

Here is a video of the robot performing a test routine:


The robot performs considerably better on linoleum than on carpet. This is actually a bit of a problem, since if I want it to drive around the entire house, it will either need to be able to :

1. Detect carpet

or

2. Be able to know which parts of the house have carpet, and be able to accurate find its own position from encoder feedback. I think this will be very unreliable.

The next steps will be to implement communication between the arduino and  the raspberry pi. In another project I found done by masters students at EPLF, they used I2C to setup a master-slave system, with the Arduino being in control. The idea here is that the arduino is bullet proof and will execute commands even if the pi fails. Since I've already spent a considerable amount of money on this thing I won't implement this as I would need to buy and I2C bus. Instead I plan to use serial communication by connecting the two platforms with a usb cable. I'm running out of space on the chassis and might need to start elevating components for this to work.

One of my problems during the motor control tests is that one motor kept turning. Later I figured out that this is because the digital pin 1 (which is also the tx pin) kept out putting signals. If the arduino is going to be my main platform that takes in sensor input, then I'm going to use so many pins that I will inevitable need digital pin 1. So I will need to figure out how to configure it. 


That being said I can still start on connecting the encoders. Each encoder has a 5V and ground pin and an A and B output. the A and B are signals that will help determine the amount of rotations the wheel makes. More on this in a future post.

Also I finally recieved my rechargeable batteries. So now I can switched to a more sustainable power source. This will drop the votage of my system considerable but I think it should still function. The demo above used half speed and was still decently fast.

No comments:

Post a Comment

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...