Welcome to Laser Pointer Forums - discuss green laser pointers, blue laser pointers, and all types of lasers

LPF Donation via Stripe | LPF Donation - Other Methods

Links below open in new window

ArcticMyst Security by Avery

The "Photino RGB"






benmwv

0
Joined
Sep 10, 2010
Messages
1,380
Points
48
That's pretty cool! Does your circuit have any pwm abilities or just on/off? It would be neat to have a mode where it continuously cycled through the spectrum very smoothly, like a rainbow laser!
 

rhd

0
Joined
Dec 7, 2010
Messages
8,475
Points
0
That's pretty cool! Does your circuit have any pwm abilities or just on/off? It would be neat to have a mode where it continuously cycled through the spectrum very smoothly, like a rainbow laser!

The driver circuitry can do PWM, but the ATTINY85 only has hardware PWM on one pin. So I can implement PWM if I want, but I need to do it in software. I may do that, but there are a couple other code issues to address first (like getting EEPROM writing to work, and implementing a random colour mode).
 
Joined
Jun 22, 2011
Messages
2,431
Points
83
Nice work! I'm not sure how you wired the temporary switch, but if it's "after" the MCU it would be cool to add a mode where you double click the switch quickly to make it constant on (a single click will still be temporary on).
 

rhd

0
Joined
Dec 7, 2010
Messages
8,475
Points
0
Nice work! I'm not sure how you wired the temporary switch, but if it's "after" the MCU it would be cool to add a mode where you double click the switch quickly to make it constant on (a single click will still be temporary on).

Nope, the main trigger controls a pre-IC mosfet that controls power to the whole system.
 

Sta

0
Joined
Jan 27, 2014
Messages
1,737
Points
83
My gosh! That is unbelievable! So beautiful, perfect white balance! You could probably make a fortune selling those. What's the power and duty cycle?
 

benmwv

0
Joined
Sep 10, 2010
Messages
1,380
Points
48
The driver circuitry can do PWM, but the ATTINY85 only has hardware PWM on one pin. So I can implement PWM if I want, but I need to do it in software. I may do that, but there are a couple other code issues to address first (like getting EEPROM writing to work, and implementing a random colour mode).

I would have to look at the data sheet to be sure since it's a while since I've messed with the 85, but I'm 99% they have 3 pwm pins.

Edit, never mind I was thinking of ADCs. It's only got 2 pwm pins.
Double Edit, that edit was wrong, see below.
 
Last edited:
Joined
Jun 22, 2011
Messages
2,431
Points
83
The MCU used on Arduino Nano has 6 PWM pins and it seems small enough (but much bigger than yours). And it's easy to program because you can use the Arduino bootloader/IDE.
 
Last edited:

benmwv

0
Joined
Sep 10, 2010
Messages
1,380
Points
48
Actually, I've been digging and it does have 3 pwm pins. Pins 0, 1, and 4. You just have to be using the right core, some of them don't have access to all the timers. Check this thread for more info:

attiny85 with 3 PWN pins

Use this core to get 3 pwm:
https://code.google.com/p/arduino-tiny/

Here is an example code I found. I modified it a bit, basically you would just need to add your code in the loop portion so it changes the variables that are commented as duty cycle from 0-255 for 0-100%.

Also you will have to use the core above for this code to work.

Code:
// For Attiny85
// Author: Nick Gammon
// Date: 29 November 2012

void setup() 
{
  pinMode (0, OUTPUT);  // pin 5  // OC0A
  pinMode (1, OUTPUT);  // pin 6  // OC0B
  pinMode (4, OUTPUT);  // pin 3  // OC1B
  
  // Timer 0, A side
  TCCR0A = _BV (WGM00) | _BV (WGM01) | _BV (COM0A1); // fast PWM, clear OC0A on compare
  TCCR0B = _BV (CS00);           // fast PWM, top at 0xFF, no prescaler
  OCR0A = 0;                   // duty cycle

  // Timer 0, B side
  TCCR0A |= _BV (COM0B1);        // clear OC0B on compare
  OCR0B = 0;                    // duty cycle

  // Timer 1
  TCCR1 = _BV (CS10);           // no prescaler
  GTCCR = _BV (COM1B1) | _BV (PWM1B);  //  clear OC1B on compare
  OCR1B = 0;                   // duty cycle
  OCR1C = 255;                  // frequency
  }  // end of setup

void loop() {

// YOUR CODE HERE

}
 
Last edited:

rhd

0
Joined
Dec 7, 2010
Messages
8,475
Points
0
Here it is with the driver code all sorted out. It has 9 modes that you can mode between with a selector switch, and it remembers the mode you left off on:

Solid Color Modes
1: White
2: Red
3: Yellow
4: Green
5: Cyan
6: Blue
7: Magenta

Special Modes
8: Chooses a random color every time the laser is activated
9: Rapidly cycles through colors

https://www.youtube.com/watch?v=f0GlhxboGD4
 

rhd

0
Joined
Dec 7, 2010
Messages
8,475
Points
0
Actually, I've been digging and it does have 3 pwm pins. Pins 0, 1, and 4. You just have to be using the right core, some of them don't have access to all the timers. Check this thread for more info:

attiny85 with 3 PWN pins

Use this core to get 3 pwm:
https://code.google.com/p/arduino-tiny/

The first thing I needed to do was swap the third channel from pin 2 to pin 4. Luckily, I wasn't using pin 4 for anything, and the PWM signals are on an internal layer without much else going on, so it wasn't too painful.

I also took the opportunity to fit a set of surface-mount ATTINY85 pins right inside the dip8 pins. Pretty cool that it fits! Now I can use either.

attachment.php


I'll order up a set tonight :)
 

Attachments

  • board.png
    board.png
    55.8 KB · Views: 329
Joined
Dec 11, 2011
Messages
4,364
Points
83
I am SO GLAD to see you got it all worked out RHD! I'm sorry for not being available for the programming debugging, I've had a slew of medical priorities in the past two weeks that have kept me away.

I'm curious to see what the final code looks like. Haven't checked the coding thread yet though, so maybe it is in there.

As before, I'm honored to have had such a prominent role in the creation of such a truly breathtaking device. Cheers!
 

benmwv

0
Joined
Sep 10, 2010
Messages
1,380
Points
48
Wow, I can only imagine how amazing that is in person! First thing I would do is take the rainbow laser stargazing if I had it :D
 




Top