Author Topic: Designing a custom Lightsaber PCB - code writing time....  (Read 41731 times)

0 Members and 1 Guest are viewing this topic.

Offline CanobiTopic starter

  • Regular Contributor
  • *
  • Posts: 94
  • Country: gb
Designing a custom Lightsaber PCB - code writing time....
« on: April 22, 2015, 08:09:16 pm »
Hi guys


I've been making custom/replica props in my spare time for a few years now and one I keep revisiting as my skills develope is the lightsaber.



This time I'm upping the ante and making my own custom PCBs for my projects. I built a PCB fabrication lab (most of it anyway) so I didn't have to deal with loose running wires and the constant repairs that go with fitting that kind of setup.

I've already made a good start on a new PCB layout, and I'm just extending it as I add additional functions (board width has to remain within 20mm, I can extend it to 5 or 6 inches if necessary).




With a bit of luck the full board will include all of the following:

• charge management

• charge status indication

• soft latching switch

• embedded audio

• sound amplification



Charge management/indication is an obvious one for me as it saves having to remove the battery. I'm using an MCP73833 and GTR CR123A combo. The battery has a PCB mount holder on the blank side, the SMD components are on the other (still doing single sided but I'll get there).


The soft latching switch is both timely and a godsend.

It's timely as I happen to be learning about transistors n fets on an EE course I'm on and thought it would be a bit of handy practical to include it in the circuit.

I found out about latching circuits during some side research. The trail eventually led me to the design I'm going to use provided by this site:

http://www.edn.com/design/power-management/4427218/Latching-power-switch-uses-momentary-pushbutton


It's a godsend because fitting bulky panel mount latching pushbuttons to 10" x 30mm tubing is just the pits (if you like puzzles, give it a try, I dare you. Your choice is: try and fit a nut on a button thats mounted half way down the shaft langth, or, tap threads and risk twisting the wires off screwing the button in).


This finally brings me to my reason for posting (soz about the waffling). I need some suggestions for integrating audio.

Anyone know of a decent multi addressable playback IC that isn't discontinued, unsupported, badly documented, overly expensive, or available but only come in batches of a million and in obligatory repeating orders.


I bought a Nuvoton ISD2540 and a 1700 way back but it looks like both fall into at least two of the catagories above and without the software/hardware/accurate data support for them, I've been reluctant to try them out (I know my limits, I'll just go and let all the magic smoke out lol) so I've been looking for current/up to date alternatives but have been met with little success.

Any suggestions for solving this one would be most welcome.


For the amp I'm thinking a 1w digital, or 2w and a stick a boost buck in the mix, though finding a way to actually store and play sound has been taking up most of my left over free time (when I get any that is).
« Last Edit: October 29, 2015, 01:39:59 am by Canobi »
 

Offline PeterFW

  • Frequent Contributor
  • **
  • Posts: 577
  • Country: de
    • Stuff that goes boom
I had the same problem and endet up buying the bigger version of this:
http://www.mdfly.com/products/tf-microsd-card-mp3-player-module.html

Very easy to use but it has a slight lag between selecting the file to be played and the output, maybe 0.1 seconds or there about.
Never measured it.

No need for datasheets, you put the file on the SD card and just tell the module over the UART interface wich file should be played.
Worked great in my laser rifle :)

Edit: The bigger board uses a LM317 as voltage regulator, you might want to desolder it and short it if you allready have a voltage regulator.
In the small form factor you will have problems getting a decent sound level, decent small speakers are somewhat expensive.
One of the small "5V Class-D USB audio amps" sold on ebay by the bucket should do nicely.
« Last Edit: April 22, 2015, 08:30:40 pm by PeterFW »
 

Offline CanobiTopic starter

  • Regular Contributor
  • *
  • Posts: 94
  • Country: gb
Thanks for the link PeterMF :)

Turns out they sell the chip on its own which is just what I'm looking for, I owe you one ;)

http://www.mdfly.com/products/vs1003b-audio-decoder.html

I'm off to find the data sheet and do me some reading.
 

Offline rexxar

  • Frequent Contributor
  • **
  • Posts: 439
  • Country: us
    • Forever Tinkering
Interesting, I'm working on a lightsaber PCB as well. I just sold my first board today, in fact! It's a RGBW LED controller with a PC program to chose colors and such. Integrated battery charging and some other goodies! And the board comes in at just 18x50mm.

If you didn't know, there are several people online selling sound fonts, big packages of pre-recorded lightsaber sound effects.

I've not started work on my sound module yet, but I'm planning to include an accelerometer, to play whatever effect the user wants on hit, swing, etc. You may want to consider that yourself.
 

Offline CanobiTopic starter

  • Regular Contributor
  • *
  • Posts: 94
  • Country: gb
Interesting, I'm working on a lightsaber PCB as well. I just sold my first board today, in fact! It's a RGBW LED controller with a PC program to chose colors and such. Integrated battery charging and some other goodies! And the board comes in at just 18x50mm.

If you didn't know, there are several people online selling sound fonts, big packages of pre-recorded lightsaber sound effects.

I've not started work on my sound module yet, but I'm planning to include an accelerometer, to play whatever effect the user wants on hit, swing, etc. You may want to consider that yourself.

For me, the saber PCB is my training ground for a much bigger and more serious replica prop project I've slowly been working on for about 3yrs. The electronics is the only part left that is holding it back so I chose the saber board as it's almost a simplified version of what I need and thought it was a good starting point.

I have some fonts ready to go, but as I've been into sound design and music production for most of my life, I may have a crack at making a custom set.

I have a MR Vader soundboard I got in a PIF on another forum, that uses a spring motion/impact sensor switch, but it's quite literally a bit hit n miss when it comes to sound vs action. The accelerometer would be much more accurate in interpreting movement. The only downside for me is it needs an MCU to be useful. Programming is where my limit ends for now, I'm numerically dyslexic (the reason I haven't got as far with electronics as I'd like) but it's not completely crippling, it just takes longer for stuff to make sense and sink in (like transistors did yesterday, proper eureka moment :)).
 

Offline PeterFW

  • Frequent Contributor
  • **
  • Posts: 577
  • Country: de
    • Stuff that goes boom
For me, the saber PCB is my training ground for a much bigger and more serious replica prop project

Building props if fun, wanna see were i used the MP3 module i bought? :)



Hand crafted doom-beam-exciter out of glass and copper with 64 seperately wired leds, 64 PWM drivers and a lot of enamel wire:



Sadly i ran into a rather big problem wich i had not the nerve to tackle, so my death ray is sitting on the shelf as do my dreams for world domination...  :-[
 

Offline CanobiTopic starter

  • Regular Contributor
  • *
  • Posts: 94
  • Country: gb
Do tell... It's lookin boss, would be a shame to shelve it.

And since you shared, here's another WIP of mine:



And I may have found just what I was looking for on RS:

http://uk.rs-online.com/web/p/speech-recorder-ics/7003504/
 

Offline Richard Crowley

  • Super Contributor
  • ***
  • Posts: 4317
  • Country: us
  • KJ7YLK
Unless you are planning for long-term mass-production, the VLSI VS1000D-L looks like exactly what you seek.

Data Sheet: http://www.tme.eu/en/Document/501955d8469c3ed330c9828447a412f0/vs1000.pdf
Example product from Adafruit:  https://learn.adafruit.com/adafruit-audio-fx-sound-board?view=all
Example product from Sparkfun: https://www.sparkfun.com/products/retired/8849
Currently 50% off at Sparkfun:  https://www.sparkfun.com/products/8300
Available by the each here:  http://www.tme.eu/en/details/vs1000d-l/drivers-integrated-circuits/vlsi/

The biggest problem I see is what you are going to use for speaker(s).  You need something with some decent cone area if you want to reproduce any moderately low frequencies.  Maybe some speakers in a belt-pack/holster or something?
 

Offline CanobiTopic starter

  • Regular Contributor
  • *
  • Posts: 94
  • Country: gb
Neat ic, though I couldn't help looking at the VS1103 as it can loop seamlessly, and play multiple channels at the same time.

This is key as mixing/layering of two or three samples needs to be implimented on order for the saber to sound right.
« Last Edit: April 25, 2015, 05:55:31 pm by Canobi »
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 19517
  • Country: gb
  • 0999
The biggest problem I see is what you are going to use for speaker(s).  You need something with some decent cone area if you want to reproduce any moderately low frequencies.  Maybe some speakers in a belt-pack/holster or something?
Perhaps there could be a small speaker on the lightsabre and an FM transmitter to send it wirelessly to a boombox for the bass. Of course you'd need to make sure the RF power output is low, otherwise you'll be in trouble.
 

Offline PeterFW

  • Frequent Contributor
  • **
  • Posts: 577
  • Country: de
    • Stuff that goes boom
Perhaps there could be a small speaker on the lightsabre and an FM transmitter to send it wirelessly to a boombox for the bass. Of course you'd need to make sure the RF power output is low, otherwise you'll be in trouble.

I checked just now to be shure if i remembered it correctly.
The lightsaber has not that much low end, if you get down to 200Hz it still sounds nice enough.
200Hz you may be able to do with decent small speaker but it will be a bit of a challenge :)
 

Offline CanobiTopic starter

  • Regular Contributor
  • *
  • Posts: 94
  • Country: gb
I was just going to go with a 1-2w 28mm mid range cone in the pommel. As Peter states, no bottom end to woody about (unless you were on about his ray gun).
 

Offline CanobiTopic starter

  • Regular Contributor
  • *
  • Posts: 94
  • Country: gb
Well, been go ogling around again and found this company offering various speech ICs, one such is a duel channel playback ic. Will be finding out how hard they are to purchase as a hobbiest.

http://www.lapis-semi.com/en/semicon/speech/ml2282x.htm
 

Offline CanobiTopic starter

  • Regular Contributor
  • *
  • Posts: 94
  • Country: gb
Not easy it turns out. I only found one of their devices and that was through RS, though I think it'll only play one sound at a time, and I couldn't find it on the Lapis website so probably another discontinued product:

http://uk.rs-online.com/web/c/semiconductors/audio-processor-circuits/speech-recorder-ics/?searchTerm=speech+playback+ic

Dug out my ISD chips and found one to be an ISD2360 in SOP 16 package, not a 2540 DIP I originally thought it was. After looking up the data sheet I found the MCU schematic was pretty basic so I'm going to give MCU control a go. Shouldn't need a heavy duty one, something like the arduino pro mini chip would be more than sufficient by my guess.

Anyone know what it's called?


Here's the ISD2360 schematic for host control (I've included the chip pin out and diagram as the schematic is based on the qfp package)

 

Offline senso

  • Frequent Contributor
  • **
  • Posts: 951
  • Country: pt
    • My AVR tutorials
Why not just use a 8 pin 64Mb flash with all the sounds in there, and use a small micro-controller to generate the sound directly from PCM audio that is stored in said flash?
The micro can be anything that has an 8 bit timer, with 16 bit timer you get more audio resolution, the solution can be very small and compact.

The amplifier can be as simple as a transistor, or a QFN class D amp from TI.
 

Offline CanobiTopic starter

  • Regular Contributor
  • *
  • Posts: 94
  • Country: gb
Why not just use a 8 pin 64Mb flash with all the sounds in there, and use a small micro-controller to generate the sound directly from PCM audio that is stored in said flash?
The micro can be anything that has an 8 bit timer, with 16 bit timer you get more audio resolution, the solution can be very small and compact.

The amplifier can be as simple as a transistor, or a QFN class D amp from TI.

Thanks senso,  I'll look into that :D
 

Offline CanobiTopic starter

  • Regular Contributor
  • *
  • Posts: 94
  • Country: gb
This is new territory for me so have no idea if my choices are any good, but so far I've been looking at these as they're nice and small:

64Mb mem = http://uk.rs-online.com/web/p/flash-memory-chips/7824660/

Amp ic = http://uk.rs-online.com/web/p/audio-amplifier-ics/7098726/

Still looking for an appropriate MCU....
 

Offline rexxar

  • Frequent Contributor
  • **
  • Posts: 439
  • Country: us
    • Forever Tinkering
Shouldn't need a heavy duty one, something like the arduino pro mini chip would be more than sufficient by my guess.

Anyone know what it's called?

Atmel ATmega328 (or 328p). It's slightly more expensive, but if you want to use the Arduino IDE with it, I'd recommend using the 328p version, else you need to screw with some settings to get code to compile. They come with the internal oscillator preset, so you don't need to use an external crystal so long as you're careful with your fuse settings.

I'd recommend using an SD card for storing your sound files, actually. You can still access it with your microcontroller using SPI, but it's easier to load files. Rather than dick around trying to send 64Mb over a serial connection, you can just stick it in your PC. Either way works, though, it's just down to cost vs. convenience. In my case, I'll have users wanting to change and customize the sounds, so I figure an SD card is the easiest option.
 

Offline CanobiTopic starter

  • Regular Contributor
  • *
  • Posts: 94
  • Country: gb
Shouldn't need a heavy duty one, something like the arduino pro mini chip would be more than sufficient by my guess.

Anyone know what it's called?

Atmel ATmega328 (or 328p). It's slightly more expensive, but if you want to use the Arduino IDE with it, I'd recommend using the 328p version, else you need to screw with some settings to get code to compile. They come with the internal oscillator preset, so you don't need to use an external crystal so long as you're careful with your fuse settings.

I'd recommend using an SD card for storing your sound files, actually. You can still access it with your microcontroller using SPI, but it's easier to load files. Rather than dick around trying to send 64Mb over a serial connection, you can just stick it in your PC. Either way works, though, it's just down to cost vs. convenience. In my case, I'll have users wanting to change and customize the sounds, so I figure an SD card is the easiest option.


Thanks rexxar :)


SD card sounds like a simple solution, would it work with micro SD?

Micro isn't really essential as I think the standard SD card reader will just about fit on the PCB, just wanting to keep with the "small" componants theme for aesthetics.
 

Offline PeterFW

  • Frequent Contributor
  • **
  • Posts: 577
  • Country: de
    • Stuff that goes boom
SD card sounds like a simple solution, would it work with micro SD?

Yes, they are identical, except for the size.
A ATMega328P could be enough for your project, if you run it at 3.3V and 8Mhz it makes the whole thing easier.
But i do not know about the speed requirement for your audio stuff :)

Greetings,
Peter
 

Offline CanobiTopic starter

  • Regular Contributor
  • *
  • Posts: 94
  • Country: gb
SD card sounds like a simple solution, would it work with micro SD?

Yes, they are identical, except for the size.
A ATMega328P could be enough for your project, if you run it at 3.3V and 8Mhz it makes the whole thing easier.
But i do not know about the speed requirement for your audio stuff :)

Greetings,
Peter


3.3v sounds like a good ballpark voltage, my plan is to use a 3.7v LiPo so trying to choose componants that operate in that range anyway. Simple is good too so 8Mhz will do for a first shot as well :)

As long as the audio doesn't sound like a speak n spell trying to make lightsaber noises I'm all good. I can convert audio to just about any format or resolution/speed required.
 

Offline PeterFW

  • Frequent Contributor
  • **
  • Posts: 577
  • Country: de
    • Stuff that goes boom
As long as the audio doesn't sound like a speak n spell trying to make lightsaber noises I'm all good. I can convert audio to just about any format or resolution/speed required.

Maybe something like this could be enough for you:
http://www.hackerspace-ffm.de/wiki/index.php?title=SimpleSDAudio

There are quite a few other project describing how to play WAV files straight from the SD card using a Atmel µC.
The only hardware you need is the processor, the sd-card and a few passive components.
From what i have read, the sound quality should be enough for a light saber.

Edit: You could even roll your own "player" using two chips, one for the audio only and one for the other stuff.
A bit cheaper then using the next bigger chip but twice the power requirement.
About 15mA for each MCU and between 1mA to 50mA (idle) and 100mA to 300mA (active) for the SD card.
« Last Edit: April 29, 2015, 10:16:37 pm by PeterFW »
 

Offline CanobiTopic starter

  • Regular Contributor
  • *
  • Posts: 94
  • Country: gb
So looking at my saber samples, there's only about 20 seconds worth altogether.

I didn't know SD cards took so much current, might be an issue as the LED uses about 600mA on its own, my guess would be that flash mem might be the best option in this case.

The number of samples could actually be reduced if an accelerometer was included. Again, lacking full info but, if the data from the accelerometer were somehow translated to the playback pitch of the looping blade hum sample, it would behave very very closely to the lightsabers seen on screen.

About five or six of the short sounds I have are sweeps, my guess is they were intended as interrupts that would be played instead of the hum when meduim/meduim heavy movement was detected by the sensor (spring impact sensor most likely).
 

Offline PeterFW

  • Frequent Contributor
  • **
  • Posts: 577
  • Country: de
    • Stuff that goes boom
I didn't know SD cards took so much current

It depends on the card, if you use a name brand card the datasheet will tell you the precise numbers. You can get cards that are designed for low power use.
The 300mA is a very unlikely worst case current of some bad cards.
Usually they are under and around 100mA when reading/writing.

Have a look at this, looks like SPI flash with a processor and external DAC:
http://www.artekit.eu/diy-lightsaber-audio-board/
 

Offline CanobiTopic starter

  • Regular Contributor
  • *
  • Posts: 94
  • Country: gb
I didn't know SD cards took so much current

It depends on the card, if you use a name brand card the datasheet will tell you the precise numbers. You can get cards that are designed for low power use.
The 300mA is a very unlikely worst case current of some bad cards.
Usually they are under and around 100mA when reading/writing.

Have a look at this, looks like SPI flash with a processor and external DAC:
http://www.artekit.eu/diy-lightsaber-audio-board/

That's cool, not sure how one would get it in a hilt though, it's about an inch too wide. There seemed to be a bit of a delay between sound playing and movement, is that down to coding?


I'm just trying work out if it's possible to get more out of the data from the accelerometer since it appears to me that its down to creative coding and MCU capabilities for achieving optimal functionality. They seemed to only use it for activating the whoosh sound and had a seperate button for the clash sound in that setup, I thought it would be possible to get more out of it unless I'm off the mark with accelerometers that is.

Sound quality was rather good though, and 4w is louder than most sabers produce that I know of. Most go for 2w or less due to speaker size restrictions (27-28mm diameter are the "go for" sizes for a lot of saber smiths as they fit inside the hilt blanks perfectly so not a lot of extra work is needed to include them).
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf