PWM output

I have an accelerometer hooked up to a lilypad, using pins 12 and 11 for power. 12 is used for + and 11 for -… The datasheet for the accelerometer says that it should run at +3v, rather than +5v. Although the accelerometer works fine, the datasheet also mentions that at higher voltages, the accelerometer is more sensitive, which is what I do not want at all. Can I thus use 11 (-) as a pwm, and analogwrite about 300 to it? would that decrease the voltage supplied to the accelerometer to about 3v or would that damage it/not allow it to work at all?

Honestly - I’d just take 3 diodes in series to drop your 5 down to the 3V level.

This is mounted on a glove, so I can’t do any hardware modifications, which is why I’m asking about the PWM pulsing

If you have a lead that you’re connecting to a pin on your Arduino, surely you can insert diodes between it and your glove?

I think your misunderstanding… the arduino (lilypad) and the accelerometer are all on the glove, and are connected by conductive thread… so there isnt really anywhere that i can connect diodes to… which is, like i said before, why I ask about the software fix instead

I think that switching an accelerometer on and off a few hundred times a second is a bad idea.

My Apologies, I did not realize the Lilypad was being used.

I’m not sure how a person could go about this without additional circuitry.

you think it’ll break if I try it?

Sorry for the double post, I was just thinking - PWM’s dont truly create box forms (on, off, on, off), instead they produce waves, correct? (the voltage doesn’t drop instantly, it goes down over a period of time, even if the period of time is quite small, and same for voltage going up) so wouldn’t pulsing at 300 (analogWrite(Pin, 300)); give a slightly elevated voltage above ground, on average speaking?

No, a PWM is a square wave at a fixed frequency with a variable duty cycle. It is a digital TTL output signal, either all on or all off at any given time with sharp rise and fall times.

Lefty

Guess I had it wrong, thanks for the clear up.

The lilypad page http://arduino.cc/en/Main/ArduinoBoardLilyPad says it works with an input voltage of 2.7V - 5.5V. Does this mean that if your input source is only 3V that it will run at 3V? If so, you can try that instead of PWM. If the lilypad changes 3V to 5V, let me know that too.

Good luck!

If anybody wants to see the project I believe Jezuz is talking about, he posted this link under another topic

http://bxsciborgs.com/rus.tech.studio/mypics/DSCN1155.JPG
(Note: it’s a 2.3 MB picture)

I assume the battery is connected to the lilypad with conductive thread - which I’ve never used and don’t know much about. But can’t you simply break that thread, and sew in the diodes talked about earlier?

Yes, If you only feed 3V in it will run and outputs will only be 3V.

Just not sure how it would affect the clock in the Lilypad, IIRC they use internal?

I’m not sure how I could go about soldering diodes to thread like that, so that’s basically out of the picture. As for dropping voltage, I can’t quite do that either, the last thing I want to do is mess with the hardware setup already on there (the power source I have always spits out +5v, so there is no way to change it unless I swap it out for a different battery holster). My only solution is a little software work that will smooth out the values and thus drop the unwanted sensitivity of the accelerometer to a level I need.

If anybody wants to see the project I believe Jezuz is talking about, he posted this link under another topic

http://bxsciborgs.com/rus.tech.studio/mypics/DSCN1155.JPG

ok, thanks for the picture - I think that’s a lilypad accelerometer toward the knuckles. That already has a diode (LED actually) to drop the voltage.

Although the accelerometer works fine, the datasheet also mentions that at higher voltages, the accelerometer is more sensitive, which is what I do not want at all.

I don’t think you should worry about sensitivity. the x, y, and z readings are coming in as 10 bit numbers - you can just scale or translate them however you need to.

If you look at the graphs (can’t find them, so imagine ;)), the values like to jump randomly sometimes, like from 410 to 460 then back down to 412, while moving very little (i mean, tilting). The spec. sheet says this is the result of excess voltage (or so i understood). But like I said, a little codework will do it, it won’t be as simple as using the map function, but it’s in the ballpark of an extra 10-line function written in and called upon now and then to keep the values in check.

Is it a lilypad accelerometer with a LED on it attached to a lilypad processor? If so it’s not getting excess voltage and it should be perfectly happy.

Do you see the joggles on all three axes? Do they happen when it’s sitting still? I would check the power and signal connections for starters. If it’s real data you’ll have to filter it in software I guess.

I have a lilypad accelerometer here but it’s not hooked up right now. As I recall the data was pretty clean and I was not filtering it. I did have code that reacted to large changes by moving only 25% toward the new value but I think that was mote to do with handling quick movements gracefully.

Only two axis used, but unlike yours, I really do get awkwardly out of place numbers when tilting it back and forth slowly. I dont want those numbers, because they’ll be directly mapped to values controlling a motor’s speed - which is why small stutters wont make the motor happy (depending on the refresh rate, but even still, I dont want to be sending values that tell the motor to go half speed when it should be going full speed, even if for only a 20th of a second or so.

you might want to dig into this thread which is about filtering accelerometer-type outputs. http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1248889032