Showing posts with label Electricity. Show all posts
Showing posts with label Electricity. Show all posts

Thursday, July 6, 2017

Arduino Part 7: The Test

A few weeks ago, I picked up the Arduino Uno that I've had for a while, and started thinking about what I should build with it. I decided on modifying an old toy rover that I had, and making it wirelessly drivable... but with 2 way audio and a camera feed. single-frame camera-broadcast.


Links:
Part 1: Initial Plan and Reverse-Engineering
Part 2: Preparing the Rover Chassis
Part 3: Motor Control
Part 4: Bluetooth!
Part 5: Mounting
Part 6: Batteries
Part 7: The Test

- Chassis: Check
- Motor Circuitry: Check
- Bluetooth Functionality: Check
- Android App: Check
- Arduino Mount: Check
- Power: Check
- Double Check: Check

Now what happens when I put it together and turn it on?

On May 18th, I put batteries into the compartments. I put the Arduino on the rover. I plugged all of the motors into the breadboard, with their uncomfortably long wires. I plugged in the positive power. I checked the circuitry twice for errors, and tried to think of any solder joints that might need to be changed.

My mom helped me record the first test.
Here are 4,249 pictures of it:


Success

Since then, I've stopped working on it... I still might set up an audio system. In theory, it won't be nearly as complicated as a camera system, requiring less bandwidth to work.

Speaking of cameras and bandwidth, an image-broadcasting system, unfortunately, isn't practical. Even at 480x360p, black and white (One byte per pixel), each image would be 1.4 Mb, or 172.8 kB. The Arduino Uno has only 2kB of SRAM... Way too little to store an image. Plus, even at a baud rate of 115,200, it would take 12 seconds to broadcast. In my calculations in part 4, I mistook 115,200 to be the number of bytes, rather than bits, per second, so I thought it would only take 2.66 seconds per frame (with 78% more pixels).

Here are the project's credits:

Myself:     Designer, builder, programmer
My mom:  Inspired me to do this project, and lets me explain problems to her
My dad:    Sponsor and design help

Thursday, August 25, 2016

Arduino Part 6: Batteries

A few weeks ago, I picked up the Arduino Uno that I've had for a while, and started thinking about what I should build with it. I decided on modifying an old toy rover that I had, and making it wirelessly drivable... but with 2 way audio and a camera feed. single-frame camera-broadcast.


This is the sixth part of several posts. I will be explaining about how I set up the power supply of my rover.

Links:
Part 1: Initial Plan and Reverse-Engineering
Part 2: Preparing the Rover Chassis
Part 3: Motor Control
Part 4: Bluetooth!
Part 5: Mounting
Part 6: Batteries
Part 7: The Test

To start with, here are some facts about the situation:
  The rover is only designed to hold three AA batteries (4.5 volts).
  According to my multimeter when monitoring the long-disconnected-and-very-bored rover brain, the motors are designed to get the full 4.5 volts from the batteries.
  Arduino requires, at the very minimum, a stable supply of more than 5 volts.

This makes it more difficult than I originally thought, which was: "Let's just hook up a 9-volt!" Browsing Google search told me otherwise...

I wasn't about to go looking for how to use a switching regulator, so plan B was to use AAs. Three for the motors and four for Arduino means seven batteries total. That's even more than I remember RC helicopter controllers and the Lego Mindstorms NXT using.

Here's Plan B-and-a-half:

1. Test to see how few batteries can successfully power the motors (Two)
2. Add a single battery to the rover (For a total of four)
3. Have a third wire coming from the middle of the battery chain, thus using all of the batteries to power the board while two of those are also powering the motors when necessary.
4. Do extensive tests with my multimeter to ensure that the voltage never drops below 5 volts. If it does, fiddle with the circuitry until it's stable.

After the test was set up, I found that voltage dropped drastically at the moment I started the motors. Voltage would then very slowly increase as the motors weren't requiring as much power to continue spinning. I added the biggest capacitor I had (1000 μF, also referred to as 1mF). This made good progress, but the capacitor was discharging too quickly. This delayed, but hardly reduced, the voltage drop.

To combat this, I added a 1KΩ resistor between the power / capacitor leads and the Arduino Vin wire. This was a mistake because then, while tests showed satisfactory results, trying to power the Arduino didn't work. The resistor was choking Arduino, and my multimeter couldn't tell because it has a very high internal resistance.

My next attempt was to add the resistor in series with the capacitor, leaving the power wire directly connected to Arduino's Vin pin (Or, at first, the multimeter's lead). This was successful. Charging the capacitor wasn't noticeably affecting results, and voltage would slowly drop, but not to the fatal 5V level, when spinning the motors.

The final test went very well. Arduino turned on. Power was stable. (Manually) activating the motors didn't break anything, and Arduino didn't die when I kept the motors going for several solid seconds. Success!


To get the extra battery into the rover chassis, I had to take a AA holder from another kit, solder it up, and tuck it into the Rover. This would, unfortunately, require me to dismantle the rover in order to change all of the batteries, but it's a personal project. It doesn't need to be super simple, especially since I've already got the Arduino sitting directly on top of the other batteries.

More tips... They just keep coming...

1. Do the math! Connecting random batteries would only have gotten me an overpriced blue paperweight.

2. Know your electrical engineering! The long-standing Kerbal convention of "More Power!" would have lead me to use more batteries rather than a capacitor. This would be less efficient and more likely to overheat the Arduino.

Edit: 7/6/17: Updated list of links

Wednesday, May 11, 2016

Arduino Rover Part 3: Motor Control


A few weeks ago, I picked up the Arduino Uno that I've had for a while, and started thinking about what I should build with it. I decided on modifying an old toy rover that I had, and making it wirelessly drivable... but with 2 way audio and a camera feed.

This is the third part of several posts. I will be explaining about my struggles to power the default motors with my Arduino. Prepare for math!

Links:
Part 1: Initial Plan and Reverse-Engineering
Part 2: Preparing the Rover Chassis
Part 3: Motor Control
Part 4: Bluetooth
Part 5: Mounting
Part 6: Batteries
Part 7: The Test

Now that the rover was gutted and is ready for installation, the next thing to do is configure a circuit to power the motors. It can't just be plugging the leads directly into the board. Prior to most of my research, I knew there were problems associated with taking too much current from the Arduino. After my research, I had a much better understanding and could eventually power motors through Arduino.

The maximum safe current from an Arduino output pin is 20 mA. That's 0.02 Amps. Ohm's law states that Current = Volts / Resistance. Using basic algebra to get resistance by itself, we get R = V/A. If we plug in the output values of the Arduino (5 volts, 0.02 A max), we get R = 5/0.02 = 250Ω minimum resistance.

I downloaded the Arduino IDE to my Linux drive (Yes, I use Linux and I love it) and started refamiliarizing myself with the IDE and programming language, which is a variant of C. I'm very familiar with Java (As is obvious from my Minecraft mods), so the learning curve wasn't too large.



I looked up a motor-control circuit, and found this. I recreated it with a motor from an electronics kit.
Measuring the motor's resistance, I got 100Ω, which is fine because the transistor from the same kit was protecting the Arduino. Then I hooked up one of the rover's motors...

Nothing happened.
I tried again: Nothing.
I left the blink program on and listened to the gearbox: Nothing.
Then I touched the transistor...
and promptly pulled my hand back. It was really hot.

I looked up the data sheet for that particular transistor and as far as I can tell, it's got a maximum current rating of 200mA. Measuring the resistance of the motor with my multimeter, I got... holy cow! 0.7Ω! That's supposedly pulling 7.14 A based on 5V/0.7Ω. I tried doing some math to find the right resistor to do the job. I got about 30Ω. I didn't have any of those handy, and figured that if they were designed for use with 4.5 volts from 3 AA batteries and 50Ω didn't work with 5 volts, then this transistor wasn't going to work.

Guess what. 2 100Ω resistors in parallel didn't work...

The headache intensified.

Finally, I gave up trying to use transistors. I went searching online for some relays. Luckily, I found some really good ones, the HE3621A0510, that were just what I needed (Hooray for Capitalism!)


They are rated for 5V, and have 500Ω resistance, thus requiring 10mA, and they only have 4 pins... That's exactly what I needed.


Due to the fact that it's the 510 version, it has an internal diode, (which in my relief I neglected to learn more about).

They came in the mail a day early, and I forgot to look in the giant yellow bubble-wrappered envelope for the bluetooth module (I'll talk about that in part 4).

I mapped all of the resistances with my multimeter. The two outer pins (Shown as green in the picture) had no conductivity, to be connected when electricity flows through the inner two, which had 515Ω. I plugged it into my project, and loaded the blink script...

Nothing. I got nervous, verified connections...

Nothing. The headache from the transistors returned...

I looked back and researched the exact model of relay... Mentions something about a diode.

I researched the Diode Suppressed Coil: A method of protecting delicate electronics from current surge caused by collapsing magnetic field in the coil. Thus, the relay only works one way. Here's more information on how relays and DSCs work.

I switched the direction of the relay, and... Poof! It worked perfectly! I've marked the negative and positive leads in the picture with black and red, respectively.

That concluded my motor-control headaches.

Part 4 will be about bluetooth serial communications and connecting to an Android phone (with a custom app)

Now for more DIY tips:

1. Do your research! I could have saved myself a lot of headache-hours and a burnt finger by just learning more about the transistor and relay I was trying to use.

2. Use Linux (Preferably Mint)

Edit: 6/1/16: Updated list of links
Edit: 7/8/16: Updated list of links
Edit: 8/25/16: Updated list of links
Edit: 7/6/17: Updated list of links