Show Posts
Pages: 1 ... 36 37 [38] 39 40 ... 86
556  Using Arduino / LEDs and Multiplexing / Re: Dimming with AnalogRead/analogWrite-basic on: May 07, 2013, 06:21:40 pm
What I am trying to do is analogRead that value
What is "that value"?  I don't think you need analogRead()*...

You've got:   

int white_max = 100;  // Note - int must be lower case, not Int.

In that case, we (and your sketch) know white_max is 100, so if we want to set the brightness to 100, we have two choices:
analogWrite(white_leds, 100);  // The brightness is not variable.
Or since the variable white_max equals 100,
analogWrite(white_leds, white_max);     // Brightness = value of white_max

* analogRead gets the voltage from an analog pin and converts that voltage to a number between 0 and 1023, and (usually) you assign that value to a variable.    analogWrite() accepts values between 0 and 255.  That's why you divide by 4 when you dim an LED, based on an analog input voltage (from a pot, etc.).
557  Using Arduino / LEDs and Multiplexing / Re: Electromagnetic 7 segment on: May 07, 2013, 05:50:35 pm
Is there any manufacturer or part number?

Are there any electronics (a circuit board with IC's, resistors, transistors, etc.)?  Or just electromagnets?  Any voltage markings or anything?

If you don't have any information and there's no electronics, you can use a variable power supply (which you'll have to build or buy if you can't get your hands on one) to find out how much voltage it takes to change/activate a segment.  The when you find a voltage that seems to work, you can measure the current.
558  Using Arduino / General Electronics / Re: EMI Suppression bead on: May 07, 2013, 04:43:11 pm
Your computer is fried and you're worried about your Arduino????

I guess the lesson is to stick a USB hub between the Arduion and the PC...  Maybe I'd better get a hub!

I have a bad feeling your Arduino is dead...  You can check the inductor with an ohmmeter (multimeter).   It should read short (nearly zero ohms).     You might also check the fuse F1 while you're at it.  But that fuse and the bead only go to the USB port, so they shouldn't stop the CPU from running.

I'm assuming its something to do with the stepper driver thats killed eveything.
I assume so too...   Motors put-out an inductive "kick" (high voltage) when turned-off suddenly.   But, the motor driver should have protection diodes to prevent any damage (to the driver circuitry or the Arduino).

I assume the driver board runs off something like 12 or 24V?  Normally, the circuitry on the driver board should prevent damaging voltage/current from getting-to the Arduino.   But, if some semiconductor on the driver board fries and completely shorts-out, it's possible to get excessive voltage & current on the Arduino (depending on the driver design).  Then maybe your ATmega chip shorts-out, putting excessive voltage out the USB port, frying your motherboard...

If you are paranoid, you might try optical isolation between the Arduion and motor driver (at least during the experimental/development phase).

Or, maybe your motherboard, or computer power supply, failed first, putting excessive voltage out the USB port and frying your arduino....
559  Using Arduino / Project Guidance / Re: Sound Level Detector on: May 07, 2013, 02:30:45 pm
The brick includes a "high sensible microphone", but no amplifier, which isn't very "sensible".
This one does have a preamp.

I believe the output is also biased at 2.5V, which takes care of the negative-half of the waveform.  (You can damage the Arduino if you fed-in negative voltage, or voltage greater than +5V.)

You may need to subtract-out the bias from your ADC readings, and/or account for the fact that an AC signal has an average around zero...

smiley-grin I assume the SparkFun guys know the difference between "sensitivity" and "sensible"! smiley-grin
560  Using Arduino / Project Guidance / Re: Sound Level Detector on: May 07, 2013, 02:22:49 pm
...if a sound abnormally exceeds that sound level it starts flashing a LED.
That should be possible as long as you have access to a real SPL meter for calibration.  

I built a VU meter "effect".   It's a string of LEDs that bounce up & down to the loudness of the music, but it's not a true meter because it's not calbrated so it can't truly measure anything...  In fact-it "self-calibrates" to the changing long-term average for lots of "meter action" no matter what the volume setting.  (My meter effect doesn't have a microphone, it hooks-up to the line-output of an audio device.  If I wanted to use a mic, I'd also need a preamp.)

Note that with music the average is typically around 18dB below the peak.   The average correlates with perceived loudness better than the peak.  So, you'll probably want a short-term average (at least a second or so).  

Also, since our ears don't have flat frequency response, there is something called A-Weighting.   You may be able to ignore this if you don't need super-accurate readings and if the "character" of the sound is always the same (crowd noise, music, etc.) as long as you calibrate with an accurate A-weighted SPL meter.

If you need A-Weighting, I'd guess it's easier to implement on the analog side, before the signal hits the Arduino ADC.

Maybe I need another sensor to capture ambient sound too?
If you want to digitally record the sound, uncompressed audio takes a ship-load of memory and I wouldn’t recommend the Arduino.

If you just want to record the loudness or the loudest reading, that’s easier (depending on how many data-points you want to save).

It would also be super-easy to add a 2nd LED that latches-on (stays on) to "remember" if the threshold was exceeded.
561  Using Arduino / Programming Questions / Re: Program stop working after about 30 seconds? on: May 06, 2013, 07:16:37 pm
Change start to type unsigned long.

A 16-bit signed integer will "roll over" and become negative if you try to go over 32,767.    (30,000 milliseconds is 30 seconds. smiley-wink

millis() returns an unsigned long, and it will roll-over after about 50 days. 
562  Using Arduino / Programming Questions / Re: How to emit a frequency from an infrared led on: May 06, 2013, 07:10:37 pm
I've never done that, but look into serial communication.  For example, RS-232 communicates at a known baud rate.   

Technically, the LED emits at a given light-wavelength/frequency in the IR band, and by turning it on & off at 38kHz, you are modulating it at 38kHz (or transmitting at 38kHz).   

The wavelength doesn't matter to the Arduino, it just has to match the receiver.   
563  Using Arduino / General Electronics / Re: Trouble with transistor's on: May 06, 2013, 06:54:19 pm
It looks like the same part, so you shouldn't see a difference.  What kind of "trouble"?    Is the LED/fan always full-on or full-off?   

This is a "wild guess", but I wonder if the resistor on the assembly helps prevent damage from static discharge, and the loose part is getting "zapped" during handling?

If the parts are dying for no apparent reason (not over-voltage, over-current, or over-heating), static discharge is a likely cause.

Once the resistor is "permanently" connected to the MOSFET, that would provide some static discharge protection.
564  Using Arduino / LEDs and Multiplexing / Re: Help with getting started with an LED driver (AS1100PL) on: May 06, 2013, 05:42:40 pm
That is sort-of an advanced chip... I've never used one.   Troubleshooting could be tricky when the display-chip acts differently than what you expect...

You probably should start by experimenting with a simpler shift register.   There is an example project here.  (I have used something similar to that...)   If you can write a hex value to the 74HC595 chip, and see that value displayed as an 8-bit binary "number" on 8 LEDs,  you'll probably feel better about using the AS1100 chip.

You'll need to read the datasheet several times!!!   Make sure you understand what all the pins are for (especially the input/control pins), how the serial communication works, and what the various commands (hex codes) do.

With this chip, you write data to an internal register by sending a 16-bit word that contains a register address (4-bits) and the data (8-bits) to be sent to the register.  The 4 most significant bits are "don't care", but something needs to be sent so you'll normally send zeros.

The Windows calculator in the scientific mode can convert between hexadecimal and binary, or you can memorize the 16 conversions (0-F) and you'll be able to convert numbers of any size between hex and binary in your head!!!   It's much easier than converting between decimal and binary, because each nybble (group of 4 bits) converts to exactly one hex digit.   (You already know 1 and 0, so that's only 14 more to learn, and some are easy to remember like F, 5, & A.)

The datasheet shows hex and binary.   I suggest you use hexadecimal in your sketch (put 0x in front of the number to indicate hex).  You can use decimal if you really want to, the compiler doesn't care since everything is binary inside the microprocessor anyway.  (On the AS1100 datasheet, an uppercase X means "don't care" and a zero followed by a lower case x means the following digits are hex.)

The serial data communication concept is fairly simple...  once you "get it".    You "clock-in" data one bit at a time, and then after you've sent-in 8 or 16-bits, you "latch" that data to the parallel outputs.

You need to assign 3 Arduino-output pins (data, clock, latch).  The actual signal names might be different on various chips, but the function is the same.

1. Write to the data pin (one bit high or low).
2. After the data-pin is stable, write to the clock pin  (With the AS1100 chip, data is read on the clock's rising-edge).
3. Write to the clock again to reset (Write low, to get ready for another rising edge.)
4. Write the next bit to the data pin (bit high or low).
... Repeat until all bits have been written (16 bits for the AS1100).
5. When all bits have been written, Write to the latch pin.  (With the AS1100, data is latched-in when on a rising edge.)
6. Reset the load pin to get ready for the next rising edge.

Usually, the exact timing is not that critical.   The important thing is that the data is stable for a short period of time, before the clock-edge comes along.   
565  Using Arduino / Programming Questions / Re: start code from the begining .How? on: May 06, 2013, 03:46:27 pm
It's still not that clear what you want to do...

loop() will automatically loop/repeat, unless you are stuck in another loop.

You can break out of a for-loop, while-loop, or do-while loop, with break, but you shouldn't generally break-out of your main loop because your program will end and nothing will happen 'till you hardware-reset.

Or as Sembazuru suggested, you may need an [yurl=]if[/url]-statement.

I tried with goto but it only works inside their void.

 - loop() is a function.

 - void at beginning of a function prototype or function definition means the the function returns nothing when the function ends/returns.   Otherwise, you'll see the varaible-type that's returned by the function (such as int).

 - The empty parenthesis indicate that no values are passed into the function. 

And FYI - It's generally considered "bad practice" to use goto in C/C++.
566  Using Arduino / Project Guidance / Re: External power Changing my AnalogRead on: May 06, 2013, 03:00:59 pm
I think we need to see a schematic....

The power suppy ground, the Arduino ground, and the sensor ground all should be connected together.   All of the voltages & signals need a common "reference point".    (Of course, the voltage regulator needs to share that common ground too.)    That might not have anything to do with your problem, but it's something to check.  If connecting the grounds causes a problem, something is wired wrong.

To finding the missing ground or ground disconnection. the moment i connect the ground from my voltage regulator to the arduino that is when i read that 5 volts. at this point i also use a volt meter and checked the voltage out of the sensor and i was getting 25 volts which is what my power supply is putting out.
That's all very confusing...  5 volts where?  Out of the sensor?   Out of the voltage divider?    There are protection diodes on the Arduino inputs and if you have a series current-limiting resistor (or voltage divider), that should clip/limit the analog input voltage to just over 5V (which might not be give you the calculated/expected output from your voltage divider).

the moment i disconnect that ground the device goes back reading the prox sensor.
So it reads the sensor correctly with the ground disconnected?

567  Using Arduino / Project Guidance / Re: External power Changing my AnalogRead on: May 06, 2013, 12:53:04 pm
You might have a broken ground or missing ground...    Make sure the proximity sensor's ground is connected to the Arduino Ground.   Try turning the computer off with the USB plugged-in (and grounded), but not powered.

568  Using Arduino / General Electronics / Re: Help with schematic (changing GND to 6v) on: May 02, 2013, 06:49:44 pm
My question is: Can I connect GND to 6v so the voltage difference of the led is 6v??? (12v-6v=6v)
What?   I'm pretty sure the answer is No.  But, I'm not sure I understand.  Where's the 6V coming from?  If you have a 6V supply, why don't you use it directly instead of trying to subtract?

If the 6V & 12V power supplies share a common ground and you ground the 6V supply, you are shorting it out.

You can measure the voltage difference between two power supplies (if they have a common ground), but if you try to pull power (current) from the difference you might have trouble (because you'd be trying to run current "backwards" into  the low-voltage supply.)

569  Using Arduino / Audio / Re: How can I control audio volume with Arduino? on: May 02, 2013, 05:05:47 pm
Do you know how a regular/manual potentiometer is wired-up?

Digi-Key lists thousands of different digital pots (I'm sure they are not all in stock).   

10k  to 100k Ohms is a good value for line-level audio.  You'll need two for stereo (or you can get a dual digital pot), but you can connect as many as you want to the same control-signals from the Arduino.  You'll probably want to get a thru-hole package if you want to avoid soldering the smaller surface-mount parts.

Different digital pots are controlled differently, and it's your choice of how you want to do it.   The most common method is serial I2C.  There is an  I2C library for the Arduino, so it shoudn't be too difficult.   Some are controlled with a parallel (binary data) connection.    Some have up/down digital controls, which might have an advantage in that you won't get a sudden full-volume blast if there's a little "glitch" i the control data.

An audio volume control has an "audio taper" (approximately logarithmic).  This is because 50% on a regular (linear) pot sounds a lot closer to full-volume than half-volume (due to our logarithmic hearing).   With a digital pot, this can be handled in your sketch.
570  Using Arduino / Project Guidance / Re: Solar charger shield not charging? on: May 02, 2013, 04:21:59 pm
A quick look at the specs shows a minimum voltage of 2.7V and a typical voltage of 3.7.   It also says 500mA max, but it doesn't say how much light you need, or how much voltage you get at 500mA (maybe 2.7V).   

What are the LEDs showing you?   Have you tried charging without the 70mA load?   Have you measured the voltage & current from the solar cell?   150mA "in the shade" sounds like a lot for a solar cell that puts-out 500mA in direct sunlight...

That 500mA rating might be at noon, in the desert, in the middle of the summer! smiley-grin
Pages: 1 ... 36 37 [38] 39 40 ... 86