|
13381
|
Forum 2005-2010 (read only) / Interfacing / Re: Variable length input from keypad
|
on: November 13, 2009, 04:42:52 am
|
|
Yes, as Mike shown you have to 'byte bang' it as the Arduino serial port is a single character at a time affair. You as the programmer have to assemble the characters, define and detect a end of entry character. You also have to keep checking the serial data port for when a new user entry might start.
Once you have the basic idea down, it is often useful to write it as a standalone function and then just call the function in you main code when you need to.
Lefty
|
|
|
|
|
13383
|
Forum 2005-2010 (read only) / Interfacing / Re: Problem with Servos and Interrupts
|
on: November 11, 2009, 08:11:24 pm
|
And I still don't understand why calling servo.write() from a timer 2 interrupt handler disturbs PWM if the servo is driven by timer 1? I'd let more experienced software types see if the following could be a possiblity or not. When your timer2 interrupts into it's ISR all other interrupts are disabled until that ISR completes and returns to the main loop. Perhaps you are spending too much time inside the ISR and therefore missing interrupts from timer1. Generally one is recommended to keep ISR routines as simple and short as possible, calling other functions from inside a ISR is not recommended practice. Just test or input for some condition and set a global volatile variable or flag and let the main loop check that variable or flag and do the actual action you require. Lefty
|
|
|
|
|
13384
|
Forum 2005-2010 (read only) / Interfacing / Re: Tactile Switch Terminology
|
on: November 10, 2009, 11:24:34 pm
|
"off-mom". The off-mom is to differentiate it from a two position switch that is off-on as in a toggle switch or slide switch, etc. Off-mom in this case means it's normally non-conducting and will conduct only as long as you hold down the switch (the momentary state). Sounds like what you want. Lefty
|
|
|
|
|
13385
|
Forum 2005-2010 (read only) / Interfacing / Re: DC motor selection?
|
on: November 10, 2009, 12:23:07 pm
|
|
Perhaps if you checked out some mechanical engineering forums or such, they might be able to help. The forming of specifications and then selection of your motor for your application is a mechanical engineering task at it's basis, and might be slim pickings from this forum members skill sets.
Lefty
|
|
|
|
|
13386
|
Forum 2005-2010 (read only) / Interfacing / Re: "rev-matching" box; Arduino Mega?
|
on: November 06, 2009, 11:05:24 am
|
If you could point me out a suitable low pass filter I'll be all set (and leave you guys alone)
That's not quite as easy. The R/C values of the resistor and cap depends on the switching frequency of the PWM signal of 490hz, the input impedance of the the device receiving the signal and how much signal ripple your device can handle. I've used a 5K resistor and a 10MFD cap in series with the cap going to ground and measured pretty clean analog voltage values, but I don't know if that filter value would respond quick enough for your device receiving the signal. You will have to experiment some, unless someone else has a better guess. Lefty
|
|
|
|
|
13388
|
Forum 2005-2010 (read only) / Interfacing / Re: "rev-matching" box; Arduino Mega?
|
on: November 06, 2009, 10:17:20 am
|
Would the two resistors in a series not put strain on the 12v pulses? That depends on the output impedance of the device generating the speed pulse. The higher the ohms of the resistors the less load it places on the signal. I suspect anything at or above 10k ohms would be OK. The signal is going to a digital input that doesn't require a perfect voltage, just above the switching threshold of the digital input, around 2.5v I think. It's not a analog measurement, just a on or off digital pulse with the pulse frequency being relative to the RPMs. Lefty
|
|
|
|
|
13389
|
Forum 2005-2010 (read only) / Interfacing / Re: "rev-matching" box; Arduino Mega?
|
on: November 06, 2009, 09:30:06 am
|
|
So I should use two resistors to lower the 12v pulses down to 5v?
Yes two series resistors wired from the signal to be converted to ground and then the voltage measured at the junction of the two resistors and ground would be wired to the Arduino. Example, two equal 10k ohm resistors would divide a 12v level to 6 volt, still too high to wire to the Arduino max is +5vdc. You could also just use a 10k ohm potentiometer with the the signal to one fixed terminal, ground to the other fixed terminal and the wiper terminal adjusted and wired to the Arduino digital input terminal.
Then use a low pass filter for pwm output back to the throttle position inputs of the ecu?
Probably, a simple low pass filter is just a resistor and cap wired in series to ground and the filtered signal available at the junction of the resistor and cap.
Lefty
|
|
|
|
|
13390
|
Forum 2005-2010 (read only) / Interfacing / Re: "rev-matching" box; Arduino Mega?
|
on: November 06, 2009, 08:28:41 am
|
would a 5v Voltage Regulator (LM7805) work to lower the voltage for the rpm and speed, or would it overheat/not regulate fast enough being pulsed? Would a pwm + capacitor react too slow as well? Would a digital potentiometer be quicker?
A regulator has much too much minimum input current requirement for use as a signal processor, speed issues also. PWM output conditioning is a separate issue, you first need to know the input signal requirements for where the signal is being wired to. Digital pot would work, with additional parts, but much too complicated for the simple task of lowering signal voltages to 0-5vdc range. Just two resistors make a simple voltage divider that would work fine. Or use a comparator op amp. Lefty
|
|
|
|
|
13392
|
Forum 2005-2010 (read only) / Interfacing / Re: "rev-matching" box; Arduino Mega?
|
on: November 05, 2009, 05:33:01 pm
|
|
Sounds like a reasonable project for a Arduino. The I/O count you listed might even be met with a 328 board rather then the more expensive Mega1280. However you may end wanting to use more user interrupts then 2, so the Mega is probably a safer choice upfront even if you don't end up needing the extra I/O and memory.
Most of those switch inputs and your stated speed pulses will might end up being 0/12vdc (you stated the speed pulses were 0/12vdc) so you will need some small amount of external components to make sure all input signals are 0/5vdc, via voltage divider resistors or zener clamping diodes, etc.
Be sure you understand what a PWM output signal is, it's not a pure analog 0-5vdc output voltage unless you do some external low pass filtering on the PWM signal. So you will need to know what the receiving devices is expecting of your analog output signals.
Good luck on the project
Lefty
|
|
|
|
|
13394
|
Forum 2005-2010 (read only) / Interfacing / Re: Basic question about encoders
|
on: November 09, 2009, 11:20:39 am
|
why do you say that's an optical encoder? That's the one and the firm I bought it from. It is indeed a optical encoder, has four wires, ground, +5vdc, channel A & B. At the time was able to find a data sheet on the web searching on "Oak/Grigsby(91Q128-43-0011)" or some part of that. It's really a nice unit with a great smooth feel, quality part. I just ordered two more, can't pass up a deal.  EDIT: here is the link, I found it again: http://www.electro-nc.com/oak/p0104.pdfHere is a Mouser catalog page showing similar (series 90 Vs 91) for $51 each: http://www.mouser.com/catalog/catalogUSD/640/1596.pdf Lefty
|
|
|
|
|
13395
|
Forum 2005-2010 (read only) / Interfacing / Re: Basic question about encoders
|
on: November 09, 2009, 02:55:56 am
|
Most all of these simple mechanical switch encoders are of the incremental type. Here is one typical one: http://www.sparkfun.com/commerce/product_info.php?products_id=9117I played with one for awhile but was not too pleased with it for the following reasons: 1. Pretty bad contact bounce that has to be dealt with either in software or external components. It limits how fast you can turn the knob also without missing steps, etc. 2. Most have a mechanical detent that makes a clicking sound as you turn the knob. Lots of times it seemed that the mechanical detent steps didn't line up well with the electrical phasing, it just didn't feel precise in it's mechanical detents Vs electrical steps. I eventually found a surplus optical rotary encoders for a real bargain price, they sell for $50 new. These are really precise and feel great and no cheap clicking sound. Sometimes E-bay has some good deals on surplus optical encoders, but it is hit and miss. Anyway whatever you get you just have to play around some with it and the code to get a good understanding. They are cool and make a great user interface. Some have a extra switch on the knob (and extra contacts) that you can press in, so it's like spin to select menu item, press knob in to select item, cool. Good luck Lefty
|
|
|
|
|