|
556
|
Using Arduino / Project Guidance / Re: Creating "Party Lights" - LED Brightness?
|
on: May 07, 2012, 04:12:41 pm
|
Just as a "reality check", how many Watts do you have normally lighting-up your garage? 75W? 100W? My main "dance lighing" effect uese 8 100W colored floodlamps... (With colored incandescent lamps, you need more wattage, since the color-filter knocks-out much of the light.) A standard 20mA LED is somewhere around 40mW (0.040 Watts). LEDs are far more efficient than incandescent fluorescent, but if you go with LEDs, you are still going to need Watts, not milliwatts... Most of the LED-based DJ lighting effects I've seen have high-power 1W or 3W LEDs. Most of these are designed to throw focused-beams of light around, rather than lighting-up the room. These high-power LEDs need a special constant-current power supply. All LEDs need a constant-current (or controlled-current) supply, but with low-power LEDs you can use a resistor to regulate/limit the current. Just for kicks, I decided to add more LEDs (equal numbers for the three different colors) to see how many the Arduino could handle and if the brightness would increase. I was able to add three more, then six...and before I knew it, I was up to 24 LEDs (total) using one pin for each color on the Arduino (8 LEDs/pin). Please be careful! You are in danger of "drawing" too much current from the Arduino and damaging it! One LED per pin is close to the limit. (In a carefully-designed series/parallel circuit, you can probably drive 4 LEDs from one pin.) How then could I maximize the amount of current flowing through each LED? I connected a 12V power supply to my Arduino while it was plugged in and it didn't seem to affect the brightness of the LEDs at all. Why is this? The chip runs-off 5V. If you connected 12V to the power-connector (or to Vin) there is a 5V regulator providing 5V to the chip. How then could I maximize the amount of current flowing through each LED? Typically, you'd use a transistor, MOSFET, or driver-chip to boost the current. If you wire LEDs in series, the same current goes throug all of the series LEDs, but this takes more voltage, which again means one of those devices to provide the higher voltage without damaging the Arduino. In general, what is a good site for buying electric parts like this (resistors, LEDs, breadboards...)? Where do you live? In the USA: JamecoDigi-keyMouserI recommend that you also get the printed catalogs. It's a lot easier to browse a printed catalog when you don't know exactly what you are looking for. @radio: Were those Christmas lights all just random colors? I like the idea of using a pre-made strand of lights but I would really like to be in control of what color light is emitted based on the music frequencies and such. First, if you are going to control AC, you need to isolate the AC from your Arduino. That means an opto-isolator, relay, or solid-state relay. And if you use an opto-isolator, you also need a TRIAC to handle the higher voltage/current. A solid-state relay is the simplest (4 wires), but also the most expensive. And f you need to dim, dimming AC is not quite as easy as dimming an LED with PWM. For colors, you buy 3 or 4 strings plus some extra "replacement" bulbs (or LEDs) and move the lamps around to make all of the lamps in each string the same color.
|
|
|
|
|
557
|
Using Arduino / Project Guidance / Re: General project planning methodology?
|
on: May 04, 2012, 07:16:35 pm
|
I usually go the same way I did when I was playing Legos... I think, do, rethink and redo and so on until I get it right making up new things as I go along. That seems like a good approach. I like to "develop" or "grow" the project... The "right way" is to develop your requirements/specifications first. With a hobby project, you don't need all of the details nailed-down first, in fact you might get some good/better ideas as you progress. But, you should have an idea where you are going... Then try to figure-out if it's feasable and economical, and try to get some ideas of how you are going to approach it. What's it going to take in terms of time, materials, knowledge, and skill? (If you wanted to build a motorcycle, you wouldn't use Legos, etc.  ) For me it seems like I usually start with the hardware. I try to figure-out what kinds of parts I'm going to need (is the Arduino going to work, or do I need something different?) and I sketch-up a schematic, even if I don't know details like exact resistor/capacitor values, or what transistor I'm going to use, etc. Then I order some parts, and probably a few extra parts. It's not unusual for me to make a 2nd parts order as the project moves-along, but hopefully I'll only have to order parts once or twice. Then I start development... What I mean by "development", is that I break it down into parts/modules that can be built & tested separately. I do this with both the hardware and software, and where I start depends on the project... Typically, there is input and output. I may be able to test the output-hardware (i.e. relays, or an LED matrix, etc.) by itself by hooking-up voltages, or I may be able to use a little test-program. Same with the input-side hardware (i.e. switches, op-amps, etc.). I may be able to test it by itself, or with a multimeter, or I might need to hook-up the Arduino and run another little test-program. Or, maybe I need the Arduino and the output-stuff working before I can fully-test the input side... That's stuff you have to figure-out. For "prototyping", my standard practice is to build the final circuit on a plug-in "breadboard" whenever possible, so my final-prototype is my final-design. The same "development" is true with the software (even more true with software). You generally need to write the output-stuff first, so you can "see" what your program is doing. If you try to write the whole program (sketch) at once, you will have lots of errors, it won't work, and you won't know why. And, you usually cannot just start at the top, and work down... You need to start with things that you can try/test and when they work, add more. When you write a function, you can start-out with a simple function that does part of what you need (and maybe it blinks an LED, or sends a message to the serial monitor) and then add to it, testing as you go-along. Whenever you add a function, or a bit of code, make sure you can test it before moving-on. If you can't test your code/function because the program isn't finished, you are porbably working on the "wrong" part of your program. Or, sometimes you have to write some extra "test code" just to check-out your "real code". You can remove or comment-out the test code when you're done. And if you are dong it the "right way", the final step would be to test and confirm you've met all of your requirements/specifications. With a hobby project this isn't usually necessary... You know if you are happy with the result.
|
|
|
|
|
558
|
Using Arduino / General Electronics / Re: Colored Circuit Board
|
on: May 04, 2012, 03:49:49 pm
|
I don't think you'll find much choice in "hobby quantities", but you might be able to find blue. Making your own board is not that easy and color is about the last thing I'd worry about... I encourage you to try it if you want to... I made some homemade boards a million years ago, but when I was in college we had a lab that would make boards per our supplied artwork* for under $10. I've never done it myself since. (I hope to never do it again!  ) Now, if I really needed to use a PCB, I'd pay a couple-hundred bucks and have some professionally made. * This was before Gerber files, and we had to create 2X artwork on mylar film with black tape & stick-on "doughnut pads", etc.
|
|
|
|
|
559
|
Using Arduino / Project Guidance / Re: From ARDUINO IDE to other tools .
|
on: May 04, 2012, 01:15:38 pm
|
Will it be a demanding learning curve to acquire the specifics of the C code of that tool after getting used to ARDUINO C dialect ? Assuming you know C/C++, and you are comfortable programming the Arduino, you'll probably be comfortable with a different IDE in about a day. If you go with a different microcontroller (especially a different microcontroller manufacturer or "family") you'll need to spend some time studying the hardware (inputs/outputs, timers & other features, etc.). The Arduino hardware description boils it down to about 10 pages, telling you most of what you need to know, whereas the actual ATmega data sheet is over 400 pages. With the Atmel/Arduino chips, I've only used the Arduino IDE... But, whenever I'm using a new compiler/IDE/system, my goal for the 1st day is to get "Hello World" (or 'Blink LED") compiled and running. If I can get the software installed, configured, figured-out and working in a half-day, I'm happy! There are usually a few "glitches" and "gotchas". It may take a bit longer to learn to use the various feature of the IDE. ( I'm not an expert programmer, but over the years I've done a little programming in several different languages on several different platforms/systems.) I was AMAZED when I was able to download and install the Arduino IDE, and get "Blink LED" compiled & running in about 15 minutes!!!! Typically with a microprocessor/microcontroller, you might need to buy a separate programmer and/or a hardware development/evaluation board. With the Arduino, you get a ready-to-run board with a pre-installed bootloader. That, along with the free open-source IDE makes it cheap & easy for hobbyists to get started.
|
|
|
|
|
560
|
Using Arduino / General Electronics / Re: Arduino vs embedded system
|
on: May 03, 2012, 06:45:26 pm
|
|
I agree. Yes... As soon as you build the Arduino into your project, it's an embedded system. I'd say an embedded system is just about anything with a CPU that's not a "regular" computer (PC, MAC, Linux, etc) with a keyboard & display... An embedded system is NOT a general-purpose computer that runs a variety of user installed programs. It generally has a special-limited function (or functions) and the software (firmware) is generally installed at factory (although the user might upgrade or hack the firmware). All of the computer chips in your car are embedded systems. If you build an Arduino car alarm, you've added one more embedded system.
Most CPU & microcontroller chips sold today are used in embedded systems. (I don't know the statistics.)
If you took the motherboard out of your computer and screwed it to the wall to control an alarm system, and that was it's only purpose, I'd say that's an embedded system even though it's not really "embedded" or "inside" anything.
In the early days of computers (before the IBM PC took-over) there were special "word processor" machines. These were very-much like computers with a keyboard, display, floppy drive, and printer. But they only did word processing, so they would be classified as embedded systems.
A smart phone... I don't know for sure... The phone & communication functions are embedded, but it's also a general-purpose machine that can run user-installed applications... So, it might be classified as a hybrid embedded/general-purpose machine.
A game system is another possible hybrid. It's mosly an embedded system that plays a variety of games. But, it can also do other things.
P.S. Here's another "hint" - An embedded system is normally programmed & compiled on a different "regular" computer.
If you are writing an application for a computer, you load your development system (compiler etc.) on the system it's going to run-on. You normally write PC applications on a PC, Mac applications on a Mac, and Linux applications on a Linux machine, etc.
But with the Arduino (or other embedded systems), you don't write and compile the program (or sketch) on the Arduino. Your compiler (cross-compiler) runs on a different system and it creates the binary code. The ready=-to-run machine-language code is uploaded (or programmed into) your embedded "target system".
As a general rule, I'd say embedded programming is harder... You don't have a screen so it's hard to "see" what's happening, because it's harder to display variables, or display debugging information about what the program is doing (when it's not doing what you want). The Arduino's serial monitor does give you some of that capability... And the serial monitor is fully dubugged, and it works...
You also need to understand the elecronics/hardware and you are often working on hardware that's not fully-debugged yet. At least we know the basic Arduino board is debugged, and we only have to debug the stuff we add. Professional embedded programmers often have an electronic engineering degree, rather than a computer science degree, or if they have a computer science degree they also have a strong electronics background.
That said, it doesn't get much easier than the Arduino "Blink LED" example! The simplest "Hello World" C or C++ program is just as simple, but when you start programming for the Windows operating system, the simplest Visual C++ "Hello World" program is about 2 pages of code, since you have to create a window and make the window respond to the mouse, etc.
|
|
|
|
|
561
|
Using Arduino / Programming Questions / Re: pseudo-random algorithm?
|
on: May 03, 2012, 01:35:59 pm
|
From an engineering/programming point of view, I wouldn't say it's a paradox. It's an engineering challenge to make something random enough, or unpredictable enough for the intended application. I think I could program a slot machine that's random-enough that you would run-out of quarters before you could ever figure-out the "pattern".  And, I wouldn't have to use any of those fancy quantum-physics or true-noise "tricks". (I probably would so something with the "random" time between handle-pulls.) If you are a philosopher, perhaps it is a paradox. Or, perhaps the answer is simple... perhaps nothing is truly random since God (or a theoretical all-knowing being or an all-powerful machine) could always predict the next number...
|
|
|
|
|
562
|
Using Arduino / Project Guidance / Re: How to get Arduino to sense if a transformer is switched on.
|
on: May 02, 2012, 06:38:18 pm
|
I assume you know how to detect a high/low input in your sketch... You've got one simple issue do deal with... You can't put 12V into the Arduino. You just need to drop that 12V down to 5V at the Arduino input (without affecting the other stuff that's connected to 12V). If your "transformer" is putting-out DC, it's actually more than a transformer, and that's good, since you can't put AC (or negative voltage) into the Arduino. I'm going to describe this in words because I although I've been working in electronics for a long time, I don't have any schematic-drawing software.  I'm gonna' have to get 'round to that...) Put a resistor (~10k would be good) between the 12V from the transformer and one of the Arduino's inputs. Then connect a diode between the same input and the Arduino's regulated 5V power supply (i.e. the "5V" pin), with the anode on the input (i.e. "point" the diode toward the 5V supply). Any regular silicon diode will work, since there is very little current through the 10k resistor. Whenever the voltage goes above 5V (plus the ~1/2V drop across the diode), the diode "turns on" and "clamps" the voltage at 5V (plus the diode drop). The "remaining" ~7V gets dropped across the resistor.
|
|
|
|
|
563
|
Using Arduino / Motors, Mechanics, and Power / Re: Op-amps? Need to learn
|
on: May 02, 2012, 06:08:43 pm
|
What do you want to learn? If you want to see a bunch of sample applications/circuits, the "famous" AN 31 is a great place to start. If you want to make filters, there's the famous Active Filter Cookbook, but that's an old pre-Intenet book and I assume that you can now find the formulas (to calculate the resistor & capactor values) online. If you just want to learn the basics of "how they work", I don't know of a handy reference... I'm sure I've got a textbook on my bookshelf, but that should be available online too...
|
|
|
|
|
564
|
Using Arduino / Audio / Re: Pulsing rgb LED's to the beat of music
|
on: May 02, 2012, 03:03:09 pm
|
I don't believe the Arduino ADC is fast enough for full-range (20-20khz) FFT... But, it is plenty fast-enough if you do the frequency-filtering first, and it just has to read & process the voltage (volume) for each frequency-band. You could build frequency-filters (bandpass filters) and peak-detectors with op-amps, but I think the simplest approach would be this chip which gives you outputs for a 7-band spectrum analyzer. If you want, you can just use 3 of the bands and connect the output to 3 of Arduino's analog inputs. ---------- I just finished an audio-lighting project and I have a couple of hints that might make your set-up work better by automatically-adjusting to the volume level... (My design doesn't have any knobs or controls.) Once per second, I load the volume-reading into an array/buffer. The array holds 20 values, and when I get to the end, I start-over. This gives me 20 seconds worth of "data". I take an average and find the maximum every time I update it. (I'm not finding the minimum in my application, but of course you could.) One of my effects simply compares the input to the average (in a loop, of course), and whenever the input is greater than average, the lights come-on, and if it's below average, they go-off. This makes the lights "flicker" to the music. Another effect is a VU meter effect. The bottom light comes on whenever the signal is above average, and the top-light comes-on when the signal is slightly-less than the maximum. The in-between lights are scaled to come-on proportionally in-between. Of course, this is not a good "meter" because the display is meaningless, but it works as a great meter-effect. In addition, I check the maximum value in the array to select the 1.1V or 5V ADC reference. If the maximum value is 1023, the ADC is clipping. If I'm using the 1.1V reference and I get 1023, I change to the 5V reference. If I'm using the 5.5V reference and the maximum is below 200, I switch to the more-sensitive 1.1V reference. When I switch ADC reference levels i re-calculate the values in the array, so that I dont' have to wait 20 seconds for the array to re-fill with good-data.)
|
|
|
|
|
565
|
Using Arduino / General Electronics / Re: Question about Digital pins voltage max on INPUT
|
on: May 02, 2012, 02:21:23 pm
|
if you look at the specs for a chip, you'll see "absolute maximum ratings". This means that the chip is ALWAYS SAFE below these voltages/currents. The ATmega chip is rated for up to 6V operating voltage, and the input pins can go 1/2V over the operating voltage, or as low as -1/2V. Typically you are operating at 5V, so you can safely apply up to 5.5V on a pin. That does NOT mean that you will automatically fry the chip if you put 6V on an input... It means that you MIGHT fry the chip, so you should NEVER do it.  Where I work, we make a board that operates from 5V, and of course it has lots of 5V chips on it. One of the configurations has the same barrel-connector as our 12V products... So once in awhile, we accidenly plug 12V into it... Usually, that frys the board... But usually just the RAM gets fried, and sometimes the CPU chip. Everything else survives, and we can repair the board by changing one or two chips.
|
|
|
|
|
566
|
Using Arduino / Project Guidance / Re: Light triggered audio project
|
on: May 02, 2012, 02:04:17 pm
|
Is there a (simple??) way of getting a sound to play through a pc? Maybe a .wav? If I can get this working then I'll be one step closer to my goal. If you are using a PC, I'm not sure how you get the application running on the PC to interact with the Arduino... Maybe someone else can jump-in and advise on that. If you can get the Arduino communicating with the PC, then the Arduino will be a good, inexpensive, way to "collect" the digital or analog from your optical sensors. There are special-purpose cards/devices for connecting sensors (and relays, etc.) to a computer, and with something like that, you wouldn't need the Arduino. You should find this stuff if you look-up " data acquisition" or " data acquisition and control". These things come with drivers (and probably a software development kit) so getting the "information" into the computer fro use by yoru application is easier. The bad news that this stuff can be very expensive. Since you are using a computer, it should be no problem to generate or play multiple sounds at the same time. As long as you know how (or you can learn how) to program in Visual Basic or Visual C++, and how to make your application communicate with the soundcard driver. To do something like that without the computer, the Arduion by itself is only good for generating fairly simple square & rectangle wavforms. To play mp3, WAV or MIDI sounds, you'd need an additional audio "shield". And for multiple sounds, you'd probably need an Arduino & audio shield for each of your boxes.
|
|
|
|
|
567
|
Using Arduino / Audio / Re: Line Level
|
on: May 01, 2012, 03:01:39 pm
|
I think you are at the point where you should jump in, buy some parts (if you don't already have them) and start experimenting/prototyping! If you buy a few extra resistors, you can experiment with different gains/attenuations. It's a good idea to make some calculations, but with audio you might not know how loud it's really going to be... Even calibrated sound systems (such as movie theater systems) have volume/level controls so that they can be adjusted/calibrated. Just connect your optional amp to the DAC output (with a blocking capacitor) and you don't need a differential attenuator. Since that signal is single-ended, you can use a regular voltage divider or pot to bring the signal down to "line level". Or if the amp has a volume control, you can just feed-in the "slightly hot" signal (slightly higher than normal line-level) and you'll be fine! It's no problem connecting your home-made amplifier and another one to the DAC at the same time. I don't know if I need them on the amps output. You don't need them for the speaker. If you want to connect another amplifier to the differential output of the amp you build, YES, you need a blocking capacitor. Just use one-side of the differential output and put a capacitor in series. Connect the additional amplifier's (single-ended) input to the capacitor, and connect its input-ground to your amplifier's ground. (One-half of the differential output won't be used.) I've found a lot of different designs for them but they all talk about reducing decibels rather than voltage Decibels are a ratio. The basic formula in relation to voltage* or signal level is 20 x log(V2/V1). Sometimes V1 is a known reference... For dbV, the reference is 1V. A couple of ratios that are handy to remember, are that 6dB is a ratio (or factor) of two, and 20dB is a ratio of ten. Reducing 5V down to 1/2 volt is a -20dB change. If you amplify 0.5V up to 5V, your amp has a gain of 20dB. If you want to convert the other way, from dB to a ratio, it involves raising a number to the power-of-10 (the opposite of a logarithm), and you can look that up. I'm a bit confused about how one would wire that ground connection with the 47nF capacitor though. I'm pretty sure I can't ground my whole analog circuit through a capacitor. But perhaps that ground it and the other capacitors are going to isn't the mp3 shield's ground but rather a connection to the amp's ground. I'm not familiar with that device at all. Somewhere, all of the grounds need to be connected directly together. That is, the gound(s) on the DAC circuit need to be connected to the ground(s) on amplifier circuit. On a regular hi-fi amplifier, that common ground is on the RCA input jack, which has one signal wire and one ground/shield wire. * With power the formula is 10 x log(P2/P1). This is basically because when you double the voltage, you also double the current (assuming constant resistance/impedance), which means you quadrupal the wattage. A +6dB change is double the voltage, or 4 times the power.
|
|
|
|
|
568
|
Using Arduino / General Electronics / Re: Amplifying signal with a Transistor?
|
on: May 01, 2012, 01:20:38 pm
|
Here is a schamatic for what you want. It's supposed to be for a solenoid, but it will do what you want. You can delete the diode with a speaker. What's the impedance and power rating for your speaker? We can't know what transistor or what voltage to use without knowing what we are "driving". A power amp has a couple of advantages - It (normally) has a volume control, and it will (normally) filter-out the DC component from the signal. (DC into a speaker just generates heat & wastes power without contributing to the sound, and it can actually make the speaker operate non-linearly.) Maplins recommended this transistor... That's not a transistor... It's a voltage regulator... WRONG PART.
|
|
|
|
|
569
|
Using Arduino / Project Guidance / Re: Sound to guitar amplifier.
|
on: May 01, 2012, 12:24:37 pm
|
I agree with Mike, a capacitor should do it. Just turn-down the guitar amp before you start, because the signal will be on the "hot" side. If the signal is too-hot, so that you always have the volume set to '1', let us know. There are easy ways to knock-down the signal with a couple of resistors or a potentimeter (volume control) on the Arduino's output. And I was also wondering if sending a tone to the amplifier would be the same as sending a tone to a peizo speaker. Yes... But LOUDER, and of course the guitar speaker can reproduce low-frequency tones that the piezo cannot. What would your guitar sound like played throught the piezo?  The pitch will be the same (at frequencies the piezo can produce) but the tone/character will be different. BTW - Be very careful with high-frequency tones... Say above 10kHz... You can end-up generating lots of power that the speaker can't reproduce well, and perhaps above your hearing range. So the amp could be generting lots of power without you being aware of it. Guitar amps are usually rugged and it will probably survive, but it's something to avoid. For the similar reasons, be careful running "test tones" into a high-power hi-fi system. You can burn-out almost any tweeter with a constant 100W 20kHz test tone. And, because our hearing is weak at 20kHz (if we can hear that high at all), you might not be aware of what's going on 'till it's too late.
|
|
|
|
|
570
|
Using Arduino / Audio / Re: Line Level
|
on: April 30, 2012, 02:22:38 pm
|
The key word here is around  I get just under 1V peak (~.7V RMS) from my laptop's headphone output, and about 2V peak (~1.4V RMS) from my CD player's line-out. And of course, the voltage is only constant with test-tones... With music or voice, the voltage jumps all over the place! The "line-level" signal going to a power amp (to a speaker) is usually volume-controlled, and unless you are listening at full-volume, it can be 1/10th or 1/100th of what Wikipedia lists, depending on the gain of your power amp and depending on how loud you are listening. I was gonna just adjust the volume in software to reduce the voltage, but I decided I'd get better sound quality with a voltage divider and it would also allow me to connect both a speaker and amp to the board at the same time without sacrificing volume on the speaker. I recommend an analog volume control (i.e. a potentiometer = a "pot"). One advantage is that, with the volume turned-down, you are less-likely to get an accidenal-unpleasant "blast". In theory, you loose quality either way, but you shouldn't notice the quality loss, because it's happening at low levels. You should only notice the quality loss if you re-boost the volume. With analog, you lose signal-to-noise ratio, and with digital, you loose bits of resolution. The differential (AKA "bridged") output means that you don't need output capacitors. It also means that you can't use stereo headphones, which require a common ground, shared by left & right. Fig 30 on the datasheet shows you how to make a single-ended input. If you need a DC blocking capacitor, there is information on page 16 for calculating the correct value. If your capacitor is too small (not enough uF) the bass will be reduced. You can generally use a higher-value (More uF) capacitor than you calculate with no trouble. As you may know, the capacitive reactance (impedance) of a capacitor depends on frequency (and capacitor value). For a series (DC blocking) capacitor, you'd like capacitive reactance to be less than the amplifier's input impedance, or less than the the speaker impedance on the ouptut.
|
|
|
|
|