Klingon Proton Collector

Well I got it hooked up kinda messy on this board...
It will be better when I get the new stuff in the mail...
Here's the link...

Next is to program it to the ATTiny85...
Thanks
Michael

jameskirk:
Next is to program it to the ATTiny85...

I made a little vid for you. Sorry, some of the screen shots are blurred!

Detail of circuit below.

Well, I've got the whole KPC thing running on the tiny85.

Not without problems though. The reason is, I'm pretty sure, because of things called timers. Timers, as you would expect, allow the chip to measure short periods of time. In the sketch that we have running on the Nano uses a total of 3 timers:

  1. for use by the tone() function, which uses a timer to create a particular pitched tone
  2. for use by the analogWrite() function, which uses a timer to create the PWM signal to fade the leds
  3. for use by the delay() function, which uses a timer to time each millisecond pause

The mega328 chip on the Nano has 3 timers. But the tiny85 only has 2! As a result, the tone() function would not work on the tiny.

So I had to write an extra function to make a beep.

You see a strange pulsating effect on the fading leds on this video. It looks cool, but unfortunately you don't see it with the naked eye. Must be to do with the frame rate of the camera vs the PWM frequency.

/*
  Klingon Proton Collector Sketch
*/
 
int xleds = 4;
int levelled = 1;
int spkr = 0;
int xledDelay = 1000; // Controls the rate of the X-leds flashing

// the setup routine runs once when you press reset:
void setup() {                
  // initialize the digital pin as an output.
  pinMode(xleds, OUTPUT);
  pinMode(levelled, OUTPUT);
  pinMode(spkr, OUTPUT);
}

// the loop routine runs over and over again forever:
void loop() {
  analogWrite(levelled, map(xledDelay, 1000, 0, 0, 255));
  digitalWrite(xleds, HIGH);   // turn the LED on (HIGH is the voltage level)
  beep(50, 50);
  delay(xledDelay);               // wait for a second
  digitalWrite(xleds, LOW);    // turn the LED off by making the voltage LOW
  beep(25, 100);
  delay(xledDelay);               // wait for a second
  
  xledDelay -= (xledDelay) / 50; //increase the flashing speed a little
}

void beep(byte d, byte l) {
  
  byte v;
  noInterrupts();
  for (byte i=0; i<l; i++) {
    digitalWrite(spkr, v);
    delayMicroseconds(d);
    v = !v;
  }
  interrupts();
}

I said earlier I did not want to do it all for you, but it turns out I have. Hope its been an interesting introduction to Arduino for you, it entertained me for a couple of hours. Let us know how you get on and any problems you encounter.

As far as the capacitors on your board I can't get the .1J63
can I use these instead???
http://www.ebay.com/itm/100-x-0-1uF-50V-Ceramic-Disc-Capacitors-Free-Shipping-/280968355990?pt=LH_DefaultDomain_0&hash=item416b04e096
Also what size of capacitor is the black one you are using???
Thanks
Michael

Yes, any 0.1uF cap will be fine.

The anti-reset cap was a 10uF, but the value is not critical. Probably anything 1uF or above would work.

Here is a short clip of the programmed chip...
Not the final just the test...

Can I program the chip with the board the way it is or do I need to
move it back to the other board and program it to the final version???
Thanks
Michael

If I understand what you're asking, then yes you can upload the final kpc sketch to the tiny85 now, then move the tiny85 to the other board and connect it up to the xleds, speaker etc.

I got it finally found out what I did wrong...
Thanks
Michael

So its working on the tiny85? Great!

That 0.1uF cap wasn't just for programming. It should be with the tiny on the final circuit, as close to the tiny's Vcc and GND pins as possible. (The other, larger, cap was just or programming).

Is there a way to get the single LEDs not to flash when the other 4 are blinking in there sequence???
Also there dim when it starts up and bright when it is done...
Thanks
Michael

jameskirk:
Is there a way to get the single LEDs not to flash when the other 4 are blinking in there sequence???

They shouldn't be flashing. They are supposed to fade up gradually, like in the movie.

jameskirk:
Also there dim when it starts up and bright when it is done...

They are fading up and flashing?

It is just a slight flash not a blink...
I see it in yours also...
I also didn't see but the 2 LEDs do get brighter as it gets fuller...
Thanks
Michael

You see a strange pulsating effect on the fading leds on this video. It looks cool, but unfortunately you don't see it with the naked eye.

Is yours flashing to the naked eye? It shouldn't be...

We are good I just looked at it again with the lights out it is my eyes playing tricks on me...lol...
Thanks
Michael

Great. So how are things looking for fitting this all into the replica movie prop?

I have not finished my Klingon Proton Collector yet...
I'm doing the touch up and patching the rough spots on the prop
before I add the electronics...
Thanks
Michael

Well I finally have it done.
Here is a video clip.
Proton Collector

Wow! Was that really two years ago? What batteries did you use in the end?

I used 3 AA Batteries.

Here is what I did with the handle.
I used a magnet to turn it on and off.
Handle
Thanks for all your help Paul
Michael