#4898387
I have the initial animations working for the cyclotron. I also have new startup and shutdown animations for the powercell. I'm not 100% happy yet but not bad for an hour or two of work.

I do have a mystery to solve. Suddenly I have an audio buzz when the pack is shut down. It seems to be due to the neopixel chain but I have not yet figured out what is causing it.

EDIT: and I just solved the mystery...kinda. I moved the neopixel pin from 10 to 12 and the feedback whine in the video disappeared. I have some new tiny pops that I was able to significantly reduce by putting a 1000k resistor on the data pin to my neopixel board.

#4898449
This post may contain an affiliate link that helps support GBFans.com when you make a purchase at no additional cost to you.

One little gem I found today. I've been looking to add a few more neopixels as I don't want to be as limited as I would be with 2 open pins left in the wand for lights. I found these little guys on amazon

https://www.amazon.com/gp/product/B01AG8X1X8

And the price didn't look too bad so decided to give it a try. I'll have to be a little more creative with the existing led covers I bought but I should be able to make it work and I'll be able to control it with the existing pins. And that's a lot of LED's for other projects :)

Now I might even drill out the nfilter and stick one of these in there for the venting effect :)
#4898458
This post may contain an affiliate link that helps support GBFans.com when you make a purchase at no additional cost to you.

Demo looks great! I'm confused - you are thinking of using these for the individual LEDs?

You know they make WS2812s in the standard 5mm LED package, right? :)

https://www.amazon.com/Mokungit-50Pcs-B ... B019C9PYAA

As to the audio whine/pops (I can't really hear it, but I have tinnitus...) Adafruit recommends a cap (1000uF or bigger) on the power lines and (new to me) a small 370ohm resistor on the data line -- these may help. I've never used them, but it can't hurt.
#4898462
Yeah, I know they have the 5mm but I need smaller ones than that for this setup. I think I can hot glue these boards to the bottom of the 3mm lenses I bought.

In my case the power lines are not causing an issue. It's the data line and the 370 didn't do much so tried larger and the pops decreased. The cap did nothing. It may be moot. Once everything is separated out in the pack the noise may go away. I can hear it though :)
xoff00 liked this
#4898482
I'm starting to wrap my head around what I need to build for the permanent setup. I think I have decided on 4 separate boards to keep things small and isolated. Plus I don't have large enough protoboards to put everything in the pack on one board. The plan is to use the cat 5 cable from pack to wand to carry the power. I need 7 wires between the two packs so I'll double up the leftover wire on the power wire just to be safe. All 8 wires will be used. Here is the high level pinout/board requirements and what will be on each board. I've decided I will solder the cat5 cable directly to the protoboards instead of use connectors there to save some space.

Starting to resemble a plan I think. Now to figure out layouts that are easy to solder on my available protoboards and I still have 1 empty pin on the arduino :cool:
Code: Select all
Arduino Pins
----------------------------
power				- 5v
ground				- gnd
sb tx  				- pin 12
sb rx  				- pin 11
sb act 				- pin 13
sb rst 				- pin 10
powercell neopixel 	- pin 2

power switch     	- pin 6 
activate switch  	- pin 7
theme switch     	- pin 5
fire button      	- pin 8

nose neopixel    	- pin 3
wand light neopixel - pin 4

Soundboard Pins
----------------------------
power 				- 5v
ground				- gnd

tx					- to ardunio pin 12
rx					- to ardunio pin 11
act					- to ardunio pin 13
rst					- to ardunio pin 10

ug					- gnd

gnd					- to amp board
R					- to amp board
L					- to amp board
gnd					- to amp board

******************************
Board 1: Control board in wand
******************************
arduino

Cat 5 Cable
power/ground 5v to sound board 
5 wires to Sound/power board

2 pin for power switch
2 pin for activate switch
2 pin for theme song switch
2 pin for fire button

3 pin for neopixel nose
3 pin for neopixel wand lights

**********************************
Board 2: Sound/Power board in pack
**********************************
sound board
buck converter set at 5v

2 pin for power/ground input to buck converter 11.1v

Cat 5 Cable
 power/ground out to control board 5v
5 wires to control board

3 pin for neopixel powercell/cyclotron

4 pin to amp board

**************************
Board 3: AMP BOARD in pack
**************************
buck converter set at 5.4v
amp board
amp board

2 pin for power/ground input to buck converter 11.1v
4 pin for audio signal input

Board 4: Neopixel PowerCell/Cyclotron in pack
3 pin power/input 
4 pin powercell
4 pin cyclotron 1
4 pin cyclotron 2
4 pin cyclotron 3
3 pin cyclotron 4
xoff00 liked this
#4898540
The individual neopixels came in. They are awesome. They come attached together by the circuit board in a square 10x10 square so it is easy to make a 4x4 or a 2x2 or 1x10 even if I want. Quite nice. You do have to solder them together but small price to pay for the flexibility. I'll probably buy more of these.

I've made progress with the first board which will go in the wand. I have the layout down and I've decided that I won't be using connectors for the cat 5 cable and will solder them directly to the input pads on the protoboard. I realized there is no way those connectors can feed through the tube or any of the open areas so connectorless on that it is. It makes the board a lot smaller anyway without a 7 pin connector. I should start soldering it up here soon but had some injections in my back today so won't be hunched over my soldering table tonight.

I'm really close to the first coat of filler primer. Just a little more sanding. I did remodel the HGA and it is printing now. The one that came with the model on thingiverse looked way too small so I took the drawing in Stefans plans and scaled that to the right size. I also made the bottom solid and added 2 screw holes so I can attach it firmly with screws and glue. Just glue was concerning me. It's printing now and should be done soon. I also remodeled the n-filter with open holes so I can add the venting effect light :) I managed to get that on the pack last night.

I've been struggling with the raised circles on the cyclotron. The holes on DancinFool's model, which I based mine on, are not correct. A lot of fiddling to get it to look good. I think the yellow on black is playing with my eyes as well. It'll be good to see what it looks like when it's all gray.

Image

Luckily there is very little glue holding them on. I plan to reinforce them from the back when I install the LED's and the cups. If I need to take them off and move them I still can.
Last edited by CountDeMonet on September 21st, 2017, 5:59 pm, edited 1 time in total.
#4898545
Thanks, it's starting to all come together which is good given the date :) I feel like I might actually finish.

I also forgot to mention that I have the spacers done. Instead of wood I modeled it and printed 4 of them. 2 are longer by 5 mm. I want the bottom ones a little longer than the top as that's what I've seen in the screen caps. I also found the conduit at the home store and picked it up. It will look a lot better with it. Should make the pack a little longer too.
#4898581
I managed to get the pack mounted to the pvc frame last night. You should have seen the look on my sons face when he strapped the pack on his back today for the first time. Right now the pack with straps and everything weighs almost exactly 6 pounds. I'm planning to remove the middle brace on the frame to save some weight and once all of the electronics and stuff are mounted hopefully it'll be back up near 6 pounds. I don't want to go much heavier.

It's very similar to Grogking's pack only a lot smaller. It's about 9x15 for the dimensions and only about $6 in pvc parts. The conduit does look a lot better as the top part. My standoffs are working great.

Image

Image
grogking, xoff00 liked this
#4898582
Oh here's another question. It's one thing to reach back and pull the wand from the pack. It's a completely different affair trying to put it back. I'll probably try to find a hook to put on the wand so he can hang it on his belt as well as I don't see him being able to put it back without help. Anyone else have that trouble?
#4898598
So is this basically a hand for hamd guide as to what pin to solder to each pin?





CountDeMonet wrote:I'm starting to wrap my head around what I need to build for the permanent setup. I think I have decided on 4 separate boards to keep things small and isolated. Plus I don't have large enough protoboards to put everything in the pack on one board. The plan is to use the cat 5 cable from pack to wand to carry the power. I need 7 wires between the two packs so I'll double up the leftover wire on the power wire just to be safe. All 8 wires will be used. Here is the high level pinout/board requirements and what will be on each board. I've decided I will solder the cat5 cable directly to the protoboards instead of use connectors there to save some space.

Starting to resemble a plan I think. Now to figure out layouts that are easy to solder on my available protoboards and I still have 1 empty pin on the arduino :cool:
Code: Select all
Arduino Pins
----------------------------
power				- 5v
ground				- gnd
sb tx  				- pin 12
sb rx  				- pin 11
sb act 				- pin 13
sb rst 				- pin 10
powercell neopixel 	- pin 2

power switch     	- pin 6 
activate switch  	- pin 7
theme switch     	- pin 5
fire button      	- pin 8

nose neopixel    	- pin 3
wand light neopixel - pin 4

Soundboard Pins
----------------------------
power 				- 5v
ground				- gnd

tx					- to ardunio pin 12
rx					- to ardunio pin 11
act					- to ardunio pin 13
rst					- to ardunio pin 10

ug					- gnd

gnd					- to amp board
R					- to amp board
L					- to amp board
gnd					- to amp board

******************************
Board 1: Control board in wand
******************************
arduino

Cat 5 Cable
power/ground 5v to sound board 
5 wires to Sound/power board

2 pin for power switch
2 pin for activate switch
2 pin for theme song switch
2 pin for fire button

3 pin for neopixel nose
3 pin for neopixel wand lights

**********************************
Board 2: Sound/Power board in pack
**********************************
sound board
buck converter set at 5v

2 pin for power/ground input to buck converter 11.1v

Cat 5 Cable
 power/ground out to control board 5v
5 wires to control board

3 pin for neopixel powercell/cyclotron

4 pin to amp board

**************************
Board 3: AMP BOARD in pack
**************************
buck converter set at 5.4v
amp board
amp board

2 pin for power/ground input to buck converter 11.1v
4 pin for audio signal input

Board 4: Neopixel PowerCell/Cyclotron in pack
3 pin power/input 
4 pin powercell
4 pin cyclotron 1
4 pin cyclotron 2
4 pin cyclotron 3
3 pin cyclotron 4
#4898599
I'll have to do something similar. I'm sure the home store has a few options to look at.

The raised rings on the cyclotron have been really bothering me and I couldn't figure out why. I knew they were not quite in the right location but it turns out they were also not properly scaled. I took Stefan's drawings and remade them to scale for the pack (the pack is ay 83% but the cyclotron is a little smaller at 79% so I could print it in one piece on my printer). They are quite a bit bigger now and I made inserts so they will fit right into the holes and line up where they need to go. As you can see the original was off by quite a bit and not symmetrical at all. This should take the guessing out of placing them. I just have to get them rotated right :)

Image
#4898601
ghosthunter64 wrote:So is this basically a hand for hamd guide as to what pin to solder to each pin?
Yeah, these are my notes so I get things right on the board. It's not complete. For instance the 2 pin connectors for the switches have one pin go to the arduino and then the other to the common ground. The 3 pins for the neopixels have 1 for 5v, 1 for ground, and 1 for the pin to the arduino.

To give you a for instance I drew up a schematic in EAGLE for the arduino input board. It would be $13.50 to get 3 of these boards made by Oshpark. I'm just going to hand build it as it's cheaper but I like to have the board layouts ready if I do ever have a chance to purchase them.

Image

The 5 pin and 2 pin connectors on the top left are the power and data wires to the pack, the 2 pin connectors on the right are the input switch and button connectors, and the 2 3 pin ones on the bottom are for the neopixels. When I drew this up I was still planning on connectors for the main power/ground/pack data wires. I'm now going to just solder those directly to the board to save space
#4898604
Here is the final layout I'll be building by hand. My back is still killing me so it won't be tonight but I have the layout ready for when I'm feeling healthy.

I'll be cutting the board on the yellow line to keep it as small as possible. The cat 5 cable will be soldered to the pads on the right and it's oriented to make the power and ground runs as interference free as possible. The input connectors are positioned so they are as close to the arduino pins they connect to as possible as well. The arduino is positioned so I can update the code if I need to.

Image

I'm still developing all of this but I will draw things up as best as I can once I have it all figured out. Hopefully this is helpful for people following along. Getting feedback with all of this has certainly made the design better
#4898606
I'm posting everything I have here as it is finalized: https://github.com/CountDeMonet/ArduinoProtonPack

The board designs will be there as well. I've never used this connector library before so I'm tempted to get the neopixel board fabricated to see how well the lib lines up with reality. That board would only be about $3. I still have the sound board and the amp boards to draw up. Those are next on my plate after the arduino.

I have been moving pins around to simplify things. For instance the sound board pins have been moved to 10, 11, 12, and 13. The neopixel pins have moved 2-4 to get them away from the sound board pins, and the inputs are now in the middle of the arduino from 5-8. I'm still using common power for everything needing external power from the buck converter set to 5v. I don't power anything in this setup off the arduino.
#4898646
I've done a bit of coding tonight and added an option to turn on the cyclotron effect from the ghostbusters video game. This is where the trailing light fades away instead of just turning off in the cyclotron light sequence. All of that code is uploaded now. I'm getting to the point where I will need to do a bit of cleanup but it's working

For anyone who has been lucky to get their spirit proton packs I've made available a subset of the code. Using just 1 pin on an arduino you can have the idle powercell and cyclotron lights. This is what I plan to throw together when my Spirit pack comes in. If it comes in I guess. That code is here and it works nicely:

https://github.com/CountDeMonet/Arduino ... itMinimial
#4898652
On the github you mention that if you want to use the bargraph you need to re-insert the separate bargraph code and "update the stub functions".

Sadly I'm not anywhere near as competent in the Arduino environment as I'd like to be, so... any chance at getting that elaborated on a little bit? Even if you just say which lines go where, I can do the rest.

Also, this project is awesome and you're awesome for sharing all the deets with us.
#4898653
Not a problem at all. This is a ton of fun for me :) All of this assumes you are using a 15 led bar graph. I'm combining a 5 led and a 10 led bargraph from Digikey.

From the bargraph_code.ino you need to do the following:

What this chunk does is include the sx1509 libraries and sets up the configuration. This assumes the library is configured stock and the address has not been changed. It also defines the LED locations for the bar graph. Take this code and insert it into the header of the Neutrino_Wand.ino file
Code: Select all
#include <Wire.h> // Include the I2C library (required)
#include <SparkFunSX1509.h> // Include SX1509 library

// SX1509 I2C address (set by ADDR1 and ADDR0 (00 by default):
const byte SX1509_ADDRESS = 0x3E;  // SX1509 I2C address
SX1509 io; // Create an SX1509 object to be used throughout

// bargraph helper variables
int seq_1_current = 0;  // current led in sequence 1
const int num_led = 15; // total number of leds in bar graph

// SX1509 pin definitions for the leds on the graph:
const byte SX1509_BAR_01 = 0;
const byte SX1509_BAR_02 = 1;
const byte SX1509_BAR_03 = 2;
const byte SX1509_BAR_04 = 3;
const byte SX1509_BAR_05 = 4;
const byte SX1509_BAR_06 = 5;
const byte SX1509_BAR_07 = 6;
const byte SX1509_BAR_08 = 7;
const byte SX1509_BAR_09 = 8;
const byte SX1509_BAR_10 = 9;
const byte SX1509_BAR_11 = 10;
const byte SX1509_BAR_12 = 11;
const byte SX1509_BAR_13 = 12;
const byte SX1509_BAR_14 = 13;
const byte SX1509_BAR_15 = 14;
The next chunk is added to the setup() function. This initialized the sx1509 board and makes sure the arduino is communicating. It configures the pin modes for the LED's as inputs and shutdown all of the LED's so they are not lit
Code: Select all
  // Call io.begin(<address>) to initialize the SX1509. If it
  // successfully communicates, it'll return 1.
  if (!io.begin(SX1509_ADDRESS)) {
    while (1) ; // If we fail to communicate, loop forever for now but it would be nice to warn the user somehow
  }
  
  // configuration for the bargraph LED's
  io.pinMode(SX1509_BAR_01, OUTPUT);
  io.pinMode(SX1509_BAR_02, OUTPUT);
  io.pinMode(SX1509_BAR_03, OUTPUT);
  io.pinMode(SX1509_BAR_04, OUTPUT);
  io.pinMode(SX1509_BAR_05, OUTPUT);
  io.pinMode(SX1509_BAR_06, OUTPUT);
  io.pinMode(SX1509_BAR_07, OUTPUT);
  io.pinMode(SX1509_BAR_08, OUTPUT);
  io.pinMode(SX1509_BAR_09, OUTPUT);
  io.pinMode(SX1509_BAR_10, OUTPUT);
  io.pinMode(SX1509_BAR_11, OUTPUT);
  io.pinMode(SX1509_BAR_12, OUTPUT);
  io.pinMode(SX1509_BAR_13, OUTPUT);
  io.pinMode(SX1509_BAR_14, OUTPUT);
  io.pinMode(SX1509_BAR_15, OUTPUT);

  // set everything off initially
  shutdown_leds();
Right above the Loop() function in neutrino_wand.ino there are a number of intervals defined. The interval for the bargraph is already defined in neutrino_wand.ino. What this does is defines how often the bar graph is updated. If you wanted to speed up the bargraph this is the variable you would adjust. We define it here because in the main loop() we update this parameter so the bargraph can go faster when firing
Code: Select all
long firing_interval = 40;    // interval at which to cycle firing lights on the bargraph. We update this in the loop to speed up the animation so must be declared here (milliseconds).
The last part is to replace the stub functions in neutrino_wand.ino. At the very bottom of the neutrino_wand.ino file you will see these stubs
Code: Select all
/*************** Bar Graph Animations *********************/
void shutdown_leds() {
  // stubb function for when I re-enable to bargraph
}
void barGraphSequenceOne(int currentMillis) {
  // stubb function for when I re-enable to bargraph
}
void barGraphSequenceTwo(int currentMillis) {
  // stubb function for when I re-enable to bargraph
}
I kept the code that calls the bargraph in the file so all you have to do is update these stubs with the actual code. Simply copy this code and replace the stubbs with this.
Code: Select all
/*************** Bar Graph Animations *********************/
// This is the idle sequence
unsigned long prevBarMillis_on = 0;   // bargraph on tracker
const int pwrcl_interval = 60;     // interval at which to cycle lights (milliseconds).
bool reverseSequenceOne = false;

void barGraphSequenceOne(int currentMillis) {
  // normal sync animation on the bar graph
  if (currentMillis - prevBarMillis_on > pwrcl_interval) {
    // save the last time you blinked the LED
    prevBarMillis_on = currentMillis;

    if ( reverseSequenceOne == false ) {
      switch_graph_led(seq_1_current, HIGH);
      seq_1_current++;
      if ( seq_1_current > num_led ) {
        reverseSequenceOne = true;
      }
    } else {
      switch_graph_led(seq_1_current, LOW);
      seq_1_current--;
      if ( seq_1_current < 0  ) {
        reverseSequenceOne = false;
      }
    }
  }
}

// This is the firing sequence
unsigned long prevBarMillis_fire = 0; // bargraph firing tracker
int fireSequenceNum = 1;

void barGraphSequenceTwo(int currentMillis) {
  if (currentMillis - prevBarMillis_fire > firing_interval) {
    // save the last time you blinked the LED
    prevBarMillis_fire = currentMillis;

    switch (fireSequenceNum) {
      case 1:
        switch_graph_led(2, LOW);
        switch_graph_led(14, LOW);
        switch_graph_led(1, HIGH);
        switch_graph_led(15, HIGH);
        fireSequenceNum++;
        break;
      case 2:
        switch_graph_led(1, LOW);
        switch_graph_led(15, LOW);
        switch_graph_led(2, HIGH);
        switch_graph_led(14, HIGH);
        fireSequenceNum++;
        break;
      case 3:
        switch_graph_led(2, LOW);
        switch_graph_led(14, LOW);
        switch_graph_led(3, HIGH);
        switch_graph_led(13, HIGH);
        fireSequenceNum++;
        break;
      case 4:
        switch_graph_led(3, LOW);
        switch_graph_led(13, LOW);
        switch_graph_led(4, HIGH);
        switch_graph_led(12, HIGH);
        fireSequenceNum++;
        break;
      case 5:
        switch_graph_led(4, LOW);
        switch_graph_led(12, LOW);
        switch_graph_led(5, HIGH);
        switch_graph_led(11, HIGH);
        fireSequenceNum++;
        break;
      case 6:
        switch_graph_led(5, LOW);
        switch_graph_led(11, LOW);
        switch_graph_led(6, HIGH);
        switch_graph_led(10, HIGH);
        fireSequenceNum++;
        break;
      case 7:
        switch_graph_led(6, LOW);
        switch_graph_led(10, LOW);
        switch_graph_led(7, HIGH);
        switch_graph_led(9, HIGH);
        fireSequenceNum++;
        break;
      case 8:
        switch_graph_led(7, LOW);
        switch_graph_led(9, LOW);
        switch_graph_led(6, HIGH);
        switch_graph_led(10, HIGH);
        fireSequenceNum++;
        break;
      case 9:
        switch_graph_led(6, LOW);
        switch_graph_led(10, LOW);
        switch_graph_led(5, HIGH);
        switch_graph_led(11, HIGH);
        fireSequenceNum++;
        break;
      case 10:
        switch_graph_led(5, LOW);
        switch_graph_led(11, LOW);
        switch_graph_led(4, HIGH);
        switch_graph_led(12, HIGH);
        fireSequenceNum++;
        break;
      case 11:
        switch_graph_led(4, LOW);
        switch_graph_led(12, LOW);
        switch_graph_led(3, HIGH);
        switch_graph_led(13, HIGH);
        fireSequenceNum++;
        break;
      case 12:
        switch_graph_led(3, LOW);
        switch_graph_led(13, LOW);
        switch_graph_led(2, HIGH);
        switch_graph_led(14, HIGH);
        fireSequenceNum = 1;
        break;
    }
  }
}

/************************* Shutdown and helper functions ****************************/
void shutdown_leds() {
  // reset the sequence
  seq_1_current = 1;
  fireSequenceNum = 1;

  // shut all led's off
  for (int i = 1; i <= 15; i++) {
    switch_graph_led(i, LOW);
  }
}

void switch_graph_led(int num, int state) {
  switch (num) {
    case 1:
      io.digitalWrite(SX1509_BAR_01, state);
      break;
    case 2:
      io.digitalWrite(SX1509_BAR_02, state);
      break;
    case 3:
      io.digitalWrite(SX1509_BAR_03, state);
      break;
    case 4:
      io.digitalWrite(SX1509_BAR_04, state);
      break;
    case 5:
      io.digitalWrite(SX1509_BAR_05, state);
      break;
    case 6:
      io.digitalWrite(SX1509_BAR_06, state);
      break;
    case 7:
      io.digitalWrite(SX1509_BAR_07, state);
      break;
    case 8:
      io.digitalWrite(SX1509_BAR_08, state);
      break;
    case 9:
      io.digitalWrite(SX1509_BAR_09, state);
      break;
    case 10:
      io.digitalWrite(SX1509_BAR_10, state);
      break;
    case 11:
      io.digitalWrite(SX1509_BAR_11, state);
      break;
    case 12:
      io.digitalWrite(SX1509_BAR_12, state);
      break;
    case 13:
      io.digitalWrite(SX1509_BAR_13, state);
      break;
    case 14:
      io.digitalWrite(SX1509_BAR_14, state);
      break;
    case 15:
      io.digitalWrite(SX1509_BAR_15, state);
      break;
  }
}
And with that everything should work. You'll have the idle animation on the bar graph and the firing animation with the speed increasing as you hold the button down as I showed in some of the videos.
#4898656
I'm ready for filler primer. This is exciting. I can't wait to see what it looks like once it's all uniform in color. Of course we'll get to see all of my mistakes :) I fitted the bumper last night. I had to move it up a little and create some spacers. When I tightened it down for the first time the twisting pressure caused one of the glue seams to break. I had to insert a rod into it and reglue with gorilla glue. With the spacers there is no twisting pressure so it should not be an issue again.

Image

and here it is for those of you that just can't handle the sight of the left handed pack :)

Image
#4898688
CountDeMonet wrote:Not a problem at all. This is a ton of fun for me :) All of this assumes you are using a 15 led bar graph. I'm combining a 5 led and a 10 led bargraph from Digikey.

From the bargraph_code.ino you need to do the following:

What this chunk does is include the sx1509 libraries and sets up the configuration. This assumes the library is configured stock and the address has not been changed. It also defines the LED locations for the bar graph. Take this code and insert it into the header of the Neutrino_Wand.ino file
Code: Select all
#include <Wire.h> // Include the I2C library (required)
#include <SparkFunSX1509.h> // Include SX1509 library

// SX1509 I2C address (set by ADDR1 and ADDR0 (00 by default):
const byte SX1509_ADDRESS = 0x3E;  // SX1509 I2C address
SX1509 io; // Create an SX1509 object to be used throughout

// bargraph helper variables
int seq_1_current = 0;  // current led in sequence 1
const int num_led = 15; // total number of leds in bar graph

// SX1509 pin definitions for the leds on the graph:
const byte SX1509_BAR_01 = 0;
const byte SX1509_BAR_02 = 1;
const byte SX1509_BAR_03 = 2;
const byte SX1509_BAR_04 = 3;
const byte SX1509_BAR_05 = 4;
const byte SX1509_BAR_06 = 5;
const byte SX1509_BAR_07 = 6;
const byte SX1509_BAR_08 = 7;
const byte SX1509_BAR_09 = 8;
const byte SX1509_BAR_10 = 9;
const byte SX1509_BAR_11 = 10;
const byte SX1509_BAR_12 = 11;
const byte SX1509_BAR_13 = 12;
const byte SX1509_BAR_14 = 13;
const byte SX1509_BAR_15 = 14;
The next chunk is added to the setup() function. This initialized the sx1509 board and makes sure the arduino is communicating. It configures the pin modes for the LED's as inputs and shutdown all of the LED's so they are not lit
Code: Select all
  // Call io.begin(<address>) to initialize the SX1509. If it
  // successfully communicates, it'll return 1.
  if (!io.begin(SX1509_ADDRESS)) {
    while (1) ; // If we fail to communicate, loop forever for now but it would be nice to warn the user somehow
  }
  
  // configuration for the bargraph LED's
  io.pinMode(SX1509_BAR_01, OUTPUT);
  io.pinMode(SX1509_BAR_02, OUTPUT);
  io.pinMode(SX1509_BAR_03, OUTPUT);
  io.pinMode(SX1509_BAR_04, OUTPUT);
  io.pinMode(SX1509_BAR_05, OUTPUT);
  io.pinMode(SX1509_BAR_06, OUTPUT);
  io.pinMode(SX1509_BAR_07, OUTPUT);
  io.pinMode(SX1509_BAR_08, OUTPUT);
  io.pinMode(SX1509_BAR_09, OUTPUT);
  io.pinMode(SX1509_BAR_10, OUTPUT);
  io.pinMode(SX1509_BAR_11, OUTPUT);
  io.pinMode(SX1509_BAR_12, OUTPUT);
  io.pinMode(SX1509_BAR_13, OUTPUT);
  io.pinMode(SX1509_BAR_14, OUTPUT);
  io.pinMode(SX1509_BAR_15, OUTPUT);

  // set everything off initially
  shutdown_leds();
Right above the Loop() function in neutrino_wand.ino there are a number of intervals defined. The interval for the bargraph is already defined in neutrino_wand.ino. What this does is defines how often the bar graph is updated. If you wanted to speed up the bargraph this is the variable you would adjust. We define it here because in the main loop() we update this parameter so the bargraph can go faster when firing
Code: Select all
long firing_interval = 40;    // interval at which to cycle firing lights on the bargraph. We update this in the loop to speed up the animation so must be declared here (milliseconds).
The last part is to replace the stub functions in neutrino_wand.ino. At the very bottom of the neutrino_wand.ino file you will see these stubs
Code: Select all
/*************** Bar Graph Animations *********************/
void shutdown_leds() {
  // stubb function for when I re-enable to bargraph
}
void barGraphSequenceOne(int currentMillis) {
  // stubb function for when I re-enable to bargraph
}
void barGraphSequenceTwo(int currentMillis) {
  // stubb function for when I re-enable to bargraph
}
I kept the code that calls the bargraph in the file so all you have to do is update these stubs with the actual code. Simply copy this code and replace the stubbs with this.
Code: Select all
/*************** Bar Graph Animations *********************/
// This is the idle sequence
unsigned long prevBarMillis_on = 0;   // bargraph on tracker
const int pwrcl_interval = 60;     // interval at which to cycle lights (milliseconds).
bool reverseSequenceOne = false;

void barGraphSequenceOne(int currentMillis) {
  // normal sync animation on the bar graph
  if (currentMillis - prevBarMillis_on > pwrcl_interval) {
    // save the last time you blinked the LED
    prevBarMillis_on = currentMillis;

    if ( reverseSequenceOne == false ) {
      switch_graph_led(seq_1_current, HIGH);
      seq_1_current++;
      if ( seq_1_current > num_led ) {
        reverseSequenceOne = true;
      }
    } else {
      switch_graph_led(seq_1_current, LOW);
      seq_1_current--;
      if ( seq_1_current < 0  ) {
        reverseSequenceOne = false;
      }
    }
  }
}

// This is the firing sequence
unsigned long prevBarMillis_fire = 0; // bargraph firing tracker
int fireSequenceNum = 1;

void barGraphSequenceTwo(int currentMillis) {
  if (currentMillis - prevBarMillis_fire > firing_interval) {
    // save the last time you blinked the LED
    prevBarMillis_fire = currentMillis;

    switch (fireSequenceNum) {
      case 1:
        switch_graph_led(2, LOW);
        switch_graph_led(14, LOW);
        switch_graph_led(1, HIGH);
        switch_graph_led(15, HIGH);
        fireSequenceNum++;
        break;
      case 2:
        switch_graph_led(1, LOW);
        switch_graph_led(15, LOW);
        switch_graph_led(2, HIGH);
        switch_graph_led(14, HIGH);
        fireSequenceNum++;
        break;
      case 3:
        switch_graph_led(2, LOW);
        switch_graph_led(14, LOW);
        switch_graph_led(3, HIGH);
        switch_graph_led(13, HIGH);
        fireSequenceNum++;
        break;
      case 4:
        switch_graph_led(3, LOW);
        switch_graph_led(13, LOW);
        switch_graph_led(4, HIGH);
        switch_graph_led(12, HIGH);
        fireSequenceNum++;
        break;
      case 5:
        switch_graph_led(4, LOW);
        switch_graph_led(12, LOW);
        switch_graph_led(5, HIGH);
        switch_graph_led(11, HIGH);
        fireSequenceNum++;
        break;
      case 6:
        switch_graph_led(5, LOW);
        switch_graph_led(11, LOW);
        switch_graph_led(6, HIGH);
        switch_graph_led(10, HIGH);
        fireSequenceNum++;
        break;
      case 7:
        switch_graph_led(6, LOW);
        switch_graph_led(10, LOW);
        switch_graph_led(7, HIGH);
        switch_graph_led(9, HIGH);
        fireSequenceNum++;
        break;
      case 8:
        switch_graph_led(7, LOW);
        switch_graph_led(9, LOW);
        switch_graph_led(6, HIGH);
        switch_graph_led(10, HIGH);
        fireSequenceNum++;
        break;
      case 9:
        switch_graph_led(6, LOW);
        switch_graph_led(10, LOW);
        switch_graph_led(5, HIGH);
        switch_graph_led(11, HIGH);
        fireSequenceNum++;
        break;
      case 10:
        switch_graph_led(5, LOW);
        switch_graph_led(11, LOW);
        switch_graph_led(4, HIGH);
        switch_graph_led(12, HIGH);
        fireSequenceNum++;
        break;
      case 11:
        switch_graph_led(4, LOW);
        switch_graph_led(12, LOW);
        switch_graph_led(3, HIGH);
        switch_graph_led(13, HIGH);
        fireSequenceNum++;
        break;
      case 12:
        switch_graph_led(3, LOW);
        switch_graph_led(13, LOW);
        switch_graph_led(2, HIGH);
        switch_graph_led(14, HIGH);
        fireSequenceNum = 1;
        break;
    }
  }
}

/************************* Shutdown and helper functions ****************************/
void shutdown_leds() {
  // reset the sequence
  seq_1_current = 1;
  fireSequenceNum = 1;

  // shut all led's off
  for (int i = 1; i <= 15; i++) {
    switch_graph_led(i, LOW);
  }
}

void switch_graph_led(int num, int state) {
  switch (num) {
    case 1:
      io.digitalWrite(SX1509_BAR_01, state);
      break;
    case 2:
      io.digitalWrite(SX1509_BAR_02, state);
      break;
    case 3:
      io.digitalWrite(SX1509_BAR_03, state);
      break;
    case 4:
      io.digitalWrite(SX1509_BAR_04, state);
      break;
    case 5:
      io.digitalWrite(SX1509_BAR_05, state);
      break;
    case 6:
      io.digitalWrite(SX1509_BAR_06, state);
      break;
    case 7:
      io.digitalWrite(SX1509_BAR_07, state);
      break;
    case 8:
      io.digitalWrite(SX1509_BAR_08, state);
      break;
    case 9:
      io.digitalWrite(SX1509_BAR_09, state);
      break;
    case 10:
      io.digitalWrite(SX1509_BAR_10, state);
      break;
    case 11:
      io.digitalWrite(SX1509_BAR_11, state);
      break;
    case 12:
      io.digitalWrite(SX1509_BAR_12, state);
      break;
    case 13:
      io.digitalWrite(SX1509_BAR_13, state);
      break;
    case 14:
      io.digitalWrite(SX1509_BAR_14, state);
      break;
    case 15:
      io.digitalWrite(SX1509_BAR_15, state);
      break;
  }
}
And with that everything should work. You'll have the idle animation on the bar graph and the firing animation with the speed increasing as you hold the button down as I showed in some of the videos.
Awesome! Thanks so much for that.

From what I can tell, there's nothing inherently special about the bar graph modules besides them being a collection of LEDs in one package. If I read your circuit correctly you're feeding the I/O expander 5v and running each LED through a 330ohm resistor (via a network in your case), set up to sink current (as the I/O expander can sink far more current per pin than it can source) - so the grounds are connected to the pins and the LEDs are independently powered.

If that's true, there's no reason I can't just use 15 stacked yellow rectangular LEDs and 15 of the correct value of resistor. The form will be different but the function will be identical.

Also, I'm building this for someone, and they've apparently been talking to you about adding a blinking red LED somewhere for the "overheat" mode. If you wind up doing that, could you PM me the details on integrating it with the existing code?
#4898690
KoNP wrote: Awesome! Thanks so much for that.

From what I can tell, there's nothing inherently special about the bar graph modules besides them being a collection of LEDs in one package. If I read your circuit correctly you're feeding the I/O expander 5v and running each LED through a 330ohm resistor (via a network in your case), set up to sink current (as the I/O expander can sink far more current per pin than it can source) - so the grounds are connected to the pins and the LEDs are independently powered.

If that's true, there's no reason I can't just use 15 stacked yellow rectangular LEDs and 15 of the correct value of resistor. The form will be different but the function will be identical.

Also, I'm building this for someone, and they've apparently been talking to you about adding a blinking red LED somewhere for the "overheat" mode. If you wind up doing that, could you PM me the details on integrating it with the existing code?

*cough* Fancy seeing you here. :cool:

It's the upper light next to the grill, the Arcoelectric.
It's not quite screen accurate but I figure it would be a neat thing so the wand has something to do during an "overheat".
#4898691
Correct, you can use any type of led you want. I just used the premade bargraphs. I have the resistors on the ground side as it simplified wiring for my setup for sourcing. Current draw is half the available current wired that way with the 330. You can wire that however you want though. Xoff00 has a board he made to do the sinking current.

I just pulled the individual LEDs I'll be using for the wand lights and the pack venting in the nfilter to solder. My next step is to add those to the pack code once I've soldered them up. I'm using individual neopixels for that.
#4898724
I worked on the pack a little more today. I added in 4 neopixels for the wand lights. I'm still debating between the blinking led on top of the wand like some of the other packs around here have or to just have it light up when it's in a warning state. This demo also shows the new video game style cyclotron animation which I think is cool. The firing strobe animation has been slowed down and updated as well. Next I work on the venting flicker for the nfilter and the code should be just about done (until I wanna change something else lol)

I hit the main pack with an entire can of filler primer today. Tomorrow I sand and hit it with another can of filler primer as there are still some gaps that need filling. It's looking really good though. After I do the next round I'll post some pictures.

#4898745
Thanks! I appreciate that. I hope to eventually have everything documented really well and the boards available for fabrication so this is as easy as possible to build. I won't be able to order the test boards from OshPark until next year but having hand built everything for my son's pack the design should be pretty well vetted by then
  • 1
  • 6
  • 7
  • 8
  • 9
  • 10
  • 25

My Little Pony/Ghostbusters crossover done by my d[…]

Great work identifying the RS Temperature Control […]

I read Back in Town #1. Spoilers : Hate to b[…]

I'd really like to see the new t-shirt unlocks tra[…]