Show Posts
Pages: [1] 2
1  Forum 2005-2010 (read only) / Playground Wiki / Possible addition to Solenoid page on: June 02, 2010, 06:36:33 pm
Hi all,

I'm not sure of the protocol for this wiki so if this is the wrong place to ask this question please let me know.

I've spent most of my career in automotive and aero fuel injection and have a fair amount of expertise in driving solenoids and other e-m actuators at fairly high speed (above 1kHz for some).

Is there any interest in showing ways to extract max performance by reducing opening/closing times?  If so, I'm willing to write it up and can provide some example circuitry with analytical and empirical analysis.  I have tons of schematics/photos/scope traces etc.  Every drive circuit I've ever designed was meant to be triggered with TTL so it's all adaptable to Arduino.

Thanks for any feedback.
2  Forum 2005-2010 (read only) / Syntax & Programs / Re: Advice on reading a nonlinear analog input on: May 21, 2010, 08:54:21 am
Thanks Coding Badly,

I wasn't clear about why I wanted a better fit.  This was my first Arduino project and I went overboard to avoid floating point math.  The truth is that this is a very slow system with plenty of time and memory available.

The data is used for upper and lower bound limits and except for a faulty unit, will never be reached.  I also count the number of complete heating/cooling cycles over a period of time so absolute accuracy is irrelevant for that function.  

The reason for changing is that with all the care I took to get an accurate signal it seems a shame to not report the temperature as accurately as possible.  

Thanks for the idea about scaling.  That will keep my coefficients from being out in the fifth decimal place.
3  Forum 2005-2010 (read only) / Syntax & Programs / Advice on reading a nonlinear analog input on: May 20, 2010, 07:57:57 pm
Hi all.  I made a precision bridge and instrumentation amplifier to read an RTD that's embedded in a product being tested.  The full temperature range output available corresponds to 20-137C.

I predicted about 3 degrees nonlinearity (confirmed in calibration) and decided just to do a linear map like this:

   temp = map (analogRead(tempPin), 0, 1023, 20, 137);

I've changed my mind and would like to account for the parabolic response of my circuit.  I've thought of a couple of ways:

1: Make my temp variable a float and just calculate the temp directly from a curve fit between response temp and the analog input value (0-1023)

2: Break my temperature range into roughly linear segments and do an integer map depending on which range of the analog input it falls in.

3. Keep my temp variable an int but bias my map to reduce the mid range error (would result in about a 1 degree error) like this:

   temp = map (analogRead(tempPin), 0, 1023, 18, 135);

Is there a more elegant way to do what I want?

Thanks for any suggestions.

EDIT:  a 1 degree C error is acceptable
4  Forum 2005-2010 (read only) / Interfacing / Re: Turning log pots to linear values from joystick on: June 09, 2010, 01:46:15 pm
It is a pretty neat idea Richard.  I went the other way on a preamp project.  I had a nice Alps dual linear pot that was really well matched but I wanted a log control for volume control.
5  Forum 2005-2010 (read only) / Interfacing / Re: Turning log pots to linear values from joystick on: June 09, 2010, 11:30:29 am
You can "linearize" a log pot with an additional resistor.  It won't be perfect but may be good enough for what you want to do.  Have a look at page 3 of the link below.

good luck!
6  Forum 2005-2010 (read only) / Interfacing / Re: Trouble with displaying analog values on: June 01, 2010, 11:30:37 pm
When you're printing it just prints at the next cursor position.

You need to set the cursor position if you want the result to appear in the same place on the LCD.

Check out this:

Good luck!
7  Forum 2005-2010 (read only) / Interfacing / Re: Solenoid with Manual Override and Detection on: May 12, 2010, 03:44:21 pm
What you're doing will work BUT:

The voltage across the divider will be higher than 12V when the solenoid is shut off due to back EMF.  It will rise until the diode conducts so if it were my circuit, I'd go with a lower ratio than your 5/12.

If you made R2=33k and R3=10k then you'll be reading 10/43 of the collector voltage, or just under 3 volts when it's off.

When the switch is open and the transistor is off you'll see a high voltage and when either of them is conducting you'll see zero (for the switch) or a very low voltage (for the transistor.)  So if you tested for the pin voltage to be >= 2V for "OFF" and < 2V for "ON" you'd get what you want.

good luck!
8  Forum 2005-2010 (read only) / Interfacing / Re: SERVO HELP!!! on: May 14, 2010, 11:36:52 am
Here's a link to Arduino reference:
9  Forum 2005-2010 (read only) / Interfacing / Re: Relay control to start and run my car on: May 10, 2010, 09:01:56 am

In your circuit, you want the white stripe on the diodes to connect to the battery side of your circuit.

The white stripe shows the cathode end of the diode.  When the diode is conducting (forward) this will be the low voltage connection.

I ran a little simulation of your circuit and if you have the diode accidentally backwards, your transistor has to dissipate about 1.5W.  The absolute max rating, if you have the plastic package, for the 2N2222 is .625W.  If this is the problem you should notice the transistors getting really hot (like over 100C!)
10  Forum 2005-2010 (read only) / Interfacing / Re: Relay control to start and run my car on: May 09, 2010, 09:01:59 pm
The comment about using diodes with a higher PIV rating won't hurt but when the transistor turns off, the high side of the coil is the side connected to the collector of the transistor and the anode of the diode.  

The diode will be in forward conduction back to the battery so PIV is not the important characteristic.  

At the instant of turn-off the diode will allow the voltage at the collector to rise to battery voltage + the diode drop due to the coil back EMF and it will conduct at 83mA, falling to zero once you dissipate the coil energy.  The max continuous forward current rating is 1A for any of the 1n4001-1n4007 so you are safe.

Jackrae's suggestion to check the collector current is a great idea though.  If you have the diodes accidentally reversed then you would have essentially a dead short through the transistor when they were on.  That would smoke them fast!
11  Forum 2005-2010 (read only) / Interfacing / Re: Relay control to start and run my car on: May 07, 2010, 02:38:26 pm

If you assume about a 0.7V drop from base to emitter then your base current should be (5-0.7)/4K7 = 0.9 mA.  If the gain of the transistor is 100 then you should be getting 90mA through the coil which is enough.  In my opinion you don't have a lot of margin to account for variation in hfe and coil resistance.

I would check the voltage from C to E when the transistor is on, just to be sure it's really saturated and acting like a switch.  If I saw something more than say 0.5 volts I'd probably lower the base resistance and try to drive it harder.  Otherwise the transistor is behaving resistively, heating up, and possibly leading to failure.

For reference, I use 2N2222A's as capacitor discharge switches in analog timers and use 1K base resistance driven by 5V with absolutely no problem.  So in my case I have about 4mA base current.

good luck!

12  Forum 2005-2010 (read only) / Interfacing / Re: Relay control to start and run my car on: May 07, 2010, 12:33:06 pm
Hi Milo,

What is the part number of the transistor that you're using?

What is the DC resistance of the relay coils?

Your schematic shows direct connections from the Arduino to the base of the transistors.  Do you have resistors in series with the base?

13  Forum 2005-2010 (read only) / Interfacing / Re: MOSFET problem on: May 15, 2010, 03:54:29 pm
I think you'll want to have the series resistor for the LED to keep the Gate voltage high enough for the IRFL540 to turn on fully.  Otherwise VGS will be limited to the forward drop of the LED and the MOSFET may behave resistively.
14  Forum 2005-2010 (read only) / Interfacing / Re: Can I connect my LM741 Op-Amp like this? on: May 05, 2010, 09:12:05 am

He means an opamp that can produce an output at or very close to the supply rails (i.e. Vdd and Gnd).  The opamp he suggested operates from a single ended supply so you don't have to have positive and negative supply voltages.  You can connect it to a +5V supply and gnd.

TI claims a typical Vout of 3.8V with a 5V supply so if you don't mind sacrificing a little bit of your 0-5V input range it might be easier to implement since you don't have to come up with a +/- supply.

good luck!
15  Forum 2005-2010 (read only) / Interfacing / Re: Oxygen Sensor Question on: May 03, 2010, 03:51:53 pm

If you want to use an opamp I can suggest the AD627 instrumentation opamp.  I used it in an RTD bridge to make a temperature measurement which is read by my Arduino.

The AD627 can be powered from a singled ended 5V supply and can output to the rail voltage (i.e. all the way to zero and 5V).

Gain is super simple.  In fact, for your case, it's perfect.  The gain is 5X if you don't connect anything between pins 1 and 8.

Connect the high side of your O2 sensor to pin 3 and the low side to pin 2.

Connect pin 4 to ground and pin 7 to +5V.  Connect pin 5 to ground (to give you a zero based output) and pin 6 to your Arduino analog pin.  Viola!

I would place a 0.1uF cap between pin 7 and ground to decouple the power supply.  I use ceramics but others may have a different opinion.

It's an instrumentation amp meaning that the output on pin 6 is the gain X the differential between pins 3 and 2.  The advantage of a differential amp is that in a noisy environment where you're likely to pick up signals on your wires, the amp will reject the common mode, meaning you can get a clean signal.  Just make sure that the two wires to your sensor are either a twisted pair or are kept bundled together so they see the same EMI conditions.

Here's the data sheet.

I bought mine at Digikey for less than $8USD.  Make sure you get the package style you want as they come in SMT and DIP versions.

Good luck!

PS:  One thing that I forgot to mention is the bandwidth.  It's got a -3dB rolloff at 80kHz.   I don't know how fast your signal is changing but if it's got a lot of high frequency content that you want to measure you need to consider the filter effect of the opamp.  You mentioned a sampling rate of 100Hz so it's probably not something to worry about.
Pages: [1] 2