Cool Cap Engineer

Engineering by an anime nerd

Leave a comment

Projects: Arduino 24V Brushed DC Motor Controller Shield Update #4

wpid-20131228_181153.jpgWell, this is a first. This is kind of an embarassing first, but a first nevertheless. In my two years blogging on Cool Cap Engineer, I could never get past a third update for any of my projects. A lot of the times, I cancelled a project due to the huge time commitment for a project, or the lack of knowledge on the project’s topic. With that said: here’s the 4th update for the 24V Brushed DC Motor Controller Shield project.

In my last post, I mentioned that the original 24V Brushed Motor Controller circuit needed some improving. One of the crucial improvements I mentioned was adding overvoltage and undervoltage protection circuitry. Because of the power supply protection circuitry additions, I decided to look into the LM2574: a 12V/.5A Buck Regulator IC. By using the LM2574, not only will I be able to add the protection circuitry by manipulating the on/off pin of the regulator, but its surprisingly more efficient than the 7815 linear regulator I was using.I could not emphasize how efficient this regulator is. No matter how much I loaded the regulator, it still delivered 11.92V  to the load. Even when I loaded the regulator with a 24 ohm resistor, it still maintained 11.92V. Of course, the performance will change depending on huge temperature variations, but I’m assuming the final shield will be used at room temperature.


Just for the sake of curiosity, I wanted to see how the regulator performed when I loaded it with an Arduino, which typically draws 30-40ma. To my surprise I regulator delivered 11.97V to the Arduino. So I think I will use the LM2517 in the final design.

wpid-20131229_145616.jpgThe final thing I was thinking doing for the project was implementing the MC33035 brushless motor controller on the shield. The MC33035 can not only control DC motors, but it comes with a current limit. If I have time this week, I will implement the undervoltage and overvoltage protection circuitry with the 12V Buck regulator circuit and start working on the PCB for the shield, which will control 1 motor. Once I test the shield, I will modify the shield to control 2 motors.

Well, that’s it for me this week. Feel free to post a question, comment, or concern and I will do my best to respond back to you. See you guys next week and Happy New Years!

Leave a comment

Projects: Arduino 24V Brushed DC Motor Controller Shield Update #2


In my last post, I talked about my newest project; a 24V DC brushed motor controller shield for the Arduino. I mentioned my setbacks in my post and that in my new post, I will give an update for the project. Unfournately, the only thing I could do last week was replacing my old Arduino Duemilanove with the Arduino Uno. Until I can test the circuit proper, I decided to spend this post discussing how I intend to control this 24V motor.


If you’re a regular visitor of this blog, an electrical engineer, or just an electronics hobbyist, then you’re probably familiar with an Hbridge. An Hbridge is an electronic circuit that changes the direction of current flowing to a motor in order to change the rotation its shaft. To change the flow of current, four switches are used. Using the figure 1 as a reference, the motor’s shaft rotates clockwise when S1/S4 turns on, and when S2/S3 turns on.

Today, these Hbridge switches are replaced with transistors. Lower voltage Hbridges can be made using Bipolar Junction Transistors (BJT) since they require little current to properly control lower voltage motors. However, if you’re control 12V and more motors, then BJTs would be horrible as they will require more current to control these motors. So instead, metal oxide semiconductor field effect transistors (MOSFET) are used since they “ideally” consume no power to turn them on. For motor control, Power MOSFETs are used. There are two types of MOSFETs: Pchannels and Nchannels. I will not discuss the physical difference between them, but I will mention that Nchannels turn on when you apply a positive voltage to its gate, and Pchannels turn off when you apply positive voltage to its gate.

Alas, MOSFETs also have problems to consider. One problem is that if you try to pass 12V or more through the Nchannel MOSFET, then you need at least 12V to turn them on. Also, to turn off a pchannel, you to apply the same voltage you’re sinking through the MOSFET to its gate. I seen many forum posts in which people blown out their MOSFET forgetting this important fact. Of course I’m no different since I made the same mistake senior year of college…and in my last post.

Now that I talked about the theory of this motor control, let me talk about my proposed circuit. In my Hbridge circuit, I have my upper switches comprised of pchannnel MOSFETs and my bottom switches made up of nchannel MOSFETs. To turn on just one pchannel MOSFET, the Arduino will activate a low current NPN transistor, which will turn on the pchannel MOSFET because of the voltage divider at its gate. However, when the NPN transistor is off, then the voltage at the pchannel’s gate will be equal to the voltage being applied to it. By having the voltage applied to equal to the voltage at its gate, the Pchannel turns off. This method is repeated for the other pchannel MOSFET.

Finally, to control whether an nchannel is off or on, 12V-20V must be applied to the gate. Unlike a pchannel MOSFET, the voltage applied to the gate can be a separate voltage from the vvoltage applied to it. To accomplish this, I used low side gate drivers (IR4427) to provide the right voltage to turn the bottom Nchannels on or off.

Now that I explained the theory the best way I could, let me discuss what’s next for this project. Although I did not test my Arduino to my motor control circuit yet, there’s a glaring problem with the circuit. There is no isolation between the Arduino and the circuits responsible for driving the MOSFETs. In order to achieve this, not only will have to look into optoisolators, but also isolated DC to DC DIP modules. But that’s another post. Another item that I will have to look into is setting up an undervoltage lockout circuit for the circuits driving the MOSFETs gates.  By adding an undervoltage lockout circuit, the motor will not turn on until the right amount of voltage is applied to the MOSFETs.

Anyway, that’s it for me today. If you have a question, comment, or concern, feel free to leave a comment. I will see you guys, next week.

Leave a comment

Projects: Face Tracking Turret Update #3


And you guys thought I forgot about this project! Oh no. I just been busy with school that I had to put the project on the back burner. However, I did buy the rocket turret from Here’s what I found from my dissection from this rocket turret.


Underneath the rocket turret was a couple of rubber stickers, which actually hid the screws for the base. After unscrewing the base, I found the main controller for the turret. I could not tell what was the microcontroller that was used, because I spent most of my time learning which wire controls the three motors inside the turret.


After I unscrewed the bottom of the base, I proceeded to  the top of the base. It seems like the rocket turret is able to move 0 degrees to 180 degrees due to the mechanical system shown above. The top base can also tell whether or not it will not exceed 0 or 180 degrees due to the switches inside the top of the base.


So I proceeded to tear apart  the bottom base some more.  Inside the base contains two motors. These motors are responsible for rotating the head of the turret as well as moving the head 0 to 180 degrees.


The final part I looked at was the main turret head. This was the part I ran into. The problem I was having was figuring out how the firing mechanism work. The firing mechanism uses a small dc motor, but there seems to be a certain sequence that must be achieved before the missile can be launched. Because of this, I’m changing the face tracker to use a small water pump I found on

Well, that’s all I have for you guys today. I’ll let you know any new developments I have for the project.

Leave a comment

Projects: Face Tracking Turret Update #1

Hey guys! Long time no chat. Sorry for my lack of updates lately, but I’m not only swapped with school work, but I have a ton of research work as well. A couple weeks ago, I mentioned to you guys about my new project, the face tracking turret. Well, it turns it might be more difficult than I imagined. Not only because I never did image tracking before, but because my original idea on how to do the face tracking is probably not going to work.
My original idea for the face tracker is to connect the camera to Matlab 2012b, use its image processing library and computer vision library. I knew for a fact that Matlab can do image processing without any problems. The problem? Well…the computer vision library costs an arm and leg. That’s no problem, right? My school’s Matlab license should cover it? Nope. The library is so expensive, that even my school refused to add it to our Matlab 2012b installation. I will try to see if the computer vision library is in the Matlab 2012a installation but I doubt it. However, there is another option. I looked into OpenCV, an image processing library for not only Android phones, but Python as well! So project is far from over.
Another important issue I started to think about was the turret’s defense mechanism. Originally I thought about using USB missile launchers, but there’s no documentation on how to take these things apart. I have two options: take the usb missile launcher apart myself and post the documentation online, or have the turret shoot water at its victims. I’m still thinking about it.
In the past, I always used PIC microcontrollers in a heartbeat. However, I think I will stick with the Arduino this time. Most specifically, the Arduino Mega 2560. You know the best part? I got it for free from my Mechatronics research. Another reason why I might use the Arduino Mega is the fact Simulink, Matlab’s graphical GUI interface program, fully supports Arduino. So, if I find a way to do image processing using the Matlab, then I can easily create Arduino system blocks in Simulink to create the turret. I am kinda of disappointed that I do not have any tangible results for you guys, but I am still planning for this project. Stay tuned for more details.


Projects: Face Tracking Turrent

Hey guys! School is going okay-ish. I have fewer classes to take this semester, but I have a part- well contractual- time job, a lab assistant position, and a private tutor positions this semester. Not to mention an undergraduate research project to do. Speaking of which, I figured out my next project!

So the research I mentioned before is a mechatronics research. My friend and I are responsible for testing the new Mechtronics kits this semester. What’s cool about these kits is the fact that they use primarily Arduino, a Lego NXT motor and Matlab. Although I primarily use PIC microcontrollers, my experience with Arduino is much stronger than my experience with PIC microcontrollers. Lately, I came across a lot of tutorials which people are able to track their face using Matlab. Then I saw this beauty.

To make a long story short, I WANT TO CREATE THAT! I want to create a face tracking turret. Although my default choice is to use a PIC microcontroller, I might open the project to Arduino. One of the reasons I want to work on this project is not only the fact it’s wicked, but I have a final project to do for my Mechatronics class. You read that right. I’m doing Mechatronics research and taking a Mechatronics class at the same time. Ironic isn’t it (if not cheating according to my multiple friends)?

Keep in mind; I have no experience with image processing. In other words, I need to learn how to use the image processing library in Matlab. I already know how to communicate microcontrollers yo Matlab using serial communication, so I can just skip that step. What I need to figure out is whether I want my device to shoot out water, or to shoot nerf darts. This is going to be a fun project! I’ll see you guys later!

Leave a comment

Projects: Pygames Controller Final Update


Well, I head back to RPI next Sunday. I finally can say I finally finished building the prototype of my Pygames Controller and successfully completed the “before I go back to RPI” requirement. The only thing I wished I could of adding for the project is a decoupling capacitor for each button. Otherwise, I am very proud of the prototype. The code for the project can be found at the following URL.  Feel free to post any problems or concerns you have about the code, and I will make sure I add it to the next version of the controller.Now I change the project status to complete on the projects page 😀 In fact, for now on, instead of placing code in these blog posts, I will upload code to Github. Anyway, I see you guys later!

Leave a comment

Projects: Pygames Controller Update #2

So I’ve been busy for the past couple of days for the Pygames Controller project. However, I would say that I’m 90% done with the Pygames controller project. Let me talk about what was been done thus far.


After my last update, I finished writing the C file for the controller. For some reason, serial communication was not working at the time, so I had to test my code using LEDs. When I flick the left joystick to the left, it will turn on the smallest yellow LED on the board. When the right joystick is flicked up, then it will turn on the green LED. Finally, when I pressed down the yellow tactile switch, it will turn on the yellow LED next to the smallest yellow LED.From my LED tests, I had to modify a few things with the button press code, but the c file for the controller is fully functional.


As I said in my last post, I had to revise my original layout of the controller. Instead of having 2 joysticks, four tactile buttons, and two triggers, I had to reduce the parts of the controller to two analog sticks and two tactile buttons. Since I’m testing the controller on a breadboard, I wanted to select a layout that could fit onto the breadboard I current have.


I did some final testing for the controller C code by seeing the states of the joysticks, and buttons using Arduino’s serial window.  Although testing the controller using the serial window severely slowed my computer down while I was watching the latest episode of JoJo’s Bizarre Adventure (which I highly recommend if you love 80’s anime like Fist of the North Star), I was fairly pleased by the results. However, when I work on a future version of the controller, which I’m 95% I will,decoupling capacitors will need to be added at the buttons terminals because when I pressed and release the button, it does not instantly go to an “off” state immediately.  This is a common, but simple, problem that exists when dealing with digital inputs for microcontrollers.

Right now, I’m writing the python class for the controller. I hope I can finish the python class by the end of this week. Afterwards, I will release the python class, c files, default schematic, and documentation on Google code.  One of my friends even agreed to help me test out my controller by creating a small python game designed exclusively for the controller.

Well, that’s all I have for you guys! Again, if you have any concerns or suggestions, feel free to post a comment.