Go Down

Topic: Arduino Lightsaber (Read 414858 times) previous topic - next topic

billpealer

anyone get PWM LED fading working from an LED driver?

i cant get it to wrk.

the driver wont allow me to put the MOSFET at the 8.4v source,..  so i have to put it at the 3.4v output.  i can get to set the voltage,.  but not turn off or do any triggering,..

analogWrite(LEDPWM, 255);  equals the full 3.4v

analogWrite(LEDPWM, 220);  equals about full 3.25v

i can't measure a analogWrite 0, because the thing has never shut off.  i have to pull the fet, or a wire.

I noticed Canobi's PCB has 10kohm resistors on the MOSFET section.  My primary mosfet works,..  the one that uses digitalWrite,. and it also uses a common ground with everything else and NO resistor. is that what i am missing?  a common ground for the PWM mosfet?  i am hesitant to mix the 5v arduino ground and the 3.4v power from the Buck Step down driver.

Canobi

The 10k resistors pull the pins to ground when not in use as I've been told they can sometimes float causing miss readings.

JakeSoft

I noticed Canobi's PCB has 10kohm resistors on the MOSFET section.  My primary mosfet works,..  the one that uses digitalWrite,. and it also uses a common ground with everything else and NO resistor. is that what i am missing?  a common ground for the PWM mosfet?  i am hesitant to mix the 5v arduino ground and the 3.4v power from the Buck Step down driver.

As Canobi said, he added pull-down resistors for the MOSFET gates to stop them from floating. This is sort of a standard thing to do. The reason your application works without them is that when you do a digitalWrite(LOW) in code, the Arduino will pull the pin to ground so it's not left floating. So in practice you don't technically need them. I've done it both ways.

billpealer

The 10k resistors pull the pins to ground when not in use as I've been told they can sometimes float causing miss readings.
they are not needed on my 3.7v set up.  have you got a working set up?

have you tried with and with out resistors?

Canobi

I think a good design target is to not make the board any wider than 1". That way it'll fit inside PVC that is commonly used to make lightsabers. The 1" PVC electrical conduit is also commonly used to make sleds and chassis for lightsabers, so fitting inside those would be a boon. 1" will easily fit inside MHS parts which typically have in ID of 1.25".
Not to worry, the board stands at 24.42mm which accommodates many different routing options so there's actually no need to make it any wider.


Cool setup. You're quite handy! I can drill and tap holes and cut things with a rotary tool. That's about the extent of my metal-working skills. (I told you I hate fabricating!)
Necessity is the mother of invention. I got so perplexed with snapped wires during "on the fly" installments that I came to the decision to make my own PCBs to avoid all that crap.

After finding out what was need to put a lab together, I winged the whole lot following any tutorials I could find that were relevent as I've no formal education in engineering, chemistry, or electronics for that matter but if a colourblind dyslexic like myself can do it, anyone can.


This looks pretty good. If you are still including the LP2992 LDO as an SMD component? If so, I'd suggest just routing power from that to the VCC on the arduino for the 3.3V version if you can. The drop out voltage on that part is going to be better than anything you'll get from the on-board regulator on the Arduino, especially some of the clones. In fact, I've had some bad experiences with Arduino Pro Mini 3.3V clones using sub-spec onboard regulators that cut out at 5 volts! That won't fly when you're running a 3.7V battery.
I was going for system voltage flexibility so combinations like 3v mini, 5v WT setups were possible but if the LDOs on the pro mimis are less than reliable I'll take another look at the power rail setup.


I have taken a hard look at the drawing you posted. I have a few comments and suggestions. Do with them what you will. There is really only one error that I noticed, the rest are just ideas for improvement.

1) The mappings for the Busy and VCC (3.3V) pins on the WT588D are each off by one pin. The Busy pin is right next to the VDD pin and the VCC pin is right after that. (VDD, BUSY, VCC, with no skipped pins).
Oops, my bad. Will correct that post haste.

2) You may not need to leave room for the clash sensor. They work best when placed as close to the blade as possible, but people often mount their soundboards close to the pommel. This means that folks will likely run wires from the board up the hilt toward the blade anyway for their clash sensor. It's OK to leave it as is, I'm just pointing out that the space may not be used often. It's an opportunity to make the board smaller, maybe.
I had considered that which is why I put it up front with the accelerometer and made sure the pads were under an open spot so wires could be traces from there easily if necessary. Other than that, it's position is non critical to the boards dims, although I noticed I can still shave off about 4mm from the overall length anyway.

3) If you still plan to include the LP2992 LDO, just run power from that to the VCC pin on the arduino (at least for the 3.3V version) and the VCC pin of the WT588D as well. It makes the entire part a 3.3V device with the option to add an LDO or buck to boost power to the VDD on the WT588D for more performance if desired. Otherwise, just bridge the WT588D's VDD to 3.3v as well and call it a day.
That's pretty much how the power rails work right now, the only difference is that the pro mini rail is unregulated for 3v setups but it wouldn't take much to address that issue.

4) Why not route pins 2, 3, 5, 6, and 9 toward the inside of the board and take pins 7 (Activation Switch) and 8 (Aux Switch) out to the edge of the board? That way nobody has to solder wires for their switches to the middle of the board. I can see that becoming a big pain, especially if there is a PRO-Mini sitting on the other side and you can't thread the wire through to solder it in through-hole fashion after the MCU is mounted. The signals from the other pins never leave the board, so they don't need that premium edge real estate.
Ah, that'll take a lot more to rework than the power rail but the idea with that setup was to solder in the buttons/accent LED/PWM wires first, then mount the modules after as the header pins allow just enough room to trace them out from underneath. But your right, there's no way you'd solder wires in after the module have been mounted and the comms lines should indeed be on the inside. I'll need a couple days for that one.

That's all for my notes. Don't take that laundry list to mean I'm not impressed; I really am. I'm excited and look forward to working out a way to combine your board with my software.
I'll PM you ;)

Canobi

As Canobi said, he added pull-down resistors for the MOSFET gates to stop them from floating. This is sort of a standard thing to do. The reason your application works without them is that when you do a digitalWrite(LOW) in code, the Arduino will pull the pin to ground so it's not left floating. So in practice you don't technically need them. I've done it both ways.
I put the 10k gate resistors on as a precaution but if they're not essential then I'll ditch those as well it'll help to simplify hand soldering.

JakeSoft

#381
Jan 10, 2016, 10:11 pm Last Edit: Jan 10, 2016, 11:52 pm by JakeSoft
I put the 10k gate resistors on as a precaution but if they're not essential then I'll ditch those as well it'll help to simplify hand soldering.
You could leave the traces there then people could choose to put the resistor if they really wanted to. Otherwise, they could put nothing there and it would just be an open circuit.

I'm curious, what software are you using to generate your images? Looking at your layouts has me kind of eager to learn enough to play with my own designs, but I'm not sure where to start. I tried Fritzing, but it's pretty terrible if there is no part library for everything you want to use, and there doesn't appear to be one for WT588D. Adding your own is a big pain too. Yuck.

I have not found a tool that doesn't want you to start with a schematic first. All I want to do is make some simple mapping boards with vias and manual traces, I'm not sure why that's so difficult.

Canobi

Well the resistors are less than pennies each but having tried it, it was a pain to solder them so close to the fet so it would make populating the board quicker and simpler to leave them off.


As to what I use, I design my layouts on my android phone. I found a couple of apps called DriodPCB and PCB design companion, both of which are totally free, totally awesome and have very little to no adds.

Design companion has a ruck of useful calculators needed for working out trace widths and the like while DriodPCB is where all the fun happens as you literally "draw" the circuit using a variety of tools (some of which can't actually be used yet but the devs are working on those).

JakeSoft

Well the resistors are less than pennies each but having tried it, it was a pain to solder them so close to the fet so it would make populating the board quicker and simpler to leave them off.
Yeah, anything you can do to make it easy will make it better IMO. Maybe even a version with all though-hole components. If you use the I-PAK packaged FETs, you can fit them three-wide on a 1 inch board. I personally lack the dexterity to solder SMD components properly. Soldering the pin headers on the Arduino is about as small as I go.

As to what I use, I design my layouts on my android phone. I found a couple of apps called DriodPCB and PCB design companion, both of which are totally free, totally awesome and have very little to no adds.

Design companion has a ruck of useful calculators needed for working out trace widths and the like while DriodPCB is where all the fun happens as you literally "draw" the circuit using a variety of tools (some of which can't actually be used yet but the devs are working on those).
Oh, that sounds cool. I don't have an Android device, but  maybe I could get an emulator and try it out. Too much setup for me to get into right now. I'll let you have all the "fun" in the meantime.

stinky1

#384
Jan 11, 2016, 04:13 am Last Edit: Jan 11, 2016, 04:21 am by stinky1
Found it!!


"Now I needed to power each LED (Red, Green, and Blue) individually. This is what I came up with: Three MOSFETs wired like so: Gate goes to Arduino Nano output. Source goes to ground. Drain goes to LED negative with current limiting resistor for each LED. "



Jake's been holdin out on us!!! >:(

Lol only kidding,  found that post on CSS forums where they said take Arduino elswhere!!  :smiley-mr-green:

The Pertinax MkII is all I need!!!  And that is what this thread is showing how to build.

http://forums.thecustomsabershop.com/showthread.php?16950-Pertinax&s=35f9001cb72b6a1df3147c4f507752fd&highlight=ARDUINO

http://forums.thecustomsabershop.com/showthread.php?15366-Novus-Animus

 I took the dive and ordered all the parts,  guess I still have to figure out the resistors and buy them too.  I understand the smaller brown resistors limiting the voltage for the RGB led's,  but what are the grey resistors doing?  Sorry my newbness drags your guys brilliance down.  :smiley-eek-blue:

JakeSoft

Found it!!


"Now I needed to power each LED (Red, Green, and Blue) individually. This is what I came up with: Three MOSFETs wired like so: Gate goes to Arduino Nano output. Source goes to ground. Drain goes to LED negative with current limiting resistor for each LED. "



Jake's been holdin out on us!!! >:(

Lol only kidding,  found that post on CSS forums where they said take Arduino elswhere!!  :smiley-mr-green:

The Pertinax MkII is all I need!!!  I took the dive and ordered all the parts,  guess I still have to figure out the resistors and buy them too.  I understand the smaller brown resistors limiting the voltage for the RGB led's,  but what are the grey resistors doing?  Sorry my newbness drags your guys brilliance down.  :smiley-eek-blue:
LOL. Now there's a blast from the past. That's from a post about my first ever Arduino saber right there. I used a sound board from a toy on that one because I hadn't learned about WT588D yet! Yeah, the mod over there doesn't like Arduino talk for whatever reason.

The fat blue-gray resistors are actually the ones for the LEDs. The smaller ones were probably pull-down resistors for the gate pins, I think.

JakeSoft

they are not needed on my 3.7v set up.  have you got a working set up?

have you tried with and with out resistors?
Yes, I tried both ways. It works without the resistors.

billpealer

Yes, I tried both ways. It works without the resistors.
I figured.

I was actually asking Canobi?  Or is he just working for you? ;)  he posts a lot of flour and eggs, i was wondering if he had some cake.

i got the bind lock on impact working. .. sort of.


if i orient the sw sensor on a perpendicular axis and wait for a strike,.. it will do it. sometimes.  i used the same code i gave as an example.  it works,..  25% of the time.  so many sensors are trying to step on each other,.  but it works. or has the potential to.

it also got me thinking.  Isn't a clash merely a 1/2 second of lock up, with another half sec of decay?  so, maybe there shouldn't be clash sound.

just swing and lock up.   every clash plays lock up, and it plays till there is a swing to break it up.

i am going to try that out.  it makes too much logical sense.  like adding hum to all the sounds.

stinky1

So then the voltage is controlled through the PWM pins, and the voltage controls in the Arduino programming? With the Mosfets. I'm guessing.   

billpealer

Yes, I tried both ways. It works without the resistors.
try PWM with mosfet with a buck booster?  or just direct off hot DC with resistors or a linear regulator?

from what i understand from buck step/up down,. they push power at a frequency.  they talk about ripple, and what not in their cut sheets. i am now savoy in PWM and arduino and LEDs..  yet if I put a mosfet tween the buck and the LED,..  no dice.  i can use the mosfet tween the v+ and the buck to turn it on and off.  i can use the mosfet with pwm direct to the 3.7v batt with effect.  But not with the buck step down.  grrrrr.  

anyone have a story on that?

Go Up