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.

wpid-20131229_145125.jpg

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

wpid-20131207_164254.jpg

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.

310px-H_bridge.svg

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

pic5

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 ThinkGeek.com. Here’s what I found from my dissection from this rocket turret.

pic6

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.

pic4

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.

pic2

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.

pic1

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

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.
matlab_logo
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.
8a0f_usb_rocket_launcher
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.
09950-01
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.


7 Comments

Projects: Face Tracking Turrent

facetracking_overview
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

pygamescontroller

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.

20130101_121929

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.

406599_4456933653728_1151303803_n

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.

debug_results

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.


Leave a comment

Projects: N64 Controller Now Pygames Controller

481580_4367919388427_284505977_n

So yesterday, I started testing the Python script to generate the keyboard board events that the emulator could recognize. The way the script works is that whenever I pressed the tact switch connected to the PIC8F4553 microcontroller, it sends a simple c character to the python script. When the python script sees the c character, it will then generate a keyboard event which the x key (A button on the N64 emulator) is pressed.

When I tested the script, it works in Windows perfectly. Heck, I could create a virtual keyboard and mouse for windows based for a couple test scripts alone (future project?). However, whenever I run the script, then run the emulator, the emulator ignores the keyboard events generated. To be fair, it recognizes it sometimes when I click the Python IDE then switch to the emulator window. I sent an email the Project64 creator, posted on the Stackoverflow forums, but it seems like no one knows why the emulator is ignoring the keyboard events.  However, I realized that I will shift the project focus from a controller designed for emulators, to a controller that can be used for Pygames.

By changing the project focus to Pygames, I know for a fact I can finish the project before January 21st as well making this a RCOS project for next semester. Not to mention I still use the parts I ordered a couple days ago. What I’m going to do is get an idea of functions that will allow Pygame developers to expand their games and extra parts I will need. One of the extra parts I will need an accelerometer to add motion controls. I’ll reveal the list of controller functions later on this week.


1 Comment

Projects: N64 Emulator Controller Update #2

partsorder

Yesterday, I just placed the order from Sparkfun for the prototype of the controller. The prototype will be implemented on a breadboard first before progressing any further. As you guys can tell from the shopping cart, I brought 12 tact switches with a nice round top on each one, left and right bumpers, and two analog sticks. One analog stick will be for the analog stick on the N64 and the other analog stick will be for the C buttons. The reason why I’m mapping the C buttons to an analog stick is because I figured I could create a controller similar to a PS3 or 360 controller, which feels natural to me. I have no idea how long it will take the order to get here in Philadelphia, but my guess is next week before Christmas.

Anyway, I started to mess around with the serial library for Python. Using the library was much more simpler than I thought as there are plenty of documentation on how to use the library. To understand how the library works, I wrote a simple little code in python that not only sends the letter c to the PIC microcontroller, but waits up to 1 seconds for the PIC microcontroller to send “hello” to it. Originally, I wanted to paste the code to this paste, however, the code editor for wordpress is really poor and will mess up the coding syntax of Python. The way the code works is that whenever I’m prompted to enter a character, it will either exit the program, or transmit the letter ‘c’ to the PIC18F4553 microcontroller. When the microcontroller pick up the c, it will transmit “hello” to the computer.

pythonpic

It seems like there are some timing issues since I get a weird character after the first transmission. I’m going to look into how to resolve this issue until the parts come in. I will also learn how the keyboard event generator will work in Python.


2 Comments

Projects: Open Source N64 Emulator Controller #1

So, here I am again. I am going to relax after having another brutal semester at RPI. However, next semester will be one of the toughest semesters I ever had. Although I’m only taking 12-15 credits next semester, I will be working at 5 different jobs. The first job is a part time job at TV Ferret redesigning their sewage inspection systems. The second job is working as a lab TA for the Mercer Lab at RPI. Another job will be working at RPI’s Advising Learning and Assistance Center as a tutor for introduction for Electronics and Electric Circuits. The final two jobs will be working at two research centers, but I doubt I will get both of them. Add in my senior design project, and you get a very stressful semester. So I figured going to have to work on a semi big project before going back to RPI. What’s the project I’m working on? A controller for an N64 Emulator.

oot

Recently I started to get into video game emulators, more specifically the Project64. Lately, I’ve been playing The Legend of Zelda; Ocarina of  Time on the emulator. The biggest problem, which I’m sure a lot of people who played emulators have encountered, is the controls. Controlling your characters using a keyboard is not humanly possible. I want to make playing on the N64 emulator as easy as pie. I envision myself, picking the device, and playing a rousing game of Super Mario 64 without attempting to throw my laptop out of the window.

To make the project more interesting, I will set up a deadline for myself. I want to at least finish the prototype before January 21st, or before I go back to RPI. Whether the final prototype will be built on a breadboard or a pcb is up in the air. If I finished the project before January 21st, I will make it into a project for RPI RCOS, which focuses on open source projects,  next semester.  In other words, expect more posts to come from me December 17th until January 20th….as long as the world does not end by that time. So, the question you guys might be wondering how am I going to accomplish this?

PIC18F4553-pinout

So obviously I’m going to use a microcontroller for this project, but it will be a very different microcontroller than the microcontrollers I used in the past. Instead, I will be using Microchip’s PIC18 series microcontrollers. Why? Simple, my dear Watson. I spent one semester using nothing but PIC18 microcontrollers for my research at RPI’s Center for Automation Technologies and Systems.

Slide1

So the picture above shows the overall system I will be working with for the project. Here’s how it will work. I will have the PIC18F4553 microcontroller to read in the state of the buttons on the controller. Afterwards, it will tell a python serial communication script which button is pressed. Once the serial communication script receives the data from the microcontroller, then it will tell another python script to generate the appropriate keyboard events, which will be automatically seen by the emulator.Depending on the progress of the project, I will create a gui interface for the device. The gui will have an on/off button, and an option to determine the COM port the driver should look at. Again, I will give more details as time progresses. It’s going to be a fun 35 days!