Show Posts
Pages: 1 ... 32 33 [34] 35 36 ... 86
496  Using Arduino / Project Guidance / Re: PWM pulsing LED hooked up to DAC and Oscilloscope on: June 05, 2013, 12:19:22 pm
Quote
I want to be able to compare two analog signals, not an analog and digital signal.
I'd suggest an R-C filter to "smooth" the PWM.

Quote
am just wondering if its feasible to connect the LED to the DAC, have it convert the signal from digital to analog, then shift the data from the DAC to the oscilloscope via spi bus?
No...  I don't know of a DAC that can "read" PWM data.   However, your firmware "knows" the PWM setting, so you can send that digital value to the DAC.

Quote
Also, would using shiftin() and shiftout() work in this case?
You can't shift analog signals, and it would take some "tricks" to shift PWM.  (i.e. You could syncronize the PWM and the serial clock.)

Quote
Currently, I have my LED hooked up to the oscilloscope in channel 2 with 5V from the arduino in channel 1,
There is no "information" in constant 5VDC, so I don't understand why you are reading it.
497  Using Arduino / Project Guidance / Re: lighthouse leds on: June 04, 2013, 08:33:54 pm
Start with the Blink ExampleOnce you understand that, it shouldn't be too hard to blink more LEDs in a particular pattern/sequence.

If you are new to programming, you can try the "long way" first, but If you use a loop, you can increment the I/0 port(s) each time through the loop ("counting up" to 8 or 16) and you won't need a string of 16 separate digitalWrite statements.  (Loops are one of the two most important concepts in programming.  The other important concept is conditional branching such as if-statements.)

In your case it might not matter because your program doesn't need to do anything else.  But, it's generally "bad practice" to use delay() (like the Blink Example), because the processor can't do anything else while it's sitting there waiting/delaying.    Take a look at the Blink Without Delay Example.

The Arduino Uno only has 14 digital I/O pins, but this page shows you how to program a couple of analog input pins for digital output, so 16 "channels" should be no problem.

You won't be able to drive a string of 6 LEDs directly from one I/O port.  You'll need to boost the voltage.  For that, you'll need a higher voltage supply (maybe 18 or 24 volts) and some MOSFETs (or driver chips, or something).   You'll need the specs (voltage & current requirements) fo the LEDs before you can design the hardware.
498  Using Arduino / Project Guidance / Re: Electret Microphone to control LED on: June 04, 2013, 03:37:21 pm
You can probably ignore the envelope detector and just read the peaks.  Peaks don't correlate well with perceived loudness, but for a lighting effect peaks are fine.   

I'd break the project into two parts -

1. Loudness detection.  The SparkFun board is biased at 2.5V.   This is done because audio is AC, but the Arduio cannot accept negative voltages (such as the negative half of AC).   You'll need to adjust for that in software...  You can subtract the bias (i.e. subtract 512 from the ADC reading), or you can ignore negative readings.

To begin with, I suggest making something that simply turns the LED on when the loudness is above a certian threshold.   (You can use the built-in pin-13 LED.)

For sound-activated lighting effects, I like to save a reading every second or so, and make a 20-second moving average, and use that as a reference.   That way my effects automatically adjust to volume changes.    A very-simple automatically-calibrated "flickering effect" is to compare the input to the moving average and turn the led on whenever the signal is above average.   I've also made a VU-Meter like effect where the bottom LED is calibrated to "average", and the top LED is calibrated to the the peak in my moving-averaging array.  Note that the true average of an audio signal is zero... So, you  need to average just the positive readings (or readings above 512), or the absolute value after subtracting the bias.

2. LED driver circuit. 20 RGB LEDs requires 60 outputs/connections.   You'll need some sort of driver circuitry.   I've used some serially driven LED drivers to individually "address" 48 LEDs.  (Soldering 48  single-color LEDs was LOT of soldering!)    The chips I used aren't really for RGB LED, so I won't recommend it.   You'll need to search for an appropriate driver chip.   You'll also need to consider if you need to dim the LED outputs (for "infinite" color combinations).

Again, I'd start simple, with maybe one RGB LED.  Once you can program one RGB LED, you should be able to add/control more.
499  Using Arduino / Project Guidance / Re: Low Voltage Indicator for 12 volt lead-acid battery on: June 04, 2013, 12:56:49 pm
The Arduino has multiple analog inputs, so you can read voltages and/or compare voltages* (or make a "software" voltage comparator).

The Arduino can be damaged if you feed-in over 5v, but since you've worked with op-amps I assume you know how to make a voltage divider. 

If you are new to programming, take a look through the Language Reference to get an idea of what you can do.    Then, take a look at the Examples, especially the analog examples.

Basically, you'll need to understand if-statements.   (i.e. If the voltage is greater than 10V do something, or if voltage A is greater than voltage B, do something else...)

Conditional branching ("making decisions" with if-statements) and looping (doing thins over-and-over) are the two most important concepts in programming.


* The A/D converter doesn't directly read "voltage".  It gives you a number between 0 and 1023 that's proportinal to the reference voltage.   i.e. if your reference is 5V, and you read 512, you have about 2.5V on the analog input.
500  Using Arduino / Project Guidance / Re: Schematic guidance Arduino analog in with PMW out on: June 04, 2013, 12:32:19 pm
I hate the idea of mechanical relays.   If you feel isolation is necessary, I'd prefer opto-isolators.

Quote
As one final detail, in rectifying the 26 V AC I use a full wave rectifier circuitry which should result in about 36 V DC as the max voltage which is a bit strong for a 24 V DC relay, so after rectifying and smoothing I pass the rectified DC signal through a 10 V Zener diode wired in "reverse" orientation on the positive leg of the rectified DC voltage just before it hits the relay.
If you simply remove the capacitor, you'll have rectified 24VDC RMS (minus about 1.4V across the diodes) which is equal in power to constant 24VDC, and the DC relays should work just fine (without the zener). 

Quote
Arduino analog in...
You do not have an analog signal.  You have a digital signal (on or off). 

Quote
I have also put in place some 10 K pulldown resistors on that analog input running them to the "ground" which is effectively the negative pole of the 9V DC regulated power supply.
I think you are missing the connection to the relay that pulls-up the voltage when the relay switches on...

The Arduino has built-in pull-up resistors.   If you enable those, make the relays pull-down to ground, and reverse your program logic, you can simplify your schematic.

Quote
There is no EARTH ground on the system anywhere.
You don't need an earth ground.  You just need a common "ground" reference on each side of the isolation.   Since they are isolated, there is no need for for the two grounds to be connected.
501  Using Arduino / General Electronics / Re: possible short circuit in schematic design? on: June 03, 2013, 06:05:09 pm
Quote
at point A.. the output.. i get 001 at 2000m V on my multimeter.
What is "001"?   

If I understand the circuit correctly you have an open circuit when nothing is connected to the piezos.   2000mv (2V) could be normal.   And, you can't reliably measure PWM with a digital multimeter.

Quote
at point B i'm getting about 14v.
That's a little low for two 9V batteries.   Try breaking the circuit and measuring the current.

Also, make sure that C5 is not reversed.

Is the IC in a socket?   If so, try removing it to see if the voltage goes up, and the current goes to zero.
502  Using Arduino / Project Guidance / Re: Guidance on active spoiler for race car on: June 03, 2013, 05:27:38 pm
I think you'll want to keep the downforce through the turn.   And, you really don't want the downforce turning-off suddenly in the middle of a corner when you back-off the brakes.

It would be easy to test the Arduino/accelerometer with an LED before you build the mechanical stuff, but I don't see any reason why the electronics won't work.

For developing & testing the electro-mechanical part, I'd start with a simple switch.  If you want to wire it to your brakelight, that would be OK.

Airplanes use use hydraulics.  I don't know how DRS in Formula 1 works, but I wouldn't be surprised if it's also hydraulic.

In most forms of auto racing, I believe a moving wing/spoiler is illegal...

Quote
Flipping the switch while driving at 120MPH isn't something that's going to be feasible.
smiley-wink F1 drivers have a DRS button and a KERS button, and a whole bunch of other buttons on their steering wheel!
503  Using Arduino / General Electronics / Re: DigitalReadSerial Arduino Example digital pin 2 voltage? on: June 03, 2013, 12:09:07 pm
Yes.  With the meter's ground lead connected to the Arduino ground, and the meter's "input" lead connected to pin 2, you should see 5VDC when the button is pushed.  When the button is released, you should read zero.  (Note that the meter is electrically connected across the resistor.) 

Check the Arduino's 5V pin to make sure your meter is working.
504  Using Arduino / General Electronics / Re: Will the I fry the LM239D when used as mosfet driver? on: June 03, 2013, 12:02:20 pm
It's standard practice to put a resistor in series with the MOSFET gate.   I don't think the LM239 is internally current limited.    You might not fry the comparator (especially if you are not switching at a high frequency) but a resistor wouldn't hurt.
505  Using Arduino / Project Guidance / Re: SS relays, MCP23017, ULN2803, SSA1064T. Are these good choices ? on: May 30, 2013, 05:45:23 pm
Quote
•I'll need to use DPDT relays this time, and Solid State relays seemed to be a good choice :
I've never seen a DPDT solid state relay...   I'd say they are rare...  If you can't find one, you might have to use multiple relays instead.

Quote
from what I understood, I do not need opto isolation anymore with those relays. Is that quite right ?
Correct.   All relays are isolated.   Solid state relays are optically isolated.

Quote
•To avoid to draw current from the Arduino, I've considered using an ULN2803, but every time I found questions about it, "useless" is a common answer. What's the correct solution ?
For what?  To drive the solid state relays?   You probably don't need it...  You'll have to check the current requirements for your solid state relays.   Typically, you need 5 - 10 mA to trigger a SSR.   Each Arduino I/O pin can source/sink up to 40mA up to a total of 200mA for all combined I/O pins.   Assuming  10mA each, 20 SSRs should be OK without the 2803.

Quote
•Should I use a dedicated EEPROM chip ?
If the internal EEPROM is large enough, use it!    Fewer parts usually means better reliability.   Plus lower cost, and it will be easier to design and build.
506  Using Arduino / Motors, Mechanics, and Power / Re: Need help with Potentiometer on: May 30, 2013, 02:04:34 pm
What's the trouble?

I see you are using the serial monitor.    Are you getting the JoyStick_Y values you expect?

Have you tried "hard coding" the motor speed and direction, bypassing the pot?   And/or hard-coding JoyStick_Y values instead of reading & maping them from the actual pot?

I see a couple of "odd" things...

Code:
JoyStick_Y = map(JoyStick_Y, 512, 1023, 0, 255); //Forward
JoyStick_Y = map(JoyStick_Y, 0, 512, 0, 255);    //Backward
Every trime, right after you map "forward" you re-map "backward".   I don't think that's going to work.

Code:
if ((JoyStick_Y < 512) && (JoyStick_Y > 512)) {
You are NEVER going to see a value that's less than 512 AND greater than 512!!! smiley-grin

In fact, you'll find it very hard to set the pot for exactly 512 anyway.   You might want to look for a small range around 512.
507  Using Arduino / Programming Questions / Re: Cant find a Zero problem on: May 29, 2013, 03:08:45 pm
I don't know if this is the problem, but you have to be careful with "equal" in floating point.   Floating point numbers are stored in binary (like everything else in the computer).    If there are any mathematical operations, there is rounding and very-high precision...

Just as a made-up example, a number that "shows-up" as 1.001 might actually be stored as 1.0010000000001 internally, and that's NOT equal to 1.001.

Or something that is truly-mathematically zero might be stored as a very-very small non-zero number.

So whenever possible, use less-than or greater-than.    If you are looking for zero, you might be able to look for a value less than 0.0001, etc.    (And if the value can be negative, take that into account.)

There are also numbers that can be accurately represented in decimal, that cannot be accurately represented in floating-point binary (similar to the way 1/3rd cannot be represented perfectly in decimal).  I don't remember what those values are, but you can research it if you wish.
508  Using Arduino / Project Guidance / Re: AC Dimming with PR36MF21NSZF on: May 29, 2013, 02:18:36 pm
Quote
Thanks! Is there something I can do, so I can dim properly my LED ceiling lamps?
Look for some example projects.     I've done it a long time ago but with a different processor.

An AC solid state relay will work as long as it's not the zero-crossing type.

As I said above:
1 - Detect the zero crossing (with a safe-isolated circuit).  I built my own (linear) power supply and used the same transformer that was powering my microcontroller to give me safe low-voltage AC into the comparator I used for zero-crossing detection.   (I didn't try to find the exact zero crossing.  I looked for a small voltage just-after the zero-crossing.  Then did some expermentation, and compensated in software.)

2 - Delay for some part of the AC half-cycle.

3 -  Send a trigger pulse to the TRIAC or slid state relay.   (If you use a TRIAC, use a non-zero-crossing  opto-isolator designed for TRIACS, such as the MOC3010.)

...I don't remember if I did this, but if you just detect the positive-going zero-crossings you know when the next (negative-going) zero crossing is, so you don't have to detect the negative-going zero-crossings. 
509  Using Arduino / Project Guidance / Re: AC Dimming with PR36MF21NSZF on: May 29, 2013, 01:33:45 pm
First, you can't dim AC with a zero-crossing device! *

Incandescent AC dimmers work by triggering (turning-on) a TRIAC at some point during the AC half-cycle.  Once triggered, the TRIAC continues to conduct until the current goes to (nearly) zero at the next zero-crossing.   

Assuming the trigger signal is no longer present, the TRIAC turns-off at the zero crossing.

If you trigger at (actually just after) the zero crossing, the TRIAC somes on and stays-on for the full half-cycle and is NOT dimmed.

If you trigger just before the zero crossing, the lamp will come on for a short period of time and it will be very dim. 

That means you have to sense the zero crossing or some constant point along AC waveform (with transformer or optical isolation), delay for some part of the half-cycle, and trigger the TRIAC (or TRIAC- based relay).   This is something like PWM, but regular PWM will NOT work because it will trigger the TRIAC at some random non-synchronnized point along the waveform, and the TRIAC will remain on for the remainder of the AC half-cycle.

Quote
(PWM signal - 1 = 60VAC, 255 = 240VAC), but when I connect a load (lamp) it's 1 = 240VAC and 255 = 240VAC.
A digital multimeter will not reliably measure the average of a voltage that's switching on & off or jumping around unless it has a "ture RMS" feature.  An old analog "mechanical" meter will work better, and since there is often some leakage, you'll get better readings with a lamp connected.



* You can make a simple high - low - off dimmer that turns lamp on for only the positive (or negative) half cycle.  But, you can't do full-range dimming with a zero-crossing device.
510  Using Arduino / General Electronics / Re: Voltage regulator overheating on: May 28, 2013, 04:58:52 pm
Quote
I tried powering the boards with about 11 volts through the Vin pin, I touched the voltage regulator of the Arduino (in the Rev.2 I own the regulator is a NCP1117) and it was very very hot, so I disconnected the power supply.
I tried again, but powering the boards with 7 Volts and the overheat reduces, but after a few minutes the voltage regulator becomes hot again, but fortunately less than before (I didn't measure his temperature, but for my finger was enough).
Right...  The heat is directly related to power, and power is calculated as Voltage x Current.   The power dissipated in the regulator is the from the voltage dropped across the regulator.  With an 11V supply, you have 6V across the regulator.  With a 7V, supply you have only 2V across the regulator for about 1/3rd the power and 1/3rd the heat-rise.

Ther's sort-of a "rule-of-thumb" that if a component is too hot to touch, it's too hot.    I...Not very scientific, but I'd say if you can hold your finger on the part, it's probably not too hot.   If you can't hold your finger on the part, might be too hot.   
Pages: 1 ... 32 33 [34] 35 36 ... 86