4 channel Light saber driver design, may the light be with you.

57 posts / 0 new
Last post
Flintrock
Offline
Last seen: 2 years 11 months ago
Joined: 09/10/2016 - 20:29
Posts: 1544

I missed David EF's post.  never mind.  Anyway, yeah, the code should work.  It's not exactly like ttrev3 said, but similar.  The PWM match is already built into the chip, so it uses a match itnerrupt and an overflow int (and I doubt you'll find smaller ones anywhere).  Just the 4th waveform generator that was missing.  Anyway, yeah, it should be ready to go if you're happy with preset mode ramps, and it can get the eswitch and Vcc read too.  I hadn't known about this thread. I'm not that interested in sabres but it seems like a fun test case.

DavidEF
DavidEF's picture
Offline
Last seen: 1 week 5 days ago
Joined: 06/05/2014 - 06:00
Posts: 7699
Location: Salisbury, North Carolina, USA

Texas_Ace wrote:
It should work fine with the right firmware although it is not really setup for a flashlight and is pretty large.

All 4 of the output pins can be PWM so it is just a matter of getting firmware that takes advantage of it.


Well, it’s less than 26mm, so it’s large but not huge. There are some lights, especially 26650 lights, that can use that large of a driver. I did notice that it doesn’t have a ground ring. That in itself will make it a challenge to use in most lights. But, the parts selection and layout are what I was referring to when asking about the compatibility. If the circuit schematic is basically compatible, then a flashlight-friendly board can be made easily. That’s what I’m hoping for. Wink

The Cycle of Goodness: “No one prospers without rendering benefit to others”
- The YKK Philosophy

Flintrock
Offline
Last seen: 2 years 11 months ago
Joined: 09/10/2016 - 20:29
Posts: 1544

TA I think you'll find it pretty easy to customize the simplified attiny.h to whatever layout you've got.  If really needed it is even possible to move the 4th pwm from the traditional cap pin to the traditional voltage pin, but I did not include that as a "user-visible" option.  

 

.. or just get me some details and I'll set it up.

DavidEF
DavidEF's picture
Offline
Last seen: 1 week 5 days ago
Joined: 06/05/2014 - 06:00
Posts: 7699
Location: Salisbury, North Carolina, USA

Flintrock wrote:

Well Bistro-HD does do 4 channel PWM and can do it with eswitch and voltage read (on Vcc or on the eswitch/voltage pin with the right hardware). It’s similar to what tterev3 says but slightly simpler(smaller code).  The chips already have four PWM output compare registers, no need to keep resetting the clock.  It just doesn’t have 4 waveform generators. So you use two interrupts, one for match and one for overflow.  Anyway, it’s all setup already there.  Just have to figure out how the UI parts should look, but if you’re happy with preset mixes as you go through modes, then that’s all set too.   I had not known about this thread though.


With the almost staggering number of mode choices available in a single firmware now (by using mode groups and config options), I think preset mixes would be a fine place to start. The modes would just need to be RGBW-level modes, versus the white-lighting-level modes we use normally.

In the future, it would be great to have a dual-switch control where one switch moves you through channels and the other operates smooth ramping (and/or typical “modes”) . Then it will just be “click A-switch” to choose which channel to change, then “click-hold B-switch” to ramp brightness of that channel (or “click B-switch” to use preset “modes”), then back to “click A-switch” to select the next channel and continue. I don’t know how hard this will be to write and I don’t want to make demands on anyone’s time. It’s just a dream of mine for now. Innocent

The Cycle of Goodness: “No one prospers without rendering benefit to others”
- The YKK Philosophy

Flintrock
Offline
Last seen: 2 years 11 months ago
Joined: 09/10/2016 - 20:29
Posts: 1544

Yeah, that's going to need hardware support.  You've got to get that second switch on the reset pin.  From a software perspective, it's easiest if it's normally high, and the switch pulls it down to 0.5V.  I'd wire it like this:

 

 

     GND <-----------------------R10--------------------------------R11------------- VCC

                                                                 |  

                                                                 |

                                                                /   Switch

                                                                 |

                                                                 |

                                                           Reset Pin

 

 

Flintrock
Offline
Last seen: 2 years 11 months ago
Joined: 09/10/2016 - 20:29
Posts: 1544

Or you need two different pull down voltages on the main pin, but I think the above is simpler as far as software.  Might even work without changing anything.

ToyKeeper
ToyKeeper's picture
Offline
Last seen: 1 day 20 hours ago
Joined: 01/12/2013 - 14:40
Posts: 10623
Location: (469219) 2016 HO3

Depending on how things go, I might try to use a tiny841 and acupuncture or a bed of nails for flashing. That would provide more pins and a newer MCU. I’ll probably also try to align the LED connections directly under the holes in the heat sink, so a short wire can go directly up to each emitter and the board itself can be pressed against the heat sink.

I just need to learn a PCB layout tool first. Smile

That’s all for later though. For now, I can get things like 90% done (and make a working saber) with the provided layout.

Texas_Ace
Texas_Ace's picture
Offline
Last seen: 1 hour 20 min ago
Joined: 03/24/2016 - 07:44
Posts: 8974
Location: Everything is brighter in Texas

All of my designed come with the source files that are pretty easy to edit once you get the software. Sadly for you, I don’t think diptrace is on linux but you could most likely use a virtual machine or even wine.

ToyKeeper
ToyKeeper's picture
Offline
Last seen: 1 day 20 hours ago
Joined: 01/12/2013 - 14:40
Posts: 10623
Location: (469219) 2016 HO3

I figure I’ll probably use KiCad. It’s what my Linux circuit geek friends recommended, and Oshpark supports its files directly. It appears to be a little on the complex side compared to some, but it also appears to be pretty powerful. And I’m not doing anything particularly complicated, so I don’t have to be picky. Smile

Before that though, I have some firmware to write. So much firmware. And parts to order. And tools to try.

Texas_Ace
Texas_Ace's picture
Offline
Last seen: 1 hour 20 min ago
Joined: 03/24/2016 - 07:44
Posts: 8974
Location: Everything is brighter in Texas

If you are starting on a new MCU anyways, I HIGHLY recommend the 1617 mcu : http://www.mouser.com/ProductDetail/Microchip-Technology/ATtiny1617-MFR/?qs=sGAEpiMZZMvqv2n3s2xjsdZc02topxxIyb2htVHofo5O1dwzOibzLA%3D%3D

It is what I think flashlights should and will be moving to in the future. It offers many advantages with no cost increase or other downsides if learning a new chip anyways.

I mean 16kb and 22 i/o pins, whats not to like and thats before you really dig into the spec sheet. It also has multiple reference voltages making it much simpler to create a driver that can work with any input voltage.

ToyKeeper
ToyKeeper's picture
Offline
Last seen: 1 day 20 hours ago
Joined: 01/12/2013 - 14:40
Posts: 10623
Location: (469219) 2016 HO3

Is that even supported in gcc yet? My copy ( gcc-avr 1:4.9.2+Atmel3.5.3-1 ) doesn’t seem to recognize it, unless it’s supported under a non-obvious name. It recognizes attiny841 though.

DavidEF
DavidEF's picture
Offline
Last seen: 1 week 5 days ago
Joined: 06/05/2014 - 06:00
Posts: 7699
Location: Salisbury, North Carolina, USA

TK, if you want easy, I would recommend Eagle. It’s very intuitive to use and if you need to, you can use mattaus’ tutorial to get you started. It’s what most of us around here use, so if you get stuck on something, help is very near. We have lots of custom made library parts floating around here for Eagle as well. I tried looking at KiCad, since it’s included in Ubuntu’s repositories, but I couldn’t figure out how to do anything with it. Oshpark also supports Eagle files directly, and they have a design rules file for Eagle that you can download.

The Cycle of Goodness: “No one prospers without rendering benefit to others”
- The YKK Philosophy

Texas_Ace
Texas_Ace's picture
Offline
Last seen: 1 hour 20 min ago
Joined: 03/24/2016 - 07:44
Posts: 8974
Location: Everything is brighter in Texas
ToyKeeper wrote:
Is that even supported in gcc yet? My copy ( gcc-avr 1:4.9.2+Atmel3.5.3-1 ) doesn’t seem to recognize it, unless it’s supported under a non-obvious name. It recognizes attiny841 though.

Good question, it is the latest MCU out so if it is not supported yet you can bet it will be soon. Although it could just simply not be in there by name yet but share the settings with another chip.

MiG0
Offline
Last seen: 6 months 3 weeks ago
Joined: 02/28/2016 - 04:56
Posts: 127

The latest AVR toolchain (3.6.0) was released in January, while the 1617 data-sheet initial release was in March.

ToyKeeper
ToyKeeper's picture
Offline
Last seen: 1 day 20 hours ago
Joined: 01/12/2013 - 14:40
Posts: 10623
Location: (469219) 2016 HO3

Haven’t updated in a while, but I’ve got this mostly working now. I just have a few things left to do. Off the top of my head…

  • Improve button de-bouncing code because these saber buttons are really noisy and sometimes have pretty long leads.
  • Lay out a new PCB to make it more physically compatible with the hosts.
  • Try to eliminate some occasional timing jitter on the 4th PWM channel.
  • Add a couple more lighting effects.
  • Tweak default modes and calibration, and otherwise polish up little details.

Really not all that much left, but some of the remaining steps are going to be time-consuming.

DavidEF
DavidEF's picture
Offline
Last seen: 1 week 5 days ago
Joined: 06/05/2014 - 06:00
Posts: 7699
Location: Salisbury, North Carolina, USA

I’m still watching this channel! Glasses

The Cycle of Goodness: “No one prospers without rendering benefit to others”
- The YKK Philosophy

G0OSE
G0OSE's picture
Offline
Last seen: 1 hour 36 min ago
Joined: 09/03/2014 - 12:34
Posts: 1652
Location: UK SW

So am I now! Thumbs Up

DrafterDan
DrafterDan's picture
Offline
Last seen: 11 months 1 week ago
Joined: 11/21/2014 - 13:33
Posts: 95
Location: phoenix, AZ

As am I.
I’ve been on the fence about owning a lightsaber, because I don’t feel it’s practical (this from a guy with a shelf full of flashlights that mostly just sit there). I’ve been a Star Wars fan since ’77, so the desire has always been there.

This may turn the corner for me. With my modicum of lathe experience, I suppose if I were to own one, it should be one that I made myself. A 26mm driver board is barely over 1”, so it would fit inside a ‘saber hilt without any difficulties.

have light, will travel

ToyKeeper
ToyKeeper's picture
Offline
Last seen: 1 day 20 hours ago
Joined: 01/12/2013 - 14:40
Posts: 10623
Location: (469219) 2016 HO3

This one is light only, no sound, but I’m hoping I can make one with sound in the future. That’s a much bigger project though, and I’ll need to find a way to fund development. Hoping one of the saber companies will be interested enough to help with that.

In this light-only version though, what I’ve made is similar to an analog synthesizer, only for light instead of sound. The user can create their own unique look by, basically, turning knobs while watching the changes in real time, until it looks how they want. The colors are entirely up to the user, and the patterns are formed by modulating together whatever effects they want. This allows them to build smooth oscillations, harsh strobes, shimmering colors, unstable flickering, etc.

This is a pretty big change from the existing products out there, which typically have only a few preset colors and a single pattern which can be high, med, low, or off. Other stuff also has some other weird drawbacks, like requiring inline floating resistors to prevent the LEDs from turning into smoke… but the heat goes into the resistor instead (which has no heat sink and is often shrink-wrapped), so the resistors tend to burn out.

I’m undecided whether to make an intermediate version which also includes an accelerometer. It would be a really nice upgrade, and would fit very nicely into the analog synth approach, but it’d still be light-only. I might go directly for the full-featured version instead. Or, if things don’t work out, I might never make the second version. Hopefully things will go well.

ToyKeeper
ToyKeeper's picture
Offline
Last seen: 1 day 20 hours ago
Joined: 01/12/2013 - 14:40
Posts: 10623
Location: (469219) 2016 HO3

I forgot to post this earlier. Things aren’t finalized yet, but here’s the interface so far:

It’s pretty simple as far as synth engines go, but it’s plenty for personalizing a lightsaber. Most drivers offer like 5 different shimmer presets (including “none”) using a single color, and that’s it. In contrast, this one can be configured for a wide range of different patterns (including multi-color). I tried to keep things reasonably simple though, since it only has one button.

Configuration is basically just “pick two colors and then turn knobs until it looks good”. It shows the results in real time during adjustment, so it’s fairly intuitive. There’s currently room for 12 different personality slots, though that number is kind of arbitrary. By default, it has 8 slots for somewhat traditional blades (like “Paladin Blue” and “Consular Green”) and 4 slots for special-effect blades (like “Rainbow Lightning” and “Police Flasher”).

As an example of how these things work, here’s how to configure a police flasher:

  • Set color 1 to bright red.
  • Set color 2 to medium blue.
  • Set the color shape to a square wave.
  • Set the color speed to something slow.
  • Pulse depth: medium-high.
  • Pulse shape: square.
  • Pulse speed: fast.

The two square waves stack so that one alternates slowly between red and blue while the other alternates rapidly between dim and bright. There’s nothing special about this though — the user can configure it for whatever patterns they like, and the police flasher is mostly just an example to help people understand how things work. For less dramatic patterns the user can do things like “slow triangle wave from light orange to dark orange, plus a medium-speed low-intensity triangle wave”. That would make it look like a gently-pulsing, breathing, orange plasma. It mostly just depends on what the user wants it to look like.

DavidEF
DavidEF's picture
Offline
Last seen: 1 week 5 days ago
Joined: 06/05/2014 - 06:00
Posts: 7699
Location: Salisbury, North Carolina, USA

Thanks for the update! I’m looking forward to seeing this in action when you get it done! (You ARE going to post photos AND video, right?)

The Cycle of Goodness: “No one prospers without rendering benefit to others”
- The YKK Philosophy

DavidEF
DavidEF's picture
Offline
Last seen: 1 week 5 days ago
Joined: 06/05/2014 - 06:00
Posts: 7699
Location: Salisbury, North Carolina, USA

Hey TK! Have you any updates for us mere mortals? I’m still interested in seeing this new driver come available here.

Also, did you end up using KiCAD for your PCB design? I just downloaded it again recently, because Eagle is getting really weird since AutoCAD took it over. I’m still trying to figure out how to use KiCAD, but it seems a bit easier than I remember it being before. One problem I’m finding is that I don’t know how/where to get library parts for standard stuff we use like AMC7135 regulators and less ‘common’ stuff like PIC chips.

The Cycle of Goodness: “No one prospers without rendering benefit to others”
- The YKK Philosophy

ToyKeeper
ToyKeeper's picture
Offline
Last seen: 1 day 20 hours ago
Joined: 01/12/2013 - 14:40
Posts: 10623
Location: (469219) 2016 HO3

I keep getting distracted and haven’t done it yet.

The only progress since my previous update is I got a prettier host with a lighter-weight blade for better balance. But it doesn’t even have a proto1 board in it; instead I currently have a Convoy S7 crammed inside the hilt for extra weight and some light.

It spins nicely, but I really need to make a new driver and update the firmware.

DavidEF
DavidEF's picture
Offline
Last seen: 1 week 5 days ago
Joined: 06/05/2014 - 06:00
Posts: 7699
Location: Salisbury, North Carolina, USA

TK? Still working on this? Innocent

The Cycle of Goodness: “No one prospers without rendering benefit to others”
- The YKK Philosophy

iamlucky13
Offline
Last seen: 1 hour 57 min ago
Joined: 06/22/2018 - 09:18
Posts: 880
Location: USA

This probably isn’t the best place to ask, but since David bumped what turned out to be an interesting, somewhat related thread:

Is there a list anywhere of 4-channel drivers? Here’s what I know of so far:

  • Mountain Electronics has one that has been around for a while.
  • tterev3 used to offer the really sophisticated looking meld-x, but has discontinued it.
  • Dr. Jones also used to have a similarly neat looking e-switch driver, but it also appears to no longer be available.
  • The Light Saber driver also looks awesome, but is too big for most flashlights, and not yet available?

My personal interest is RGBA, specifically an E17A quad from Clemence, to put in preferably an S2+ with a frosted lens.

I can probably live with the driver Mountain offers, which is easy because it comes assembled, ready to go, for a decent price, and the default current is a good match for the E17A. The drawbacks are the modes are fairly basic, switching mode groups requires soldering, output is only adjustable by swapping resistors, and there’s no mode that runs all 4 channels at the same time – the color E17A’s are phosphor converted, so they should be able to mix to a pretty good white, if you get the power levels right.

DavidEF
DavidEF's picture
Offline
Last seen: 1 week 5 days ago
Joined: 06/05/2014 - 06:00
Posts: 7699
Location: Salisbury, North Carolina, USA

iamlucky13 wrote:
This probably isn’t the best place to ask, but since David bumped what turned out to be an interesting, somewhat related thread:

Is there a list anywhere of 4-channel drivers? Here’s what I know of so far:

  • Mountain Electronics has one that has been around for a while.
  • tterev3 used to offer the really sophisticated looking meld-x, but has discontinued it.
  • Dr. Jones also used to have a similarly neat looking e-switch driver, but it also appears to no longer be available.
  • The Light Saber driver also looks awesome, but is too big for most flashlights, and not yet available?

My personal interest is RGBA, specifically an E17A quad from Clemence, to put in preferably an S2+ with a frosted lens.

I can probably live with the driver Mountain offers, which is easy because it comes assembled, ready to go, for a decent price, and the default current is a good match for the E17A. The drawbacks are the modes are fairly basic, switching mode groups requires soldering, output is only adjustable by swapping resistors, and there’s no mode that runs all 4 channels at the same time – the color E17A’s are phosphor converted, so they should be able to mix to a pretty good white, if you get the power levels right.

I’m still hoping for this driver to be finished sometime. A good open source driver for RGBW is missing from BLF. This driver board can be reduced, but it would be at the expense of some of the 7135 chips being eliminated. If you don’t need a low-low, I guess all the 7135 chips could be replaced with FETs. That would make the driver quite inefficient, but it could be much smaller that way. Another idea would be to reduce the number of 7135 footprints, but stack the chips on the driver when building it. Either of these choices would require a re-design of the board, but Eagle is fairly easy to learn. Wink

FYI, tterev3 said he quit his sales because of lack of interest. But I was able to get a couple of drivers from him a few months ago that he had left over. I don’t know if he still has any now or not. You’d have to ask him about it. I haven’t built the lights yet from the drivers I bought from him. I have the hosts, but I still need some colored LEDs.

The Cycle of Goodness: “No one prospers without rendering benefit to others”
- The YKK Philosophy

Pages