Go Down

Topic: rgb ledstring lightsaber (Read 13649 times) previous topic - next topic

bodtx

#30
May 02, 2016, 02:40 pm Last Edit: May 02, 2016, 02:46 pm by bodtx
No
Code: [Select]
100 led * 0.050 A = 5A
You will burn your arduino 5v output

you can try runing like this

but I think 3.7V is not enough to run the atmega at 20Mhz (as embeded in the arduino).
With 3.7v you could run the atmega at 8Mhz alone I think.

You should read this

lakron

but I think 3.7V is not enough to run the atmega at 20Mhz (as embeded in the arduino).
With 3.7v you could run the atmega at 8Mhz alone I think.
I tried to power led string and arduino from one 18650 battery (4.17v). Everything worked. Is it ok? Arduino nano vin -  5v-12v.

bodtx

Ha 4.17 is better :) be carefull check if your battery can handle 5A discharge current.

If not you could have a capacity problem .
Or a heating problem

Protonerd

I tried running an Arduino Nano from a bench power supply with 3.7V, simulating an 18650 battery and I can confirm it works. I dunno down to which voltage, probably at below 3.3V it will cease to work.

But as mentioned below, the discharge has to be controlled, these LEDs are power hungry beasts! But power will drop with less voltage, which is a boon.

bodtx

#34
May 03, 2016, 02:17 pm Last Edit: May 03, 2016, 03:01 pm by bodtx
Yes nano is less strict with voltage as it is an atmega168

So here it is the requirement about voltage from atmel for the atmega 328P (in the arduino)

0 - 4MHz@1.8 - 5.5V, 0 - 10MHz@2.7 - 5.5.V, 0 - 20MHz @ 4.5 - 5.5V

So below 4.5V you can have some surprises.
@8Mhz itis running with no problem at 2.7V!, that's what I'm doing in my light saber (@8Mhz)

racemaniac

I use a maple mini which usually runs at 3.3v, but indeed, certainly the smaller arduinos will have no problem just running straight off 1 3.7V battery. And for the strips, as I think protonerd already documented in this topic, giving them less than 5V is ideal :). At 5V their protection diodes dissipate tons of power, just driving them directly off a single battery works very well (only when the battery starts getting low you'll start losing some brightness, and color). besides, trying to do DC-DC conversion in a lightsaberhilt for the power those leds need, is also going to be a challenge >_<.

Protonerd

I use a maple mini which usually runs at 3.3v, but indeed, certainly the smaller arduinos will have no problem just running straight off 1 3.7V battery. And for the strips, as I think protonerd already documented in this topic, giving them less than 5V is ideal :). At 5V their protection diodes dissipate tons of power, just driving them directly off a single battery works very well (only when the battery starts getting low you'll start losing some brightness, and color). besides, trying to do DC-DC conversion in a lightsaberhilt for the power those leds need, is also going to be a challenge >_<.
Quite true. But what can be tried to overcome the low voltage to the Arduino is to use a smaller 5V DC-DC only for the arduino and other circuitry, and use the 3.7V for the led stripes. I found some very cheap and small 5V DC-DC's:
http://www.ebay.de/itm/DC-DC-Boost-Converter-Step-Up-Module-1-5V-to-5V-500mA-for-phone-MP4-MP3-Arduino-/121142828799?hash=item1c34acdeff

bodtx

use a smaller 5V DC-DC only for the arduino and other circuitry, and use the 3.7V for the led stripes.
This is a good idea if you want to run @20Mhz, but do you need it?

racemaniac

<previous update>
And another update :).

I've implemented reading .wav files from an sd card, and caching them onto a flash chip i have connected to the maple mini.
And i've written a streaming system that streams the sound in blocks of 128bytes from the flashchip :)

I've now got a test running that's looping a soundsample from the flash chip to the I2C dac at 16khz, and at the same time is updating the neopixel string at 200fps :). Now i still have to add the motion sensor to this (but that shouldn't be too hard), and get working on the sound engine (so the sounds can react to the motion data, and that i can tell it to play which sound(s) when ).

But i'm making good progress :). And i hope there soon will be an arduino equivalent to the maple mini :). The arduino due is nice, but so big. I think it's got very similar capabilities to the maple mini, so if you want to do lots of IO, learning how to use the DMA (or other the hardware ports directly) can really help you :).
My current demo has both an I2C port and an SPI port running pretty much continuously, and then periodically the second SPI port will fetch data from the flash memory :). That's some awesome multitasking :).

bodtx

Nice but why don't you use an atmega in standalone?
On my side i will use an atmega and a bluetooth who will stream command to the phone .
Sensor test:
https://youtu.be/iksalVd8uBU

racemaniac

Nice but why don't you use an atmega in standalone?
On my side i will use an atmega and a bluetooth who will stream command to the phone .
Sensor test:
https://youtu.be/iksalVd8uBU

the standard atmega 328 that an arduino uses can't even come remotely close to what i'm doing there. It doesn't have DMA to do IO in the background, and lacks the hardware perihperals to do all that communication efficiently. I may be able to get somewhat close if i use 1 atmega per io device, but that would be 4 atmegas, that would have to communicate very efficiently. (and all those seperate chips will also take up some place in my lightsaber).

The maple mini is a board about the same size as an arduino nano, but with a cpu similar to a due :). And that 1 microcontroller will be able to handle all IO i've got going on :). reading sound, sending it to a DAC, driving the ledstring & reading the motion controller (and do all the calculations etc... to make these things work together :) ).

bodtx

OK but i'm driving sensor, bluetooth, and led with atmega and even if there is no background process it seems synchronized.

But what you are doing is surely more done with the perfect art than me ;)

racemaniac

#42
May 05, 2016, 09:27 pm Last Edit: May 05, 2016, 09:28 pm by racemaniac
OK but i'm driving sensor, bluetooth, and led with atmega and even if there is no background process it seems synchronized.

But what you are doing is surely more done with the perfect art than me ;)
there is no true "background process" in my case either :). But the processor does have a DMA controller, which means i can initiate a transfer to a device (or to the memory), and the DMA controller will take over from there :). And the DMA controller can manage multiple transfers simultaneously (or close enough to simultaneous :) ). So while all the IO is happening (and it's quite some IO), the CPU is free to do other things :).
I'm not using a module for the sound, so i have to read/write the samples myself from memory to a device :), at the correct sampling rate :). and driving the neopixel ledstring also requires some precise timing, which is easy to do with an spi port :).
I'm doing it a bit for the challenge, pushing the little microcontroller to its limits :). And also learning a lot about how the hardware works, how you control it, etc... But for a lightsaber it's also nice that the electronics inside are compact :). My first attempt which you can see in this thread barely fit into the handle (i had a huge amplifier, needed 2 batteries). And just doing sound & leds simultaneously was about all i could handle when doing it all via bitbanging :).

racemaniac

Did my first tests of integrating everything together this weekend, and it's slowly coming together :)

I've currently got the hum sound streaming from the flash chip, and responding in pitch to the swinging of the saber :).
Next is to add swinging sounds which i can then use to add variety to the sound when swinging :).

Since i'm doing all sound processing in the microcontroller itself, i can mix sounds real time, and i hope i'll be able to create a sound set that reacts very nicely (and hopefully also  naturally) to the swinging of the saber. Rather than have a set swing sound like the ones using an mp3 player, every swing will sound a bit different from the next one, and will respond to the intensity & duration of your swing.
It's however a hard goal to achieve, so the coming weeks will prove whether this is possible to get a good result with or not :).

bodtx

Hi what do you use to calculate the swing duration?
I have a adxl335 and i start the swing on any acceleration. But this algorithm is quite to simple i think

Go Up