Show Posts
|
|
Pages: [1] 2 3 4
|
|
2
|
Using Arduino / Motors, Mechanics, and Power / Re: Mosfet and switching regulator
|
on: June 06, 2012, 04:43:58 am
|
|
Thanks for the help. I'm actually running two servo's off the regulator, just trying to keep the schematic simple. It's for a pair of cat ears mounted on a headband. I'll check on the current draw when I get back from work.I'm trying to keep the circuit size small so that all the components can fit inside the ears, otherwise I would just use one mosfet per servo. Besides saving power I was wanting to cut power to the servo's because even when I don't write to them they tend to jitter a little, but that may be my code. I'll take a look at the mcp1702's.
|
|
|
|
|
3
|
Using Arduino / Motors, Mechanics, and Power / Re: Mosfet and switching regulator
|
on: June 05, 2012, 11:13:35 pm
|
 Sorry for the crappy schematic. U2 is the 3.3v regulator, it is attached to the 328p with appropriate filtering caps (I just didn't add them in because I have to head to work in a minute). U1 is the 5v regulator. R1 is a pulldown resistor and R2 is a current limiting resistor. When I set pin 14 Low I'm expecting to cut power to the 5v rail, this is not happening. If I connect the servo ground to the fet drain instead of the regulator ground to the fet drain, then set pin 14 low, the servo will not move even when it is pulsed. That is functioning as I would expect. If I manually disconnect ground from the regulator then the 5v rail loses power as I want. It's just not working when wired as the schematic I've attached. If it won't work this way I'll look into getting some P-channel mosfet's, I don't currently have any. would you recommend something like this http://www.digikey.com/product-detail/en/LP2985IM5-3.3%2FNOPB/LP2985IM5-3.3CT-ND/334984 to replace the 3.3v regulator?
|
|
|
|
|
12
|
Using Arduino / Project Guidance / Re: DTMF decoding with Arduino
|
on: May 27, 2012, 01:57:02 pm
|
Someone may come up some better hints, but something along these lines should help cut the memory usage a lot. If you need any of it explained let me know. #define Q1 4 #define Q2 5 #define Q3 6 #define Q4 7 #define RED 8 // 1st device (RED LED) #define GREEN 9 // 2nd device (GREEN LED) #define std_out 10
void setup() { pinMode(Q1, INPUT); pinMode(Q2, INPUT); pinMode(Q3, INPUT); pinMode(Q4, INPUT); pinMode(std_out, INPUT); pinMode(RED, OUTPUT); pinMode(GREEN, OUTPUT); }
void loop() { byte key; // wait a bit... delay(500); // read inputs key = read_inputs(); if (key == B1000) // if 1st device detected with '1000' (key 1) { while (digitalRead(std_out) == LOW); // wait for next key press delay(100); key = read_inputs(); if (key == B1101) // if '1101' (key *) is pressed... { digitalWrite(RED, HIGH); // turn on 1st device } else if (key == B0011) // if '0011' (key #) is pressed... { digitalWrite(RED, LOW); // turn off 1st device } } else if (key == B0100) // if 2nd device detected with '0100' (key 2) { while (digitalRead(std_out) == LOW); // wait for next key press delay(100); key = read_inputs(); if (key == B1101) // if '1101' (key *) is pressed... { digitalWrite(GREEN, HIGH); // turn on 2nd device } else if (key == B0011) // if '0011' (key #) is pressed... { digitalWrite(GREEN, LOW); // turn off 2nd device } }
}
byte read_inputs(){ byte key = 0; if(digitalRead(Q1)) key &= 1; key <<= 1; if(digitalRead(Q2)) key &= 1; key <<= 1; if(digitalRead(Q3)) key &= 1; key <<= 1; if(digitalRead(Q4)) key &= 1; return key; }
|
|
|
|
|
15
|
Using Arduino / Networking, Protocols, and Devices / Re: MMA7660 will only read the first register
|
on: November 30, 2011, 05:11:08 pm
|
So I read the data sheet a little more carefully and found that the register pointer is reset when it receives a stop condition over I2C. So I tried removing the wire.endTransmission() and adding another Wire.beginTransmission() before I do the Wire.requestFrom(MMA7660_CTRL_ID, 1). It's still resetting the pointer though, any hints? Here's the part from the datasheet: MMA7660FC clears its internal register address pointer to register 0x00 when a STOP condition is detected, so a single byte write has no net effect because the register address given in this first and only byte is replaced by 0x00 at the STOP condition. The internal register address pointer is not, however, cleared on a repeated start condition. Use a single byte write followed by a repeated start to read back data from a register I can get the information if I read all the registers at once and just grab the one I want, but it seems kind of wasteful. Here's the hack I'm using for now: uint8_t MMA7660::read(uint8_t REG_ADDRESS){ Wire.beginTransmission(MMA7660_CTRL_ID); Wire.write(REG_ADDRESS); // register to read Wire.endTransmission(); Wire.requestFrom(MMA7660_CTRL_ID, REG_ADDRESS + 1); // read a byte while(! Wire.available()){ delay(1); } while(Wire.available() > 1){ Wire.read(); } return Wire.read(); }
|
|
|
|
|