Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
v1nce
Sep 19, 2004

Plant your brassicas in may and cover them in mulch.
To be honest, the problem was more born out of the dependency management issue than the cross-platform stuff PlatformIO gives me. Every setup I found that enabled some dependency control meant that libs were in a specific location, so you were then tied to a particular compiler or IDE.

I don't actually need cross-hardware support - I'll probably only write code that targets specific hardware and it's going to be dogshit simple, but I do want people to be able to run this stuff on both Windows and Linux without spending a half-day trying to figure out exactly what arrangement of paths and libraries they're supposed to use. It would just be a bonus if people could rewrite my code so it works on multiple devices.

The bit that gets me is this really doesn't feel specialized - I literally have a couple of dependencies, and I just want to have tidy way of managing them. Like, a couple of INI files or whatever, and say "run this with X" and they an be up and running as easily as possible.

I really feel like I'm missing something important because, as far as I can see, there ain't no way to do it.

Adbot
ADBOT LOVES YOU

JawnV6
Jul 4, 2004

So hot ...
With the easy availability of vm's I don't follow why you care what OS your compilation happens on. Frankly you'll have more trouble gluing JTAG and gdb together, after you get the flashing tool working of course, than any dependency management on your way to the cross platform dream.

mod sassinator
Dec 13, 2006
I came here to Kick Ass and Chew Bubblegum,
and I'm All out of Ass
I think you're overthinking the Arduino IDE too much. Grab the latest 1.6.x IDE and use its library manager to search for and install any libraries you need: https://www.arduino.cc/en/Guide/Libraries#toc3 All of the major libraries are available and a one click install from the manager--no need to mess with copying them to a special path, etc. Yeah dependency management would be nice and from what I understand is something Arduino folks are thinking about (you can see chatter about it on their development mailing list), but most sketches only depend on one or two libraries at most.

v1nce
Sep 19, 2004

Plant your brassicas in may and cover them in mulch.

JawnV6 posted:

With the easy availability of vm's I don't follow why you care what OS your compilation happens on. Frankly you'll have more trouble gluing JTAG and gdb together, after you get the flashing tool working of course, than any dependency management on your way to the cross platform dream.

Again, wasn't really about the compiling, it was more that dep management was tied to an IDE or compiler.

mod sassinator posted:

I think you're overthinking the Arduino IDE too much. Grab the latest 1.6.x IDE and use its library manager to search for and install any libraries you need: https://www.arduino.cc/en/Guide/Libraries#toc3 All of the major libraries are available and a one click install from the manager--no need to mess with copying them to a special path, etc. Yeah dependency management would be nice and from what I understand is something Arduino folks are thinking about (you can see chatter about it on their development mailing list), but most sketches only depend on one or two libraries at most.

I actually hadn't see the library manager in the Arduino IDE. That's a good start, but doesn't that mean you end up using a particular version of the library across ALL your projects (one library home per machine with the Arduino IDE)? And people still have to hunt down and fetch the appropriate library and version they need whenever they switch project? That's not exactly a friendly workflow.

You're right that I am over-thinking it, and it's definitely because I'm from web-land and sorely missing some of my tools. For now I guess I'll stick with abusing Composer for the sheer convenience (easy to use, not tied to an IDE, works for now), but I'm still open to suggestions.

Parts Kit
Jun 9, 2006

durr
i have a hole in my head
durr
Having some trouble with a simple Trinket program. Basically there are two analog inputs, one from a piezo, the other from a 10k pot. The program just measures across the pot and then compares the measurement from the piezo. If the piezo exceeds the 3.3v across the pot then it turns a digital pin to HIGH for a fraction of a second.

I think part of my problem here is the output from the piezo is just too wimpy in the first place without amplification, but when I hardcode a value for sensitivity instead of having the Trinket read across the 10k pot to determine the sensitivity value it works okay. When the loop is running both analogIns for some reason it just doesn't work worth poo poo. Even cranking the pot all the way so the sensitivity result should be minimal doesn't do much. But at the same time to prevent a floating input I was using a 300ish ohm resistor on the breadboard (where things work so-so) and bumped it up to 10k on the prototype board. I'm guess that sure as poo poo isn't helping.

mod sassinator
Dec 13, 2006
I came here to Kick Ass and Chew Bubblegum,
and I'm All out of Ass
What if you remove the piezo and hook up a FTDI cable to do serial output from the Trinket so you can read what value it's getting from the pot? Use the SoftwareSerial class and have its TX pin setup to the same pin connected to the FTDI cable's RX pin (the SoftwareSerial RX doesn't matter since you won't be sending data to the Trinket). Check out the guide here for a little more info: https://learn.adafruit.com/serial-debugging-with-gemma/overview (the Gemma chip uses the same ATTiny85 as the Trinket) If you can see the value being read by the ADC it should help you debug what's up with the value your program is getting.

goodness
Jan 3, 2012

When the light turns green, you go. When the light turns red, you stop. But what do you do when the light turns blue with orange and lavender spots?
http://www.adafruit.com/products/68

This seems like a pretty good package and price, any reason why it would not be a good choice? I will also need to get any tools required.

Jamsta
Dec 16, 2006

Oh you want some too? Fuck you!

goodness posted:

http://www.adafruit.com/products/68

This seems like a pretty good package and price, any reason why it would not be a good choice? I will also need to get any tools required.

You'll get more for your money with:

http://www.ebay.com/itm/New-Ultimate-UNO-R3-Starter-Kit-for-Arduino-1602-LCD-Servo-Motor-Relay-RTC-LED-/221451495178?hash=item338f89a70a
(you'll need to use your own 12v PSU or USB cable for power)

The knock off Arduinos are better for first timers as they're cheaper to replace when they burn out due to you connecting the wrong pin to something.

Aurium
Oct 10, 2010

Jamsta posted:

You'll get more for your money with:

http://www.ebay.com/itm/New-Ultimate-UNO-R3-Starter-Kit-for-Arduino-1602-LCD-Servo-Motor-Relay-RTC-LED-/221451495178?hash=item338f89a70a
(you'll need to use your own 12v PSU or USB cable for power)

The knock off Arduinos are better for first timers as they're cheaper to replace when they burn out due to you connecting the wrong pin to something.

I don't really agree. You have a much worse chance of getting bad or knockoff parts with the clones. As a beginner you might also accidentally buy a pre uno model, and then wonder why you can't do some of the interesting usb stuff if you get into that, or just get a terrible usb bridge. That one isn't socketed either, you can buy preburnt 328's for cheap, or learn to program them yourself (with the arduino you already have) for even cheaper.

Jamsta
Dec 16, 2006

Oh you want some too? Fuck you!

Aurium posted:

I don't really agree. You have a much worse chance of getting bad or knockoff parts with the clones. As a beginner you might also accidentally buy a pre uno model, and then wonder why you can't do some of the interesting usb stuff if you get into that, or just get a terrible usb bridge. That one isn't socketed either, you can buy preburnt 328's for cheap, or learn to program them yourself (with the arduino you already have) for even cheaper.

I've bought 10+ clones and only had one which has played up on me. YMMV

goodness
Jan 3, 2012

When the light turns green, you go. When the light turns red, you stop. But what do you do when the light turns blue with orange and lavender spots?

Aurium posted:

I don't really agree. You have a much worse chance of getting bad or knockoff parts with the clones. As a beginner you might also accidentally buy a pre uno model, and then wonder why you can't do some of the interesting usb stuff if you get into that, or just get a terrible usb bridge. That one isn't socketed either, you can buy preburnt 328's for cheap, or learn to program them yourself (with the arduino you already have) for even cheaper.

Do you have a good starter kit you can recommend?

http://www.seeedstudio.com/depot/ARDX-The-starter-kit-for-Arduino-p-1153.html is the other I was looking at.

VelociBacon
Dec 8, 2009

goodness posted:

Do you have a good starter kit you can recommend?

http://www.seeedstudio.com/depot/ARDX-The-starter-kit-for-Arduino-p-1153.html is the other I was looking at.

I have that one and recommend it.

goodness
Jan 3, 2012

When the light turns green, you go. When the light turns red, you stop. But what do you do when the light turns blue with orange and lavender spots?

VelociBacon posted:

I have that one and recommend it.

What did you need to buy, tool and supply wise, to use the kit?

JawnV6
Jul 4, 2004

So hot ...

Jamsta posted:

I've bought 10+ clones and only had one which has played up on me. YMMV

At my old job I watched 3 ME interns lose a couple weeks to a bad clone, partly because their diagnostic capabilities weren't great. I wouldn't recommend a cheap clone to someone who can't tell a bad one.

VelociBacon
Dec 8, 2009

goodness posted:

What did you need to buy, tool and supply wise, to use the kit?

Nothing, that's why the kit is so good IMO. You need a computer obviously.

e: It's a 'real' arduino in the kit as well.

VelociBacon fucked around with this message at 20:46 on Aug 7, 2015

Jamsta
Dec 16, 2006

Oh you want some too? Fuck you!

I don't want to come across as hell bent on going for clones, I treat cheap Chinese components with the contempt and distrust they deserve.

Having said that, we've not asked Goodness a few questions:

* Is it casual tinkering and learning of electronics, curricular learning, or business work?
* Are you well off?

If you're well off and/or doing anything over casual tinkering - go for the branded quality gear.

If it's casual learning for fun, I'd stick with my recommendation of cheap Chinese stuff as your money goes further despite hitting occasional quality control issues.

Again, only my opinion; it worked out ok for me - your mileage may vary. :)

mod sassinator
Dec 13, 2006
I came here to Kick Ass and Chew Bubblegum,
and I'm All out of Ass
You don't have to get an Uno, Adafruit has the Metro (https://www.adafruit.com/products/2488?gclid=CISM66vdl8cCFYhcfgod98oBrw) and SFE the red board (https://www.sparkfun.com/products/12757). Both are exactly the same as the Uno but a few bucks less expensive. They're not a $5-10 clone but they aren't exactly expensive either at $20.

goodness
Jan 3, 2012

When the light turns green, you go. When the light turns red, you stop. But what do you do when the light turns blue with orange and lavender spots?

Jamsta posted:

I don't want to come across as hell bent on going for clones, I treat cheap Chinese components with the contempt and distrust they deserve.

Having said that, we've not asked Goodness a few questions:

* Is it casual tinkering and learning of electronics, curricular learning, or business work?
* Are you well off?

If you're well off and/or doing anything over casual tinkering - go for the branded quality gear.

If it's casual learning for fun, I'd stick with my recommendation of cheap Chinese stuff as your money goes further despite hitting occasional quality control issues.

Again, only my opinion; it worked out ok for me - your mileage may vary. :)

Thanks for asking! I got interested in this through looking at ways to incorporate code/electronics into some of my hobbies. Mainly it would be used to monitor hydroponic set ups for watering plants/monitoring nutrients etc.

The difference between 60-100 for a good kit is not that much of an issue. But if that China kit just has a ton of stuff in it to practice with that might be useful.

Jamsta
Dec 16, 2006

Oh you want some too? Fuck you!

goodness posted:

Thanks for asking! I got interested in this through looking at ways to incorporate code/electronics into some of my hobbies. Mainly it would be used to monitor hydroponic set ups for watering plants/monitoring nutrients etc.

The difference between 60-100 for a good kit is not that much of an issue. But if that China kit just has a ton of stuff in it to practice with that might be useful.

Ah Hydro, I do have experience with that. Are using NFT, DWC/Aero or something else?

Either way - definitely plump for the quality gear, especially the mechanical pump controls/monitors/valves.

If you're using NFT and your water pumps/jets fail it's only a matter of time before you get root damage or crops drying out.

Feel free to buy some additional Arduino clones for test bedding. They cost $2-4 for Nano & Uno clones - ideal for prototyping while you have your quality branded Arduino for the main setup.

goodness
Jan 3, 2012

When the light turns green, you go. When the light turns red, you stop. But what do you do when the light turns blue with orange and lavender spots?

Jamsta posted:

Ah Hydro, I do have experience with that. Are using NFT, DWC/Aero or something else?

Either way - definitely plump for the quality gear, especially the mechanical pump controls/monitors/valves.

If you're using NFT and your water pumps/jets fail it's only a matter of time before you get root damage or crops drying out.

Feel free to buy some additional Arduino clones for test bedding. They cost $2-4 for Nano & Uno clones - ideal for prototyping while you have your quality branded Arduino for the main setup.

Planning on using DWC once it is set up. I do want to start learning all the basics of electronics and a little python before then. And just play with all the other cool things it looks like you can do with Arduino. Control some lights, etc.

Jamsta
Dec 16, 2006

Oh you want some too? Fuck you!

goodness posted:

Planning on using DWC once it is set up. I do want to start learning all the basics of electronics and a little python before then. And just play with all the other cool things it looks like you can do with Arduino. Control some lights, etc.

If you're new to electronics, hydro is a tough place to start - unforgiving.

When you get a starter pack, make sure you work on the basics first (turning stuff off/on, reading sensors, basic control loop programming).

Mains lighting control is technically the easiest thing to do (large AC relay, with opto isolator doing the DC/AC switching), but the mains side is dangerous so you run the risk of killing yourself if you gently caress up.

Pump/sensor reading is harder technically to do, but is low voltage DC and much safer to work with.

Jamsta fucked around with this message at 22:03 on Aug 7, 2015

poeticoddity
Jan 14, 2007
"How nice - to feel nothing and still get full credit for being alive." - Kurt Vonnegut Jr. - Slaughterhouse Five

goodness posted:

Planning on using DWC once it is set up. I do want to start learning all the basics of electronics and a little python before then. And just play with all the other cool things it looks like you can do with Arduino. Control some lights, etc.

ARDX makes some pretty nice little kits (my first Arduino kit was from them, so I wouldn't knock it) but here's something else to consider:

http://www.amazon.com/gp/product/B00CBDUD60?colid=33L5J5O9G4K2J&coliid=I1EX3LFZSEM6O5&psc=1&ref_=wl_it_dp_o_pC_nS_ttl This is almost certainly filled to the gills with Chinese knock-offs of sparkfun and other companies breadboard-friendly peripherals, but it's got several things that you'd probably want to be familiar with if you're interested in hydro (most notably: humidity, temperature, a relay, gas sensor, photo sensor and photo interruptor [good for ensuring high-intensity light sources are turned off if you're growing in sealed or semi-sealed environments]). I can't speak to the quality, personally, but it's got good reviews.

If you're specifically looking to learn python, that same company has a Raspi peripherial set you might be interested in.

goodness
Jan 3, 2012

When the light turns green, you go. When the light turns red, you stop. But what do you do when the light turns blue with orange and lavender spots?

poeticoddity posted:

ARDX makes some pretty nice little kits (my first Arduino kit was from them, so I wouldn't knock it) but here's something else to consider:

http://www.amazon.com/gp/product/B00CBDUD60?colid=33L5J5O9G4K2J&coliid=I1EX3LFZSEM6O5&psc=1&ref_=wl_it_dp_o_pC_nS_ttl This is almost certainly filled to the gills with Chinese knock-offs of sparkfun and other companies breadboard-friendly peripherals, but it's got several things that you'd probably want to be familiar with if you're interested in hydro (most notably: humidity, temperature, a relay, gas sensor, photo sensor and photo interruptor [good for ensuring high-intensity light sources are turned off if you're growing in sealed or semi-sealed environments]). I can't speak to the quality, personally, but it's got good reviews.

If you're specifically looking to learn python, that same company has a Raspi peripherial set you might be interested in.

That kit has a ton of stuff and pretty good reviews, only negative is no documentation but that is what google is for.

I am starting fresh on all this code and electronic stuff. Python seems like the ideal language for new people to it. What is the difference between the Raspi and Ardi in what they are used for?

Parts Kit
Jun 9, 2006

durr
i have a hole in my head
durr

mod sassinator posted:

What if you remove the piezo and hook up a FTDI cable to do serial output from the Trinket so you can read what value it's getting from the pot? Use the SoftwareSerial class and have its TX pin setup to the same pin connected to the FTDI cable's RX pin (the SoftwareSerial RX doesn't matter since you won't be sending data to the Trinket). Check out the guide here for a little more info: https://learn.adafruit.com/serial-debugging-with-gemma/overview (the Gemma chip uses the same ATTiny85 as the Trinket) If you can see the value being read by the ADC it should help you debug what's up with the value your program is getting.
I was under the impression the non-pro Trinkets could not be monitored by the serial port?

I do have an UNO handy, so I could just do the minor tweak and use that.

mod sassinator
Dec 13, 2006
I came here to Kick Ass and Chew Bubblegum,
and I'm All out of Ass

Parts Kit posted:

I was under the impression the non-pro Trinkets could not be monitored by the serial port?

I do have an UNO handy, so I could just do the minor tweak and use that.

You can't use the Serial class in your code and get any debug output from its USB connection, but you can turn pins into a software serial controlled UART and read/write to it using an FTDI cable. Instead of using the Serial class to read/write from your sketch you use a SoftwareSerial object that you create and tell which pins to use. Check out the guide they have on it: https://learn.adafruit.com/serial-debugging-with-gemma/overview (Gemma is the same as Trinket)

Parts Kit
Jun 9, 2006

durr
i have a hole in my head
durr
Okay, redid it with the UNO so I could use the serial monitor. At least part of what is going on is as the 10k pot connected to A2 for the sensitivity measurement is adjusted, the value of A1 (the piezo) fluctuates. So when the 10k pot is turned to a higher resistance and the measured value over A2 drops, so is A1 for some reason.

The 10k pot is only connected to +5, A2, and a 200 ohm resistor to ground. The piezo is connected to ground and a small set of schotcky diodes, a 103 ceramic cap, and then to a 200 ohm resistor which splits off to A1 and a 5.1v Zener diode to ground to make sure the voltage spikes from the piezo don't get absurd.

edit: reviewed the page on conditioning piezo outputs and the issue is I donked the circuit the gently caress up by trying to do it from memory. :ughh:

mod sassinator posted:

You can't use the Serial class in your code and get any debug output from its USB connection, but you can turn pins into a software serial controlled UART and read/write to it using an FTDI cable. Instead of using the Serial class to read/write from your sketch you use a SoftwareSerial object that you create and tell which pins to use. Check out the guide they have on it: https://learn.adafruit.com/serial-debugging-with-gemma/overview (Gemma is the same as Trinket)
Ah, okay.

Parts Kit fucked around with this message at 05:00 on Aug 8, 2015

poeticoddity
Jan 14, 2007
"How nice - to feel nothing and still get full credit for being alive." - Kurt Vonnegut Jr. - Slaughterhouse Five

goodness posted:

That kit has a ton of stuff and pretty good reviews, only negative is no documentation but that is what google is for.

I am starting fresh on all this code and electronic stuff. Python seems like the ideal language for new people to it. What is the difference between the Raspi and Ardi in what they are used for?

Arduino is a development platform centered around the Arduino language (which is basically C++ with a set of default libraries) and the Arduino board (which, in most variants, is an AVR microcontroller in a breadboard friendly device that includes a chip designed to allow serial over USB and quick programming.

The Raspberry Pi platform is an ARM processor capable of running a full operating system (there are several options, most of which are Linux) with a few pins broken out for general purpose I/O, but a lot of standard computer connectors (e.g. USB, Ethernet, HDMI, etc.). You can hook up a monitor, keyboard, and mouse and get onto the internet and run a variety of programs.

Micocontrollers are generally intended for a pre-specified series of tasks, and to deviate from this, the entire thing would have to be reprogrammed. A standard home microwave, for example, most likely has a microcontroller inside because it's not intended to change in functionality. In contrast, an ARM processor is generally used where you plan on actually running multiple programs or require some sort of advanced functionality (like internet connectivity, periodic updates, monitor output, etc.).

Arduinos are most commonly available in either a 5V or 3.3V configuration, while the Raspberry Pis are all 3.3V (to my knowledge). If you want to run 5V components on a Raspi ,you'll generally need a level converter. If you want to make a bunch of copies of something small and simple, Arduino is definitely the way to go (because you can develop something on an Arduino and then later build a minimal . If you know you want to do something computationally intensive or continuously change things, a Raspi may be a better choice.

For a DWC system, if you're not looking for something like a bunch of data logging or the ability to remotely monitor it, I'd go with an Arduino because you'll probably have an easier time getting it to work with sensors for pH and whatnot. (You can do data logging on an Arduino, but it either needs to be attached to a computer constantly or have something like an SD card attached to it.) If you're more comfortable with Python, it's a lot easier to develop for a Raspi with Python than an Arduino. They're different tools for different applications, but they can be used for a lot of similar applications and both have complementary strengths and weaknesses.

rawrr
Jul 28, 2007
As someone that got into screwing around with Arduino a couple months ago (with no prior electronics knowledge, but some programming background), I feel like the kits can be a waste of money if you already have specific ideas on things you want to do.

If I were to do it again, I'd look up a tutorial on a specific project I wanted to do, then buy the parts for it and follow it - if you're interested in hydroponic stuff there's really not much reason to mess around with leds, led matrices, servos and stuff like that that most beginner kits will come with. I wanted to learn PID temperature control and switching stuff with SSRs, so I ended up not using pretty much anything that came with my kit aside from the breadboard and hookup wires.

I also like the arduino nanos you can buy off eBay for like $3 shipped - the headers will plug directly into a breadboard, and it makes prototyping a lot less messy than using an uno board:

Bad Munki
Nov 4, 2008

We're all mad here.


Does anyone know if the CapacitiveSensor library works with those cheap little wifi modules that people have been making into actual arduinos? I forget what they are, esp2866 or something?

VelociBacon
Dec 8, 2009

Aurium posted:

As long as your foward voltage is less than 2.5V, you could series 2 of them and be fine. You'd have a smaller resistor than you would otherwise, but overall current would still the same 20ma. If you paralleled individual led/resistor pairs you'd have the 40ma you're thinking of.

You could potentially even run 3 IR leds in series where a voltage drop of 1.2 is pretty typical. (5/3 = 1.6v > 1.2V).


First, a summery, parallel sets of series led resistor pairs, and if you want to mess around more with values This is an incredibly good led calculator. The rest of this is the why, I tried to make it easy to follow with examples, so it ended up being long.

As described, it would never actually work. The arduino would be in no danger, but the leds would never actually turn on. LEDs have a voltage drop over them. A typical Red led is ~1.8 v, and it goes up from there, green is about 2, blue and white are around 3.6. That means that for a red led to turn on it needs to see at least 1.8 v across it.

If you put leds in series you add the voltage drop, so you'd need to put at least 18v across a chain of 10 red leds. But they would all see the same current. So the total consumption would be 20ma.

To power them all with less than 18v you'd have to put them in some kind of parallel configuration. The trivial example would be all of them parallel on a 1.8v source. As each of them would see the same 1.8v, they'd all light up, taking 20ma each. For a total current out of your power source of 200ma.

Note that the power is the same here. 18 * 20 = 1.8*200.*

A voltage source that is fixed at 5v (such as an arduino) means that it can only support 2 red leds in series. 2*1.8 is 3.6v. 3*1.8 is 5.4v.


*Unfortunately this only works with ideal diodes, and perfectly controlled voltage sources. In the real world, we don't have either. You either need a resistor (even do something like use an regulator to get 3.6v for your 3.6v led, it'll develop problems) or a current source. Note also that when you use a resistor it uses power too, because of that your power of doing it different ways is no longer equal.

For 2 diodes, with a 5v source, 1.8v drop, and 20ma. I can either parallel 2 180ohm resistor led sets**, for a total power of 216mW.
I could also series 2 leds, and a 82ohm resistor for a total power of 104.8 mW. That's less than half the used power, for the exact same amount of light.

You might think that this means series leds are the clear winner. What it actually comes down to is your power budget(can you support the additional 100mw?) your heat budget (100mw of heat isn't usually a problem) your price budget( a few more resistors are incredibly cheap) and your effort budget (you solder alot less with series, but you also have to do the calculations every time, and find the exact right resistor for every string). Lastly for longer strings you need to make sure you have a high enough voltage to run it. I typically find it easier to just have a resistor and a led value that I know works.

This is still an incredibly good led calculator.

**don't get clever and try to share 1 resistor with 2 parallel leds. It would work with ideal diodes. Ideal diodes don't exist, and the ones we have don't share current evenly, which means that you're setting yourself up for potential failure.

Took some time to really get into this and start looking at some solutions. I'm struggling to figure out whether I should be picking up a power supply of some form, or using a battery. I'm leaning towards the latter because this is going to be an art piece that isn't going to need to stay on for a long time but if there is a better way to go about this I'm all ears.

Just looking at using a 9v battery that would be controlled via transistor with an arduino, I used that link and with a vdrop of ~2.1v for the LED's I'd be using (20ma):



A 9v alkaline battery with capacity of 550mah would last around 2-2.5hrs with a draw of 200ma. Is this correct?

Another thing - this thing is going to be a bitch to wire and if I can use a higher voltage and put more LED's in series I'll be doing myself a huge favor. Maybe that's the incentive for a power supply.

Dylan16807
May 12, 2010
9v batteries drop very quickly, because they're 6 cells in series. Since you're pulling a somewhat large current you might not even be able to rely on the battery staying over 7 volts. Which means that getting even half-stable brightness will require you to put only two LEDs on each resistor, and waste a lot of power.

Your life will be much easier with a regulator.

SybilVimes
Oct 29, 2011
if you have that many LEDs, use an LED driver/controller, it's that simple, it'll get rid of all the headache

SybilVimes fucked around with this message at 12:09 on Aug 9, 2015

Aurium
Oct 10, 2010

VelociBacon posted:

A 9v alkaline battery with capacity of 550mah would last around 2-2.5hrs with a draw of 200ma. Is this correct?

Another thing - this thing is going to be a bitch to wire and if I can use a higher voltage and put more LED's in series I'll be doing myself a huge favor. Maybe that's the incentive for a power supply.

In a perfect world, yes you're correct.

In ours, not so much. 9v batteries are pretty terrible at delivering high current, so they'll empty much faster. Around 75ma is a ok upper limit for good useability. They were originally designed around loads of ~15ma or less.

Under heavy load it'll quickly drop voltage, and go below what the LED's need. I couldn't tell you how fast, but it probably won't last an hour. Insert graph here. It's not a great graph, because it does show the 2 hours that you'd expect, but it also has arrows for where you'd expect different voltages, and they'd be way below what you'd need.

Have you considered something like this? LED light strip It'd need 12v, and they're in pretty much all colors. It could make your fabrication much easier.

SoundMonkey
Apr 22, 2006

I just push buttons.


Honestly 9V batteries are almost never the solution to anything unless it's something that will draw almost literally no power and you don't mind replacing them frequently. (Source: the cheap wireless mics at work take 9Vs and last about 4-6 hours. The expensive ones take 2 x AA, use a boost converter, and last 18-20 hours.)

Heck, you'd be better off with a really small SLA at that point, at least it'd stand a chance of lasting more than a few hours.

SoundMonkey fucked around with this message at 23:04 on Aug 9, 2015

peepsalot
Apr 24, 2007

        PEEP THIS...
           BITCH!

SoundMonkey posted:

Honestly 9V batteries are almost never the solution to anything unless it's something that will draw almost literally no power and you don't mind replacing them frequently.

Heck, you'd be better off with a really small SLA at that point, at least it's stand a chance of lasting more than a few hours.
Yeah 9V batteries are also a pretty poor value $/Wh, and poor Wh/volume since half the thing is cell casings.

I'd probably go with a 4x AA holder (or 2x 18650 protected li-ions), and a cheapo ebay $1-2 lm2577 adjustable boost module to raise voltage to 9-12v or whatever voltage.

SoundMonkey
Apr 22, 2006

I just push buttons.


peepsalot posted:

Yeah 9V batteries are also a pretty poor value $/Wh, and poor Wh/volume since half the thing is cell casings.

I'd probably go with a 4x AA holder (or 2x 18650 protected li-ions), and a cheapo ebay $1-2 lm2577 adjustable boost module to raise voltage to 9-12v or whatever voltage.

If you can find a dual charger, 18650s are probably the answer (with the aforementioned ebay lm2577-based boost regulator, of which I have way too many.)

Also, don't be swayed by rechargeable NiMH 9V batteries - trust me, they're twice as garbage as alkaline ones.

Collateral Damage
Jun 13, 2009

Aurium posted:

In ours, not so much. 9v batteries are pretty terrible at delivering high current, so they'll empty much faster. Around 75ma is a ok upper limit for good useability. They were originally designed around loads of ~15ma or less.

Under heavy load it'll quickly drop voltage, and go below what the LED's need. I couldn't tell you how fast, but it probably won't last an hour. Insert graph here. It's not a great graph, because it does show the 2 hours that you'd expect, but it also has arrows for where you'd expect different voltages, and they'd be way below what you'd need.
I learned this when dicking around with some Neopixel sticks. I stuck a 7805 on the Vcc input and powered it from a 9V battery. Just powering 8 RGB LEDs (about 30mA draw each at 5V) it lasts slightly over an hour. At first I thought I had burnt something because the LEDs suddenly stopped working, then I measured the battery and it was already under 7V.

Hadlock
Nov 9, 2004

Modern no-discharge ni-mh (amazon sells their own branded version of the sanyo eneloop for about $1/battery) and the name-brand (samsung, panasonic) 18650 cells are pretty amazing battery technology. Beware unbranded 18650s they're universally garbage 850mah cells, if you're lucky.

VelociBacon
Dec 8, 2009

Thanks again for the replies. I think I'll go with a regulator/LED driver. Is it reasonable to expect that I could find one that would be able to drive a single series arrangement of 40 LED's with a 2.1V vdrop?

I can't use a strip because the LED's will be irregularly spaced.

e: Someone on the last page suggested this driver but it's an IC, I'd prefer something that allows me to plug into a standard wall connection if possible, I guess I'll keep looking.

VelociBacon fucked around with this message at 04:05 on Aug 10, 2015

Adbot
ADBOT LOVES YOU

Aurium
Oct 10, 2010

VelociBacon posted:

Thanks again for the replies. I think I'll go with a regulator/LED driver. Is it reasonable to expect that I could find one that would be able to drive a single series arrangement of 40 LED's with a 2.1V vdrop?

I can't use a strip because the LED's will be irregularly spaced.

e: Someone on the last page suggested this driver but it's an IC, I'd prefer something that allows me to plug into a standard wall connection if possible, I guess I'll keep looking.

To me, it sounds like you'd be best served by making led strings like you were expecting and just using a 12 wall wart. They're cheap, and there are tons out there that will do the ~200ma figure you want. You could even get a 9v plug and use the exact array you've already figured.

Here is a monstrously cheap one. It probably has terrible output power quality (low power leds don't really care), and it's 500ma rating is probably optimistic, but you're not really stressing it.

If you want to go with a battery, (and you do) using something like 8xAA battery holder will do 12v and last a huuuge amount longer than a 9v battery.

You could do nothing more and let it discharge down to 9v, (eg 4 led strings, like that array you've already posted, abet with a slightly higher resistor to lower the current when it's 12v) It'll last around 2 hours. You might have to play with the resistor values to get a good combination of bright enough when it's 9v, but not too much current when it's 12v.

(that's essentially the job a regulator would do for you)

And speaking of you could use something like this buck boost regulator with your battery, have it set to whatever you actually want your output voltage to be, and use the battery pack until it completely collapses, and have basically completely steady light output at the same time. You could conceivably get 3.5 to 4+ hours out of that AA pack, depending on a variety of factors. (battery quality, module efficiency, exact led topology to name a few) This is pretty much the same as the lm2577 other people were talking about

You can also set it to give up to 35V, for strings of ~15 led each.

To get a single string of 40 leds@2.1v you'd be talking at least 84v. Those don't really exist outside serious lighting. I wouldn't recommend that strategy.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply