Show Posts
Pages: 1 ... 40 41 [42] 43 44 ... 91
616  Using Arduino / General Electronics / Re: My Arduino Nano decided to stop working? on: May 09, 2013, 06:37:44 pm
I can't help you but I had the same problem with an Uno.   It's running a useless-unfinished program and I can't re-program it.  I don't know if the problem is the boot-loader, serial ports, or USB chip.

I bought an AVR ISP programmer (about the same price as replacing the Arduino) to re-porgram it, but that didn't work either.   I think that's a different problem because the error message seemed to say that programmer wasn't recognized by the Arduion IDE.   (I never tried the programmer with a known-good Arduino.)

So now I just the bricked Uno as a template if I need to drill mounting holes in a box/chassis, or if I want to look at the pinout locations, etc. smiley-grin 
617  Using Arduino / General Electronics / Re: Where do you buy your components? on: May 09, 2013, 04:47:32 pm
Jameco & Digi-Key.    I've been buying from Jameco for more than 30 years!!!!  Digi-Key many years too.

I haven't had any custom boards made (or made any myself) since I was in college.   Usually, I build the project permanently on a plug-in breadboard.  It can be very reliable.  I built a car-alarm on a breadboard about 20 years ago, and it's still working.   I've also use various perfboards, wire-wrap, terminal blocks, etc. to avoid the cos to a custom board

The last perfboard I built was an ugly mess (I didn't have space for the breadboard), so I'm probably going to use a real PCB next time i build that circuit.   There are also a couple of circuits I seem to build over-and-over, and I'm thinking it's time to get some boards made for those.
618  Using Arduino / Project Guidance / Re: Smallest AVR that can handle FFT? on: May 09, 2013, 04:13:35 pm
I've never used FFT.   I've done some lighting effects, but everything I've done works off the volume (no frequency filtering and no true beat detection).

Accurate beat detection isn't that easy...   Detecting the bass isn't exactly the same as detecting the beat.  But IMO, a lighting effect that accurately pulses to the beat 1-2-3-4-1-2-3-4 is kind-of boring anyway! smiley-wink

Some people have done beat detection, so you might want to search the forum.  I think it requires two filters - One low-pass to filter-out everything except the bass, and a bandpass-filter tuned to the beat frequency (around 1/4 of a second or about 4Hz).   That 2nd filter is not to filter the signal (there should be no signal at 4Hz), it's used to filter the detected loudness envelope.   (If it was me, I'd probaly do the bass-filter in hardware and the beat-filter in software.)  Then if you wan to get really good, use some "fuzzy logic" to tune that 2nd filter and know when to expect the next beat...  That's how humans do it...  We don't wait 'till we hear the the beat and then tap our foot...  We know when that next beat is coming and we make tiny adjustments as we listen to keep our foot-tapping in-time with the music.

Something that's super-easy to do with just the volume (once you have the hardware setup so that you can read the loudness on an analog pin) is to compare the input to the average, and turn on the light/LED whenever the signal is louder than average.   That's more of a "flicker effect" than a beat effect, but its something simple to start with.

The Smoothing Example example shows you how to get a moving-average.   If you use a moving average, you won't need a sensitivity control, and your effect will automatically adjust itself to loud songs, quiet songs, and volume changes.  (In my application, I also switch automatically between the 1V and 5V analog references, depending on the signal level.)

I use a 20-second moving-average, updating the average-array once a second.  (Of course, I use the "blink without delay" style timing, so it can uns and flash the lights in-between updating the average.)

For some of my effects, I find the peak value in the average-array, and use that as my trigger threshold.  (For example, a chase effect that changes direction only when it hits a new peak.)  For other effects, I use the halfway point between the peak and average.   If you want to use the peak to detect the beat, you might pick a threshold that's something like 90% of the peak value in your array.   You don't want one big peak to throw everything off...

For my very-crude beat detection, I just delay (or ignore peaks) for about 1/5th of a second, so that I don't get to many beats/flashes close-together.   That's nothing like accurate beat detection, but you do get the feeling the that the lights are being triggered with the beat, and it's easy to do!  ...Actually, there's one more "tweek" I'm using.  I increase the sensitivity while waiting for the next beat.     So... I'm unlikely to get a beat trigger exactly when 1/5th of a second is up, but after 1/2 second the sensitivity is going up and I'm very-likely to detect a beat.   
619  Using Arduino / Programming Questions / Re: Pulsing LED with varying speed keeps jumping brightness? on: May 09, 2013, 02:47:34 pm
I don't know if this is a problem, but you are passing a float ("out") to analogWrite().     You might try converting that to a byte or int first.   (And maybe check with the serial monitor to make sure you are getting the byte/integer conversion you are expecting.)
620  Using Arduino / General Electronics / Re: Door bell sensor? on: May 09, 2013, 12:56:54 pm
I'd try picking-up the electrical signal.   Most doorbells run off 12-18VAC.  Do you have a voltmeter?

There some issues, but these should be easy to deal with...   

 - Everyting is probably "floating", with no ground in the doorbell circuit.  You can simply connect the Arduion ground to one side of the dooorbell transformer's secondary.

 - You can't put AC into the Arduino, or voltages greater than 5V.   Besides the 12-18VAC, there is a high voltage inductive "kick" from the coil (assuming there's no diode across the coil).

A resistor and a pair of protection doides will take care of those issues.   For additional protection, you can add a voltage divider in front of that to knock the voltage down to 5V.    If you use a voltage divider, remember that the peal AC voltage is about 1.4 x the RMS value. 

However, I didn't have so far any "aha!" idea...  I was thinking in connecting the piezzo outputs to a 7805 so I could have 5V in the other end... but I don't even know if it would work...
No... Voltage regulators are for power supplies.

I think it's generally safe to connect a piezo directly to the Arduino.   They can put-out voltages higher than 5V, but they have very high internal impedance (low current capability) and the Arduino has small protection diodes built-in.
621  Using Arduino / Project Guidance / Re: Arduino Uno on AA batteries on: May 08, 2013, 05:54:07 pm
That should work fine...

I'd guess the connector might be wired backwards.    Typically the inside of the barrel-connector is positive (and that's what's needed for the Arduino), but there's no solid-rule and power supplies come both ways.

Do you have a multimeter?    ...Probably a good thing to have in your teaching-situation.    You can buy one online for around $20 USD. 

You can also make a little tester with an LED & resistor.  (The LED won't come-on if it's connected backwards, and you can compare the polarity of the battery with your regular power supply.)    I have a little tester I made with a probe (something like this), a couple of different-color LEDs (one for each direction) and an alligator clip.   But for a quick-and-dirty tester for your battery power-supply, you can just solder a resistor & LED in series.

Or you might simply have a bad solder connection, or the barrel-connector might be the wrong size.   (If it's the wrong size it would probably work when you wiggle it around.)
622  Using Arduino / Project Guidance / Re: Binary Down Counter on: May 08, 2013, 03:59:20 pm
How would I could a Binary Down Counter?
What does that mean?   Do you want to see ones & zeros on a display?   Do you want a string of 4 regular LEDs, with ones lit-up and zeros off?

The format only matters for input/output.   The compiler doesn't care and the & chip only uses binary internally.
623  Using Arduino / Project Guidance / Re: confused again with int byte char et al on: May 08, 2013, 02:02:56 pm
I have managed to combine the individual switch readings into 3  integer bytes, which I can display on the monitor fine ( along with a security code 4th byte )  for instance it says it sent    101 , 296, 03, 091
The value 296 (decimal) requires 9 bits and won't fit into a byte!

296 (decimal) = 1 0010 1000 (binary) = 128 (hexadecimal)

If you try putting 296 (decimal) into a byte, you loose the most significant bit -
40 decimal = 0010 1000 (binary) = 28 (hex)

I always have a problem with this,  how can you look at  56 for example, and know if it is number 56 or if its ascii  for 8 ?
It's all just ones & zeros...  Your application has to know what each byte represents.  It also needs to know if two bytes in a row are part of an integer or other-larger type.   In an EXE file, the byte(s) might represent a CPU instruction. 

With standard file formats (WAV, MP3, JPG, etc.), there is a defined file structure.  For example, in an 8-bit WAV file, each byte (after the header) represents an audio sample value.  In a 16-bit WAV file, a sample is represented by two bytes in a row.   The file-format specification and the file-header determine how the data has to be read.

You can open a file with a Hex editor to see all of the bytes.   Wherever there is a value that can be converted to an ASCII character, you will also see that ASCII character.    Usually, you'll see some readable text in the header.   When you get into the "real data", you'll also see characters.  For example, wherever there is a value of 41 hex (65 decimal) you will see 'A'.  But unless it's a text file, that 41 hex may not represent the letter A, and there's no way to tell unless you understand the file format.
624  Using Arduino / General Electronics / Re: About different ways of soldering on: May 07, 2013, 06:48:14 pm
I agree... Get a soldering iron.

I've never heard of tape-solder either.  I might have seen something like solder-ribbon that you wrap-around free-hanging wires before heating with a soldering-iron or torch.  Something like that might be appropriate if you are an auto mechanic???

I used conductive glue once to re-attach terminals to the rear-window defroster on my car...   For some reason the solder wouldn't "stick".   It's a fairly high-current application and the glue worked, so I assume the resistance was low, at least with that fairly-large surface area to work with.  (I was worried about resistance before I tried it, but I really didn't want to buy a new rear window.)

With surface mount, you may want to try solder paste and a hot plate.  But, I've never tried that myself...  I try to avoid surface-mount as much as possible at home.   At work we have a surface mount rework station that uses a pre-heater, a hot-air solder pencil, and solder paste...  Too costly for me at home, and it doesn't work that well with fine-pitch parts.  For board assembly, and for rework on fine-pitch surface-mount parts at work, we send the out board to our board-assembly house.  (Again, the setup costs for a board-asssembly contractor are way too high for hobbyists.  It only pays-off if you are building maybe 100 boards.)   
625  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.).
626  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.
627  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....
628  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
629  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.
630  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. 
Pages: 1 ... 40 41 [42] 43 44 ... 91