Monday, 27 May 2013

Building an RC Car Update 5/27

Hey all,

There are many updates! I have been working on the revised motor controller circuit board for weeks now. If you remember, I shared the screenshots and rendering of the original motor controller PCB a few weeks back. However later on, I decided to integrate the C2000 Launchpad, all the pin outs for external components and the motor controller on the same circuit board. So I have been working on this revision and here it is! The following pictures are OSHPark renderings along with 3-D image renderings. Let me know what you think! OSHPark quotes me $60 for 3 of these boards but it looks like I can get 5 of these boards for about $20 from Seeed Studio.



3-D Renderings of the Board. Notice the two sets of double headers where the Launchpad will sit on. 




OSHPark Renderings of the board.

Before I send it out to the fab, I still need to do a few more proof of concepts. First of all, I am still waiting on the breakout boards I made and ordered for the CC1101 Wireless modules. I figured out how SPI works on the C2000 and got it running on SYS/BIOS talking with my Aardvark SPI/I2C Monitor. Now all I need to do (once I receive my breakout boards) is get those wireless modules working! I have been reading the datasheet and I have a rough idea of what I need to do so we will see how it goes.

Major Addition:
I was talking to my dad about this project and he came up with a great idea! He suggested that I add a proximity sensor on the car to avoid collisions. I thought that was a great idea and found this SHARP IR Proximity Sensor. Basically it is an IR emitter and detector coupled in one package that spits out analog voltage between 0-5 V. I will pass that analog output through a voltage divider network to make sure it doesn't exceed 3.3 V going into the ADC of the C2000 Launchpad. So I will place this sensor on the nose of the car where the front bumper is and it will automatically brake the rear wheels if it senses an obstacle that is less than 5~7 inches away. Here is a picture of the sensor:
Sharp IR Sensor capable of sensing obstacles up to 80 cm away.

With the fast motor I am eventually planning on putting on the car, it is a good idea to have this sensor to "preserve" the car. I am really excited about this and I have already compensated for the sensor connections on the main circuit board that I shared above. Thanks for reading and please let me know what you think!

Edit: I just noticed the 3-D renderings differ slightly from the OSHPark renderings. The OSHPark renderings depict the most recent state of the circuit.

Saturday, 18 May 2013

RC Car Updates 5/17

Hello!

I have a video for you guys today. In the video below, I demo the motor controller prototype for you guys. I have temporarily relocated to California and I couldn't bring the RC Car frame with me here. The frame has the main DC motor on it, and I haven't been able to take it off, so to bring the motor, I would have to bring the whole frame which is way too big. As a result, you will see in the video that I don't have a motor to connect to the motor controller. I did manage to PWM the motor using the C2000 LP before I left for California, so that does work. I am using a pair of LEDs connected in parallel with opposite polarity to prove that current does run in both directions. Sorry for the lame demo, motor spinning would definitely be cooler than a pair of LEDs blinking.


On the other hand, I am going to start working on cracking the RF transcievers I have. As I mentioned earlier, the RF modules came with 0.05" pitch header connectors which are useless, so I had to build a PCB using Eagle to make a simple RF Module Breakout board. Renderings shown below. I actually just ordered these boards from OshPark an hour ago. I am very excited since these are the first ever boards I have ordered! For three of these boards, I paid only $5, so that is a good deal. For my next PCB, I want to try out Seeed Studio. The next board I will build will be quite large since it will incorporate the motor controller, headers for the C2000 Launchpad to sit on, and other pins to connect the external peripherals (Servo, LEDs...). I reckon if I use OSHPark to get that PCB done, it would cost about $40-$50 which is a lot. Seeed studio is much much more reasonable and I got this tip from a colleague at work (shout out to Stephen!)

 OshPark PCB Top rendering.

 OshPark PCB Bottom rendering.

I have an Aardvark SPI/I2C Bus monitor with me here, and for initial protocol testing I will be using it. Later after I figure out how the communication carries out, I will start working on the drivers for the C2000 LP. The protocol is SPI and I am not worried much about that, what worries me is the abundance of registers in the RF Modules and the 100-page datasheet. So I will need to figure out how I need to set up the internal registers in the RF modules (set one as a receiver and the other as a transmitter and tune them to correct channels, set up error connection, etc.....) The advantage of Aardvark is that I will be able to send commands to the RF Module over SPI from my computer. Therefore, I will be able to see all the communication taking place on my computer in a terminal which makes debugging much easier. I will keep you updated.

-Anil

Tuesday, 14 May 2013

RC Car Updates 5/14

Here are some more updates on the project. In my last update post, I pointed out that I was waiting on one last part to complete the prototype. I was actually waiting on some 2-to-4 decoders and I received them almost 2 weeks ago. As soon as they arrived, I popped one on the breadboard and constructed the circuit that I shared as a design drawing 2 posts ago. I was so surprised but it "just" worked!! I didn't have to tinker with it or anything, I just went by the design and it worked. I actually started on the software also, I will talk more about that later on. But I connected up the motor to it, and connected the two motor controller input pins to my microcontroller and applied a PWM signal, and it worked!!

More about the microcontroller side of the project: This is the first project that I am building that is using TI's C2000 Launchpad Microcontroller. This launchpad, which I believe is the second Launchpad that TI released, uses the C2000-F28027 Piccolo Microcontroller. It runs at 60 MHz, and it is capable of UART, I2C, SPI... On top of that, it has many other useful peripherals such as a EPWM peripheral. This is one of the 2 reasons I chose to use the C2000 Launchpad in my project. The other reason is that it natively supports TI's RTOS which they call SYS/BIOS. This is a real-time operating system and it is not too bad to use. I actually have some experience with it because I used a much more powerful C2000 working for Buckeye Current and we implemented SYS/BIOS on our motorcycle.

Since TI seems to have increased their prices for the MSP430 Launchpad, for another $8 ($18 in total) you can get the C2000 Launchpad and it very very capable. MSP430G2553 runs at 16-20 MHz tops and the C2000 Piccolo runs at 60 MHz! The only down side, I would say, is when you are done with experimenting and prototyping, you can't just take out the Piccolo microcontroller from your Launchpad and place it on a Perf Board, or a breadboard. The packaging doesn't allow that, and the Piccolo is soldered on the board, whereas the MSP430 comes in DIP packaging which you can pry out and use on an external circuit (like I did in my Car Trip Computer Project).

Last thing, the PCB layout I shared 2 posts ago has been put off for now. Instead of making a separate board just for the motor controller, I decided to make one big board that will house the motor controller, the C2000 LP (sort of like a "BoosterPack" where LP will plug onto the board), and the RF module. Speaking of which, I do have the RF Modules! I got a pair of surprisingly little RF modules that broadcast at 433 MHz. They use the TI CC1101 RF chip and they handle error-checking and all sorts of other things by themselves! Down side, it has 105-page datasheet and nearly 1 billion registers (exaggerating) that I will have to go through :( The other down side is that the boards came with 0.05" pitch headers?!!! I am going to make a breakout board to convert that to the much more standard 0.1" pitch header, so I can breadboard it. Last thing, I will be using SPI to talk to the RF modules.

-Anil

Friday, 26 April 2013

Motor Controller Design Update

So, it took me much less than anticipated to figure out how Eagle works. I was thinking it would take me the whole summer, but it only took 2 days. I downloaded the free version from their website and got cracking right away. I found an awesome tutorial on Youtube that walked me through the basics, and then I got the hang of it.

I did a little research on how I can actually get the PCB manufactured, and it turns out it is not so cheap. As you would expect, the price goes up as the board gets larger. Therefore, I tried to keep my design as minimal as possible. My original plan was to have the "big" MOSFETs (I explained what I meant by big in my last post) laid horizontally so I can use some large copper plates on the board as heat sinks. The MOSFETs I am using come in TO-220 packaging which means you can mount them to heatsinks since they come with a big area of expose metal in the back. Here is a picture of TO-220 packaging (source: Wikipedia).


However, I had to ditch that idea because the boards became too big for me to be able to afford. I am going to use oshpark.com's service to get the board manufactured and they charge $5 per square inch for a 2-layer board. However, they do give you three copies of your board for that price. Anyways, here is a screenshot from Eagle of how the PCB currently looks like. 


I actually really like oshpark's website. It looks really simple and it is very easy to use. To get a quick quote and to get your design verified, all you have to do is upload your Eagle PCB design files. Then they automatically process it online and give pictures of how your board is going to look like when it is printed. My board is going to be 2-layers, and its dimensions are 3.44x1.5 inches. This is going to cost me a tad over $25 for 3 copies. Check out the OSH Park renderings below. 

Board Top
Board Bottom
Top Layer
Bottom Layer
You might spot weird connections on the board. This is only my first time, and it turns out routing wires on 2-layer boards is very tricky. This is probably the design that is going to be manufactured. I go back to the design files every once in a while and try to spot any mistakes. But because the transistors will be vertical rather than horizontal, there won't be any heatsinks on them. This means that I can't pull more than a couple of Amps continuously (hopefully). Trying to pull more than that will cause the transistors to overheat.

Let me know what you guys think!

Anil



Wednesday, 24 April 2013

Update on the RC Car

Hey all,

Don't think that I gave up on the RC car project. I have been extremely busy with school, but I have also been doing my research. Here are the updates, firstly, I ditched the Bluetooth idea for the car. Instead I am going to use a 433 MHz RF transceiver. This will give me a range of at least 500 ft hopefully.
I am also currently in the market for a higher RPM motor. For initial testing, I will stick with the motor that came with the car. Good news is that I am building my own motor controller!



Here is the background info: you can't just drive a motor directly off of a pin on your microcontroller, you will literally blow up that MC if you try that. DC motors require a lot of current, especially when they stall. And for that, you need beefy transistors. In my design I have 8 transistors. 2 of them are p channel MOSFET s and the rest are all n channel MOSFETs. The 2 of the 6 NFETs are what I call "big" which means the motor current runs through them. Similarly, the PFETs are also "big" since they are directly interfaced with the motor. The other 4 "small" NFETs are used to drive the big MOSFETs.


The design is attached to this article. You basically don't want the wrong combination of MOSFETs on simultaneously since you will short your power source. To make sure this never happens, I am adding a logic protection layer. The logic circuitry has one 2-4 decoder, 1 NAND gate and one inverter. I have the logic on the design schematic. Basically, as far as the MCU is concerned, there will only be two wires between the MCU and the motor controller. 0-0 means neutral motor, 1-0 means forwards, 0-1 means backwards and finally 1-1 means motor brake. Motor braking is achieved by shorting the terminals of the motor.



Anyways, I am currently waiting on the last part, which is the decoder. I currently have the circuit partially wired up for testing. I am also attaching a picture of it. I was able to run my motor in both directions successfully. Once I have all the parts and finish testing, I will start to learn how to use Eagle. I want to make a PCB with this circuit on it. Once that is done, this baby will go on the car!


You might ask, why build your own motor controller? Because theoretically, I can pull nearly 20 AMPs (if I had heatsinks) from this circuit and the generic motor controllers out there only provide 1 A continuous current. I am making this car OVERKILL!!! Which means I want 25 million amps of current!

But no, realistically, I am shooting for about 2 amps of current, given that I find a battery that is comfortable with that. Anyways, hope you enjoyed the update.


Anil

Friday, 7 December 2012

Project IP - MSP430 Powered Remote Controlled Car!

Hey All,

I know I haven't been around for a very long time. School did its best to keep me busy and away from the microcontroller world this semester. However, the semester is almost over and I have already started thinking about what kind of projects I will want to work on over the break and presumably next semester before classes start getting difficult again.

Also, I have added a new project on the blog. Well, I say new, but it is actually something I did all the way back in April 2012. I just had a chance to share it. It is called the Multifunctional Bluetooth Temperature Probe. Yeah, yeah, I know it has a cheesy name, but that was the best I could come up with. Still though, you should check it out! You should also watch the video of me explaining how the system works. That is also pretty cheesy, so you might get a laugh or two out of it. Don't blame me, I am not good in front of the camera, I get excited.

Now to the topic, NEW PROJECTS! I have two projects that have been keeping my brain busy past few days!


  • MSP430 Powered Remote Controlled Car!
I have already started gathering the parts I will need for this project! First of all, I need an RC car. You might ask, why are you buying an RC car to build an RC car? Well, the answer is my brains only works for electrical stuff, not much for mechanical. An RC car has all the gears and other small parts needed to turn and spin the wheels. That is the kind of stuff I wouldn't be able to take care of on my own. The reason why I want to this project is that I have never worked on a "robotics" project before. And this project involves a sort of motor controlling application, so I figured I would challenge myself!

Better yet, I might even upgrade the motor that will come with the RC car. I had one big criteria for the RC car when I was online looking for it, I wanted the biggest RC car that I could find (and I could afford). I figured it would be pointless to buy a fully functioning RC car and then "turning it into" another RC car. So I went on eBay and found this gem at this link. It is 1/10 Scale Ferrari Modena RC Car. Better yet, the mechanics are intact and it even comes with a battery!

Picture of the donor RC Car
Picture of the donor RC Car

In short, here is the plan with this project. Once I get all the parts I need, I will take all of the electronics out of the Ferrari and replace them with my own. The brain will be an MSP430G2553 (most likely) and it will control two motors. One is the main motor that drives the rear wheels, the other is a servo which will control the front wheels. I will also have to build a remote control for this guy, for which I will use an old X-Box controller. The driver will have full control over throttle and steering, which means that the speed of the car will be fully controllable (between 0%-100%). Same goes for steering, wheels will not only fully lock into one direction but will be able to turn to any degree in between (this is where the servo comes in). 

Before I end this post, I just want to say that I have many crazy ideas running through my head. I am thinking about making this system as complicated as possible. For example, I am thinking about adding an LCD screen to the controller which will show me the state of charge on the car, how much current the motors are pulling and how many volts the battery measures...

The Graphical LCD screen mentioned above.

One last note, which may come to you as a surprise, the wireless communication will be via Bluetooth. Yes I know you didn't expect me to choose Bluetooth, it is not like I ever prefer Bluetooth in my projects (sarcasm). But do visit the blog regularly, I am in the process of collecting the materials and once I have them all, I will build this!

Thanks guys,

-Anil


Update: I just won the auction on eBay for that Ferrari RC car!

Saturday, 22 September 2012

Programming the MSP430 using Assembly

Hey everyone,

From those of you who are in Prof. Khan's ECE2560 microcontroller's class, I have been getting a lot of questions on how to load the assembly project examples onto the MSP430 Launchpad. For this tutorial, I will use the Blinky.asm.

To start, go ahead and start up CCS v5. Do note that in order to be able to program the MSP430 Launchpad, you will need to be on the Free Code Size Limited license.

1) To create a new project, go to File>New>CCS Project. Make sure you choose CCS Project and not just Project!

2) Look at the screenshot below and make sure that you make the same selections. Make sure that you have MSP430 selected as your device, and MSP430G2553 as your variant. Also Choose Empty Assembly-only Project as a template. You can name your project as you wish, it does not have to be Blinking_LEDs.


3) I called my project Blinky. The next step is to create a source file into which your code will go. This file can have various formats, it can be a ".c" file, but we want a ".asm" file because we will be using not C, but assembly to program. To do this, find your project under the Project Explorer and make sure its title is in bold. Right click on its name and choose New>Source File. If you are lost, check out the screenshot below. When the New File window comes up, find a name for your source file and make sure to add .asm at the end of it. For example, I chose main.asm as my source file name.



4) Once the new source file is created, the new file will open up in the editor. But you will notice that it is not empty. It puts a couple of lines in the file which include the date and your name. You can see a picture of it below. Delete all of these lines because if you leave them there, your compiler will give you errors. This title would work fine if we were programming in C, but assembly compiler will not be happy.


5) Once you deleted the lines, go to this PDF file  here. You might notice that this is the PDF file on Prof. Khan's website which contains the example code. You will see that the code is copied directly from CCS into the PDF file. You will also see that line numbers are also present. What you can do at this point is copy all of the text and paste it into your new .asm source file on CCS. However, you are not quite done yet because you will need to reformat the whole code in order to be able to compile it. You will see that every line is messed up and the indentations are all wrong. You can try fixing it, but don;t even try because I am nice enough to provide you with this text file which includes the same code, in the correct format. I have done all of the manual labor for you. So all you have to do is open up the .txt file, copy the contents and paste it into your source file on CCS.

6) Once you have that done, all you have to do is debug your code and program your Launchpad. To do this, click on the button that has a bug on it and this button will build, compile and program your code. So it is a pretty useful button, isn't it? If you don't know which button I am talking about, check out the screenshot below.


7) Once CCS finishes programming your MSP430, you will have to command your MSP430 to execute your code in order to see your LEDs blink. To do this, click on the button that looks like a play button. To end your debug session and go back to editing your code, click on the stop button. Here is a screenshot that shows where these buttons are located on the CCS Debug window.



Common Problems
Some of you will inevitably run into problems during debugging. The most common problem will be that you have the wrong license on CCS so you will get a message saying that you cannot program MSP430s with your current license. To fix this, go to Help>Code Composer Studio Licensing Information. Then go to the Upgrade tab and choose Launch License Setup. Once the License Setup Wizard comes up, click on CODE SIZE LIMITED (MSP430) and then click on Finish. Now you should be able to debug your code.

Have questions? Comment below and ask them. I will get back to you.

-Anil