Author Topic: first MSP430 project  (Read 19539 times)

0 Members and 1 Guest are viewing this topic.

Offline KTPTopic starter

  • Frequent Contributor
  • **
  • Posts: 512
first MSP430 project
« on: September 04, 2010, 02:08:47 am »

Ok, I just did a really weak MSP430 first project.  This is a bike 360 degree led strobe for my wife's recumbent tadpole trike.  I used 135 lumen 170 degree smt leds from Digikey (I think they are like 3 or 4 watts each).  I have three in series at the top of the flag pole to give a very full 360 degree visibility.  I just dremeled a little scrap of copper pcb for each one to make a heat sink and a landing for the anode and cathode.

Right now I just have it pulsing at 12V 1 amp, pulse on for 20ms, off for 150ms, on for 20ms, off for 500ms, repeat.

This is pretty good for the battery life.  The MSP430 is so easy to breadboard...just 3.3V and ground, and a 47K pullup on the reset line is all you need to get it off the launchpad board and into your breadboard.

I am driving a OTC 4N36 opto from my junkbox directly with the MSP430 through a 100 ohm resistor and this is driving the gate of a IRF520N (all I had on hand).  Seems to work pretty well, and checking the pulse at the leds with my Rigol shows a fairly good turn on (the turn off is a bit weak, but I am only using a 10K resistor to drain the mosfet gate to ground).  I doubt the IRF520N will get very overworked only being on for 40mS every 690mS.

I attached a video, but at 30fps you can't really see the short double pulse...in real life it is almost too bright to look at.


« Last Edit: September 04, 2010, 02:51:55 am by KTP »
 

Offline TopherTheME

  • Regular Contributor
  • *
  • Posts: 196
Re: first MSP430 project
« Reply #1 on: September 04, 2010, 03:30:43 am »
Wow, seizure city. Nicely done. Are you using IAR or CC for programming?
Don't blame me. I'm the mechanical engineer.
 

Offline DJPhil

  • Frequent Contributor
  • **
  • Posts: 511
  • Country: 00
Re: first MSP430 project
« Reply #2 on: September 04, 2010, 10:19:33 am »
recumbent tadpole trike

I had to look that bit up, then I went, "Oh, that's what they're called!" :D

It's good to hear that the chip's well behaved in a breadboard, that's a relief!
I'm curious as well which IDE you went with. I'll be fumbling through my baby steps with one or the other in a couple of weeks or so, and I've still got to sort out the differences. That, and learn to program I guess. :)

Well done.  8)
 

Offline KTPTopic starter

  • Frequent Contributor
  • **
  • Posts: 512
Re: first MSP430 project
« Reply #3 on: September 04, 2010, 03:19:08 pm »
Hey thanks.

I used CC, which is extremely bloated for what I need (the simple c program compiling/assembling/debugging of the MSP430) but it seemed to work better than IAR.

Seriously...1GB download to program a 2K part...

 

Offline KTPTopic starter

  • Frequent Contributor
  • **
  • Posts: 512
Re: first MSP430 project
« Reply #4 on: September 04, 2010, 04:39:41 pm »
Well my wife actually thinks it is too bright at night!   We took the circuit outside to view it 360 degrees and at a distance, and a short time later a neighbor came out to see if there was a police car or ambulance at our house  ;D

I think I will add a pushbutton that selects 25%, 50%, and 100% brightness by implementing PWM of the LEDs during the 20mS pulse.

The question now becomes do I need to implement a better driver for the gate of the IRF520N in order to actually fully turn on and off the mosfet during these faster PWM switching events...

Maybe I could have the opto drive a small pnp and npn transistor in a push/pull configuration which charges and discharges the gate capacitance equally?  Right now as mentioned, the emitter of the opto is dumping current directly into the gate (no idea how much, but it would depend on the amount of light hitting the base of the opto transistor and the gain of said transistor...probably 50 to 100mA going into the gate as a guess...) but the gate is only turned off by being discharged through a 10K resistor (totally lame, I know).

Isn't it always funny how such a simple thing snowballs into something more complicated?  :)
 

Offline KTPTopic starter

  • Frequent Contributor
  • **
  • Posts: 512
Re: first MSP430 project
« Reply #5 on: September 05, 2010, 04:45:17 pm »
Ok, I added a npn and pnp transistor in a push pull configuration driving the gate of the mosfet.  I implemented a power modulation scheme for the LED drive by PWM'ing the 20ms pulses at 10khz.  I am now seeing a rise/fall time of under 5uS for the gate of the mosfet, which is not too bad for the power levels and frequencies I am using.

I also added a momentary contact pushbutton input to the MSP430 to select the different power levels.  As a bonus, I also use this switch to drive the base of a pnp transistor which in turn drives the gate of a P channel mosfet whose source is connected to the battery voltage and drain is connected to the input of the 3.3V regulator for the MSP430.  I have a line from the MSP430 connected to the base of an npn transistor whose collector is connected to the base of the above pnp and emitter connected to ground.  The momentary switch grounds the base of the pnp when pressed, causing the p fet to conduct, powering up the 3.3V regulator and the MSP430.  The first line of the MSP430 c code brings the output line high which is driving the base of the npn, which pulls the base of the pnp to near ground, keeping the p fet on.  After a set time (2 hours right now), the MSP430 releases this line, turning the system off.  

so what started as a blinky led, now has 4 transistors, 2 big mosfets, and an opto isollator :-) all desoldered from scrap circuit boards.
 

Offline TheDirty

  • Frequent Contributor
  • **
  • Posts: 440
  • Country: ca
Re: first MSP430 project
« Reply #6 on: September 13, 2010, 06:50:10 pm »
Hey thanks.

I used CC, which is extremely bloated for what I need (the simple c program compiling/assembling/debugging of the MSP430) but it seemed to work better than IAR.

Seriously...1GB download to program a 2K part...

They used to offer the Core version which was just for MSP430, but it looks like they still offer something similar.  The code size limited download of CCS for MSP430 is on the CCS download page and is only 360MB.  That's certainly not bad considering it's a full development environment including IDE and debugger.

I just made up a frequency adjuster with the F2001 for changing motorcycle gauge clusters and yes, it's certainly easy to use and it's nice to be able to solder on a chip without any extra passives other than the pullup and a decoupling capacitor.
Mark Higgins
 

Offline FreeThinker

  • Frequent Contributor
  • **
  • Posts: 791
  • Country: england
  • Truth through Thought
Re: first MSP430 project
« Reply #7 on: September 29, 2010, 03:34:04 pm »
Not had a lot of luck with mine.
C.C. is very confusing and complex compared with pickit 2.The documentation is poor and the wiki is horrible.Spent 3 days (off and on) trying to get the demo board to communicate only to find that an updated file fixing the known problem was available.Add to this the fact it took over two months to deliver and my  enthusiasm is wearing very thin.TI need to sharpen up it's support and refocus it's product if it wants to break into the hobby market (which is were I firmly place myself).Just as an aside, when running the Demo temp prog mine glows red as it gets hotter and green as it gets colder WRT the set point, Opposite to the Demo vid.Anyone else's unit like this? Another example of the confusing messages sent out by TI.
Machines were mice and Men were lions once upon a time, but now that it's the opposite it's twice upon a time.
MOONDOG
 

Offline KTPTopic starter

  • Frequent Contributor
  • **
  • Posts: 512
Re: first MSP430 project
« Reply #8 on: September 29, 2010, 04:05:51 pm »
Well, I am not as enthusiastic about the parts as I first was, mostly because of the lack of sufficient timers and timer compares.  Except on the much larger parts, all you get is one 16 bit timer with 2 or 3 compares.
 

Offline FreeThinker

  • Frequent Contributor
  • **
  • Posts: 791
  • Country: england
  • Truth through Thought
Re: first MSP430 project
« Reply #9 on: September 29, 2010, 06:32:05 pm »
Yeh! Just got the "Flash both leds" working! The fog is lifting, documentation still sucks though.Went on to modify it to flash independently....I'm on a roll :D
Machines were mice and Men were lions once upon a time, but now that it's the opposite it's twice upon a time.
MOONDOG
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19998
  • Country: gb
  • 0999
Re: first MSP430 project
« Reply #10 on: September 29, 2010, 06:36:07 pm »
Looks good but isn't it a bit overkill?

I looked at the price on RS Components and they're four times as expensive as a basic PIC which is capable of the same thing, still I suppose if it gives you a feel for the MCU then it's worth it. I'll probably find myself doing mundane things with complex MCUs when I've learned enough about the 12F5xx and 16F5xx.
 

Offline TheDirty

  • Frequent Contributor
  • **
  • Posts: 440
  • Country: ca
Re: first MSP430 project
« Reply #11 on: September 29, 2010, 07:14:00 pm »
It's a very low power operating chip.  Much of the hardware is built around that.  You people who think it's some kind of upgrade or sidestep from a PIC or AVR need to think again.  Functionality can be pretty basic on the smaller parts.  Really, unless you are working on battery powered or low powered applications there's really little advantage.  I find CCSv4 to be very easy to work with.  I can't get used to the debug shortcut keys, though.

If you are struggling with the programming there is a very good book called MSP430 Microcontroller Basics out there.  I hate to say it, but the PDF can be downloaded all over the place.

This isn't the final design, but this is the tach adjuster I made up with an MSP430F2001.  Yes, I could have used any 8bit and I only used the MSP430 because I had a few from a battery powered RF project.  The F2001 is only $0.67 ($1.5 each for those of us who can't buy 2000 at a time) in bulk so it certainly doesn't break the bank.  

EDIT:  Oh yeah, the TI code examples are pretty good as well.  There's small examples of using a lot of the hardware blocks within the MSP430.
http://focus.ti.com/mcu/docs/mcuflashtools.tsp?sectionId=95&tabId=1538&familyId=342
« Last Edit: September 29, 2010, 07:17:11 pm by TheDirty »
Mark Higgins
 

Offline Time

  • Frequent Contributor
  • **
  • Posts: 725
  • Country: us
Re: first MSP430 project
« Reply #12 on: September 29, 2010, 07:56:24 pm »
Texas Instruments recruits heavily from the university I went to and has a program that funnels grad students into their company.  We basically got whatever we wanted from TI for free.  So naturally, I probably have a plethora of free parts from them - a good amount which are MSP430F135s (16KB+256B Flash Memory, 512B RAM).  Which is massive overkill for practically everything I dream of doing.
-Time
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19998
  • Country: gb
  • 0999
Re: first MSP430 project
« Reply #13 on: September 29, 2010, 08:27:23 pm »
 I hate to say it, but the PDF can be downloaded all over the place.

Yes, I looked at it but as you probably now know, I'm pretty ignorant about many aspects of microcontrollers, which is why I asked the question.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf