RGB lightsaber

What are you developing?
racemaniac
Posts: 432
Joined: Sat Nov 07, 2015 9:09 am

Re: RGB lightsaber

Post by racemaniac » Sat Dec 19, 2015 5:25 pm

zmemw16 wrote:apols, sloppy phrasing, i was thinking of the required noises!
srp
this is planned, but i first have to add a motion sensor to the saber :)
but for now i'm taking a time out on this project :). waiting for some new stuff to arrive from china to continue with, and taking some time for all the other things i like to do, as the past weeks a lot of time went into the saber ^^.

also, some pictures of the saber, in normal light:
http://users.telenet.be/racemaniac/Saber/hilt.jpg
http://users.telenet.be/racemaniac/Saber/hilt2.jpg
http://users.telenet.be/racemaniac/Saber/saber.jpg

User avatar
RogerClark
Posts: 6673
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: RGB lightsaber

Post by RogerClark » Sat Dec 19, 2015 8:47 pm

Absolutely fantastic

Re:Amplifer

I have been converting an old good quality hifi speaker to bluetooth and I'm using a cheap class D samplifer from ebay (TDA7297), and it does not get very hot at all.

However to get loud sounds you will need a good battery and a bigger battery.

Take a look at @ahull's thread on low cost power supplies using various lipo cells.

I recommend using 3 lipos in series to run the amplifier.

Re:Motion sensor

The MPU9150 is a good sensor, (I2C) I tested it with the Maple Mini a long time ago, but never got around to using it in a project :-(

racemaniac
Posts: 432
Joined: Sat Nov 07, 2015 9:09 am

Re: RGB lightsaber

Post by racemaniac » Sat Dec 19, 2015 9:24 pm

RogerClark wrote:Absolutely fantastic

Re:Amplifer

I have been converting an old good quality hifi speaker to bluetooth and I'm using a cheap class D samplifer from ebay (TDA7297), and it does not get very hot at all.

However to get loud sounds you will need a good battery and a bigger battery.

Take a look at @ahull's thread on low cost power supplies using various lipo cells.

I recommend using 3 lipos in series to run the amplifier.

Re:Motion sensor

The MPU9150 is a good sensor, (I2C) I tested it with the Maple Mini a long time ago, but never got around to using it in a project :-(
For the amp, i'm currently looking at a PAM8403, also class D, and it runs from 2.5v-5.5v, making so i can just directly feed it from 1 18650 battery, the output should be about 1.5W-2.2W depending on the battery voltage (at 5V it's 3W, at 3.6V it's 1.6W). If i'm not satisfied, i can always look for a boost circuit that gets 5V from the battery. The leds are also working with just being hooked straight to the 1s lipo (tested them, and at 3.4V they started having problems with the blue/green leds, and their colors/brightness starts to really degrade). Making handling powering everything in the saber very easy :) (and i naturally i use a battery with built in protection ).
and for the motion sensing, i have some MPU-6050 boards, which apparantly are a predecessor of the MPU-9150. All it lacks is a magnetometer, which i don't really need. The weakness of the mpu-6050 is that you can't detect drift (which you could use the magnetometer for to compensate), but i don't think i'll need such detailed motion sensing :).

User avatar
RogerClark
Posts: 6673
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: RGB lightsaber

Post by RogerClark » Sun Dec 20, 2015 12:56 am

racemaniac wrote: i have some MPU-6050 boards, which apparantly are a predecessor of the MPU-9150. All it lacks is a magnetometer, which i don't really need. The weakness of the mpu-6050 is that you can't detect drift (which you could use the magnetometer for to compensate), but i don't think i'll need such detailed motion sensing.
Drift is a major problem with the IMU units. You would be better off with just a magnetometer than the gyros and accelerometers.

I looked into motion sensing in some detail last year in an attempt to detect and calculate position movement of an object (a ball), but basically the accuracy of the gryos and accelerometer is far to low to be able to calculate X, Y Z position. (because of the double integration needed to convert acceleration into position)

If you have the MPU6050 its a good start, and may do all you need, but I'd recommend you also order an MPU9150 or the newer MPU9250 from eBay (get whichever is cheaper as the additional accuracy of the 9250 does not get around the drift problem). As you are likely to end up needing the magnetometer to kill the gyro drift

racemaniac
Posts: 432
Joined: Sat Nov 07, 2015 9:09 am

Re: RGB lightsaber

Post by racemaniac » Sun Dec 20, 2015 7:24 am

RogerClark wrote:
racemaniac wrote: i have some MPU-6050 boards, which apparantly are a predecessor of the MPU-9150. All it lacks is a magnetometer, which i don't really need. The weakness of the mpu-6050 is that you can't detect drift (which you could use the magnetometer for to compensate), but i don't think i'll need such detailed motion sensing.
Drift is a major problem with the IMU units. You would be better off with just a magnetometer than the gyros and accelerometers.

I looked into motion sensing in some detail last year in an attempt to detect and calculate position movement of an object (a ball), but basically the accuracy of the gryos and accelerometer is far to low to be able to calculate X, Y Z position. (because of the double integration needed to convert acceleration into position)

If you have the MPU6050 its a good start, and may do all you need, but I'd recommend you also order an MPU9150 or the newer MPU9250 from eBay (get whichever is cheaper as the additional accuracy of the 9250 does not get around the drift problem). As you are likely to end up needing the magnetometer to kill the gyro drift
i don't (yet) have any applications in mind where i need such precision, i bought the 6050 with the saber in mind, to have something cheap that detects acceleration/rotation so i can do fun sounds with it (and absolute position doesn't really matter). But it's stored in my mind now, that if i ever have an application where it does matter, i'll need to buy better boards :)

racemaniac
Posts: 432
Joined: Sat Nov 07, 2015 9:09 am

Re: RGB lightsaber

Post by racemaniac » Thu May 05, 2016 5:01 pm

I might as well continue in this thread, as what i'm making atm is for my next lightsaber :).

As you may have read in my other threads (http://www.stm32duino.com/viewtopic.php?f=27&t=862), i've been hard at work at making dma libs for improved IO performance, so i can take my saber a few steps further :).

After tons of work, my code has finally surpassed the abilities of the first saber i made :). It's too early to build it into a saber, but i've got a proof of concept running that is finally bringing it all together :D.

Current progress:
- I can load soundsamples from an SD card onto a flash chip, with a little 'filesystem' i made so i can easily read those samples from the chip.
- I can send data to the neopixels via the SPI port, which i address via DMA :).
- I can send 12bit soundsamples to an i2c dac, at a max sampling rate of 60khz (when overclocking the port to 1.2Mhz), but the samplingrate is variable (so the sound can react to motion :)) (more info here: http://www.stm32duino.com/viewtopic.php?f=19&t=1048)
- I can read an I2C motion sensor via DMA calls, and extract useful data from it (well, i think it'll be useful XD).

My current proof of concept is the first 3 combined and working perfectly :D.
the soundsamples are going out steadily (at about 16khz atm). the sound is coming from the flash memorychip, which is streaming it in blocks of 128 bytes, and at the same time the 144leds neopixel string is updating about 200 times per second :). Both the I2C port for the dac and the SPI port of the neopixel string are sending data pretty much continuously, and when required the next block is requested from the flash chip :).
-> my first saber couldn't come close to that refreshrate of the neopixels, had to read the sound from its internal flash memory (so very limited in how much sounds i could have), had an 8bit parallel dac so i didn't have overhead of the serial protocols ( i just connected it to one of the ports of the maple and set the samples on this port), and when doing all this was completely swamped since it was doing all the timing manually :), and driving the neopixels via bitbanged code :).

TODO this weekend (maybe), try and also add the motion sensor so i've got my 4 devices running at the same time and doing what they should be doing :).
I think it's great how much IO you can get from this little maple mini :). When i started it seemed like a near impossible project, but i'm slowly getting there :).

(and for those wondering, the SD card is only used for filling the flash memory, streaming from an sd card felt slow & hard to work with).

racemaniac
Posts: 432
Joined: Sat Nov 07, 2015 9:09 am

Re: RGB lightsaber

Post by racemaniac » Sat May 14, 2016 12:55 pm

Okay, some first videos ( 1, 2 )of what the project is heading for :)
Currently constant sampling rate, but it's a first demo of the maple mini dynamically mixing 2 sounds (and idle sound & a swinging sound) based on the motion sensor :).

racemaniac
Posts: 432
Joined: Sat Nov 07, 2015 9:09 am

Re: RGB lightsaber

Post by racemaniac » Sun Nov 27, 2016 10:26 am

After some more work, today i finally assembled the saber with the new electronics and gave it a little test:
lightsaber test

quite pleased with how it now reacts to motion :). Gives it a really natural sound XD. I still have to implement collisions, add some way of selecting sounds/colors, do some hardware improvements, .... but it's getting better with every iteration :).
Are projects ever truly done? :)
Last edited by racemaniac on Sun Nov 27, 2016 11:19 am, edited 1 time in total.

danieleff
Posts: 336
Joined: Thu Sep 01, 2016 8:52 pm
Location: Hungary
Contact:

Re: RGB lightsaber

Post by danieleff » Sun Nov 27, 2016 10:53 am

Holy shit it sounds amazing!

racemaniac
Posts: 432
Joined: Sat Nov 07, 2015 9:09 am

Re: RGB lightsaber

Post by racemaniac » Sun Nov 27, 2016 11:19 am

danieleff wrote:Holy shit it sounds amazing!
thanks XD
for the sound it's mixing 2 channels (idle & swinging sound) based on the data coming from the motion sensor :)
and it's a bit totally overkill, but it's got 8 channels ready in memory which can be mixed together :D.
atm i use 2 other channels just to have to open & close sound ready (will optimize that so i only use 1 channel, don't need them to be available together :D). and then i can have channels stand by for collisions, and possibly extra channels for swinging (so it can switch between different swinging sounds).
There's a lot of power in that little stm32 :).

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest