Want to learn Arduino programming

Don't want to see this ad? Sign up for anRPF Premium Membershiptoday. Support the community. Stop the ads.


mluder

Well-Known Member
RPF PREMIUM MEMBER
I recommend buying a starter set with many different components. For example, from Elegoo you get the "most complete starter kit" for around 50$, which has an Arduino Uno, a USB cable to connect it, a breadboard, jumper wires, LEDs and resistors, as well as many different sensors, buttons etc. The "tutorials" which come with it are really bad and you should not work with them, and you will probably pay a bit more than if you bought everything on your own, tailored to your wishes. But the big advantage is that you get everything you need for your first steps, and have lots of possibilities right in front of you.

My own experience is that when starting to learn something technical, nothing is more tiring than waiting for more necessary parts which you forgot to buy. If programming is new for you, at least rely on someone else to give you a good starting point for the hardware.

I bought one of these kits from Amazon. I've yet to break into it yet. It seems like a good way to go as you get quite a bit and it's not very expensive.

Cheer
Steve
 

Don't want to see this ad? Sign up for anRPF Premium Membershiptoday. Support the community. Stop the ads.

Analyzer

Sr Member
So as a birthday gift I got an Arduino starter kit (with the UNO) and two Arduino Nano's

I've kind of browsed over a few things but am looking to start a lighting project for some flicker effects and runway sequence as well as slow blinking

i.e. I am hoping to get some lighting effects for some Space Battleship Yamato stuff

Would you use the Nano or the Uno? or does it not really make a difference.

All the LEDs I have run from 2.0 to 2.2 or 3.0 to 3.2 volts and are 20 mA
 

xl97

Master Member
Technically.. there is no difference (per se`) between thew UNO & NANO..

just 'form factor/footprint'....

The UNO is easier to prototype.. but the Nano can be throw into a project and left forever...

My suggestion is to ALWAYS prototype with the UNO and a breadboard.. when you are happy with your 'code' port things over to the NANO.. for you final design/use.

They are normal 'accent' LEDS..

and they run from +1.8v(ish) to +3.3v(ish)... some colors (like red) are always lower forward voltage.. and you need to have the appropriate resistor as well
*(for ALL your leds you should have a current limiting resistor)

When you get a little more comfortable with things.. you may want to look into using NEOPIXELS (WS2812) leds.. as these are individually addressable..

Meaning you can target a specific LED and set a specific color/state for it.

I'd buy some assorted resistor and capacitor packs off ebay as well... (you'll need them)

Start of with the BLINK example sketch in the IDE... then study the BLINK WITHOUT DELAY example.. as THIS is -key- and crucial to better/proper/more advanced coding. And will save you MUCH time than learning a bad habit.

From there look at FADING examples using one of the PWM enabled pins (3, 5, 6, 9, 10 and 11 pins)

Tons of examples out there.. post back with any questions if get stuck! :)
 

Analyzer

Sr Member
Good to know, I had planned on using the UNO started kit for proto-typing and had asked for the 2 Nano to put into kits so that works out perfect.

For the LEDs, these are the ones I picked up

51f5-PVMglL._SL1001_.jpg

  • DiCUNO 3MM bi pin LED diodes. Super bright and high quality.
  • LED Color: Transparent; Light Color: White/Red/Yellow/Green/Blue/Orange/Pink/UV/Chartreuse/Warm White
  • Forward Voltage: R/Y/O/C 2.0-2.2V, W/G/B/P/UV/WW 3.0-3.2V; Current: 20mA; Beam Angle: 30°
I like that they had the pink and light yellowish green as well as the regular yellow and warm white

When you mention "you may want to look into using NEOPIXELS (WS2812) leds.. as these are individually addressable..Meaning you can target a specific LED and set a specific color/state for it. "

can you elaborate a bit more on that?

Does that mean I could for instance have an LED that might start with a bit of a reddish orange color "power up" to a bright white (think wave motion gun effect)?
 

Analyzer

Sr Member
...oh, and should it be one resistor per LED dropping voltage from 5 volts assuming board powers the pins with 5 volts? or do I drop down from 9 volts the power source for the Arduino?
 

Don't want to see this ad? Sign up for anRPF Premium Membershiptoday. Support the community. Stop the ads.

xl97

Master Member
1.) You should never use those square/rectangle +9v batteries.. they suck. (notoriously known for lack of current)
only when you need to.. I mean they arent gonna blow anything up.. but most likely wont last long. (power through USB when testing)

2.) Yes.. if the Arduino you using is a +5v based version.. then most likely you will just calculate the resistance for +5v. ** There are +3.3v versions out there of Pro-Minis.. Nanos too maybe? other variants as well **

* So if you had the 'accent led' (like yours above) you would probably have one leg (GND) in the GND I/O pin or breadboard rail.. and the other leg (V+) in the I/O pin on the Arduino you want to use to control it.. so you would a resistor on one side of the connection. (I dont believe it matters what side)

Then whenever you turn that I/O pin on, on the Arduino HIGH, the LED will turn on.

Since you are *powering it from the Arduino it self, you would use that to calculate the resistor value.

* The Arduino has very low limits on what it can 'power/drive' directly from itself.

Each I/O pin on the board can only output a MAX of 40mA (some say 20mA)..

With I think a 'combined' current output of 200mA (or close)

So really your small accent leds are really the only thing an Arduino can directly power (and other small current need devices of course..but most modules/chips exceed this limit)


--------------

Neopixels:

You are more or less correct. They are (can be) RGB leds (you really should google this term to get a visual aid on all the things people do with them).. that usually are in a strip, but can be purchased individually, as well as in other patterns/layouts (rings/stars/sticks...etc) each of these leds can be its own color and brightness.. so you can fade from white to red to green to purple....rainbow...whatever you can code it do.

If you using more than a few, you would need to power them externally, like from the battery source itself.. or something (they have a STRICT requirement of +5v).. but usually need way more current than an Arduino pin can provide.

The key element here is that can be 'daisy chained' together.. with the Arduino only using 1 I/O pin to control, 1-1000's of LEDs..


All the same 'kit' (effect).. but shows a fire effect you can do..




Another Arduino based project: (just a fun general project, that is Arduino based)
 

Analyzer

Sr Member
If you using more than a few, you would need to power them externally, like from the battery source itself.. or something (they have a STRICT requirement of +5v).. but usually need way more current than an Arduino pin can provide.

The key element here is that can be 'daisy chained' together.. with the Arduino only using 1 I/O pin to control, 1-1000's of LEDs..

That's the part I have not quite wrapped my head around. using Arduino to control it, but being powered externally. I guess as I work through some of the sample projects that might get clearer on how that looks wired up

...as far as the 9 volt batteries, I remember reading something about the rechargeable ones only having something like 7.5 volts.

Currently when wiring stuff up in basic LED with resistor fashion, I often use them as a quick light up tests, but for my models I prefer connecting them to regulated adapters. Like you mentioned, I believed the batteries typically won't last long under that draw if I have more than few LEDs
 

xl97

Master Member
RE: 9v batteris.. voltage != current

a 9v battery.. will provide 9v (for most of its life)..

but its current is very low.. and drains quickly.

you get smaller and far more efficient batteries.. like 18650 li-ion batteries or something.. or smaller 10440? (dont recall the size exactly)


powering things is always tricky...

1.) most components need a regulated voltage.. (like +5v or +3.3v..etc)..

Most battery packs do NOT come in those voltages.. so yo need to 'regulate' the voltage..

Depending on the type of voltage regulator you use.. it might jst 'chop' the voltage down..

ie: 12v battery pack.. being regulated down to +5v.. thats 7 volts being 'chopped off'.. which just gets burned off as heat. (not good)..

So you want your battery pack as close to you working voltage as you get can get.. or perhaps use a switching regulator.


Anyways...


"That's the part I have not quite wrapped my head around. using Arduino to control it, but being powered externally. "

This really depends on the situation and components used..

ie: Neopixels..

they get V+ & GND from the +5v regulated power source

The GND wires are all connected.. (Battery GND + Neopixel GND + Arduino GND.. all tied together).. but +V comes from the battery pack.. and NOT one of the I/O pins on the Arduino board... (nor from the +5v pin on the Arduino either.. as they usually can not supply enough current)

but there is a '3rd' wire from the Neopixel to the Arduino.. that is used to send data to the Neopixels.. so they know how to behave/act...etc

Another Scenario:
But if you were using say... a 3W high powered LED star type LED... the 3W led would be powered by the external battery source.. but then you would use a transistor/mosfet as a 'switch'.. to control how/when that power is applied to the LED..


If you stick with it.. in a few months.. you will be done fun projects!.. and this will open a whole new door for you (you will never turn back!) LOL

Small led stuff now.. but but full props next.. then home automation...etc..etc.. :)
 

Analyzer

Sr Member
they get V+ & GND from the +5v regulated power source

The GND wires are all connected.. (Battery GND + Neopixel GND + Arduino GND.. all tied together).. but +V comes from the battery pack.. and NOT one of the I/O pins on the Arduino board... (nor from the +5v pin on the Arduino either.. as they usually can not supply enough current)

but there is a '3rd' wire from the Neopixel to the Arduino.. that is used to send data to the Neopixels.. so they know how to behave/act...etc

Thanks for that! I get it now
 

Analyzer

Sr Member
1.) most components need a regulated voltage.. (like +5v or +3.3v..etc)..

Most battery packs do NOT come in those voltages.. so yo need to 'regulate' the voltage..

Depending on the type of voltage regulator you use.. it might jst 'chop' the voltage down..

ie: 12v battery pack.. being regulated down to +5v.. thats 7 volts being 'chopped off'.. which just gets burned off as heat. (not good)..

So you want your battery pack as close to you working voltage as you get can get.. or perhaps use a switching regulator.

I learned with many of those "plug n play LEDs" that they can get kind of hot (especially the lower voltage ones like red compared to the bright whites. Not hot enough to melt anything, but it obvious they waste a lot of power.
 

Don't want to see this ad? Sign up for anRPF Premium Membershiptoday. Support the community. Stop the ads.

xl97

Master Member
You need to have resistors and the correct value for each LED.

RED led -usually- run at a lower voltage.. so a different resistor value.
 

Don't want to see this ad? Sign up for anRPF Premium Membershiptoday. Support the community. Stop the ads.

Top