User avatar
By slicerd1
#4905264
Hey All,

While I am fortunate enough to own a matty PKE I hate the idea of losing/breaking it and not wanting to spend $300 on a new one. I started printing some thingiverse versions but while some of models are very nice they all missing major features or were very hard to print. So I have built my own model and electronics to go with it. I am not a programing wizard nor electronics engineer so I will be keeping it as simple as possible. The only thing I have cut out is sound it just adds to much extra electronics so lights and motion only.

Early Rough shape. So many curved surfaces! Even the handle had curves and getting the curves and fillets to play nice was not easy. I took the opportunity to start using Fusion 360 and once I got used to its pretty sweet, and FREE!
Image

Added front pop out for screen and buttons. Also added the side insets, these were missing from many other models and that really bugged me for whatever reason.
Image

Backside with ribs, sound like a BBQ menu item.
Image

Punched holes in all the appropriate areas and created wings. I also split the model in half to be able to print on a 200x200mm printer. I have exported all these pieces and will be printing test prints so I can get a better idea of what need to change and be added for electronics.
Image

Wings with gears. I worry that I made the tolerances to tight here but only time will tell.
Image

Early electronics. The biggest issue is when you hit the button to move the wings it interrupts the leds. But if you just tap the button vs holding it down it's not super noticeable. I could just run two separate arduinos or fix the code I guess.
https://youtu.be/GYJfsJefVxk
Mrdopey, RamaSha007 liked this
User avatar
By slicerd1
#4905279
Are you going to offer these for sale if so please take my money lol
Honestly I would consider it. I could just sell the 3d printed parts or an entire kit w electronics. The later would be more effort but I am building these around specific parts but I guess I could always list a bom and people could get their own parts.
User avatar
By CountDeMonet
#4905360
That model looks great. The best recreation of the actual model I've seen yet. Nice work!

On the code side there should be no need to use two arduinos for this. Take a look at my pke code here.

https://github.com/CountDeMonet/Arduino ... _METER.ino

I show how to handle the button presses while doing the led animations at the same time. I'd be happy to take a look at the code and give suggestions if you want. I went a little more fantasy in my build but the features are similar and it has the GB2 led arm sequence already coded

User avatar
By slicerd1
#4905361
That model looks great. The best recreation of the actual model I've seen yet. Nice work!

On the code side there should be no need to use two arduinos for this. Take a look at my pke code here.

https://github.com/CountDeMonet/Arduino ... _METER.ino

I show how to handle the button presses while doing the led animations at the same time. I'd be happy to take a look at the code and give suggestions if you want. I went a little more fantasy in my build but the features are similar and it has the GB2 led arm sequence already coded



Thanks count. Your setup is pretty sweet. I wish my coding skills were up my modeling skills.

I took a look at your code but I am still a hack when it comes to this. I was able to take code that changes led speed via potentiometer and code to move servos via buttons and mashed those together. That was pushing my current skill limits. Right now it checks for button press after every led change and that's why it creates a delay. But honestly I don't have a clue how to separate the two, other than another arduino ;)

If you wanted to take a peak at my code its below and ideas or even a pointer to how I could restructure would be appreciated.

int delayTime = 0; //this is our initial time delay. We will change it by turning the rotory shaft of the pot.
#include<Servo.h>
int pos = 20;
Servo servo;
void setup()
{
//declare D2 - D11 as outputs
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(10, INPUT);
pinMode(11, INPUT);
servo.attach(9);
}
void loop()
//the loop will repeat over and over again
{
delayTime = analogRead(0);
//We are now setting our delayTIme from 0 to the number being read on A0 which is the position of the rotory shaft on the pot.

digitalWrite(2, LOW); delay(delayTime);
digitalWrite(2, HIGH); delay(delayTime);
delayTime = analogRead(0);
while (digitalRead(10) == HIGH && pos < 170) {
pos++;
servo.write(pos);
delay(5);
}
while (digitalRead(11) == HIGH && pos > 20) {
pos--;
servo.write(pos);
delay(5);
}

digitalWrite(3, LOW); delay(delayTime);
digitalWrite(3, HIGH); delay(delayTime);
delayTime = analogRead(0);
while (digitalRead(10) == HIGH && pos < 170) {
pos++;
servo.write(pos);
delay(5);
}
while (digitalRead(11) == HIGH && pos > 20) {
pos--;
servo.write(pos);
delay(5);
}

digitalWrite(4, LOW); delay(delayTime);
digitalWrite(4, HIGH); delay(delayTime);
delayTime = analogRead(0);
while (digitalRead(10) == HIGH && pos < 170) {
pos++;
servo.write(pos);
delay(5);
}
while (digitalRead(11) == HIGH && pos > 20) {
pos--;
servo.write(pos);
delay(5);
}

digitalWrite(5, LOW); delay(delayTime);
digitalWrite(5, HIGH); delay(delayTime);
delayTime = analogRead(0);
while (digitalRead(10) == HIGH && pos < 170) {
pos++;
servo.write(pos);
delay(5);
}
while (digitalRead(11) == HIGH && pos > 20) {
pos--;
servo.write(pos);
delay(5);
}

digitalWrite(6, LOW); delay(delayTime);
digitalWrite(6, HIGH); delay(delayTime);
delayTime = analogRead(0);
while (digitalRead(10) == HIGH && pos < 170) {
pos++;
servo.write(pos);
delay(5);
}
while (digitalRead(11) == HIGH && pos > 20) {
pos--;
servo.write(pos);
delay(5);
}

digitalWrite(7, LOW); delay(delayTime);
digitalWrite(7, HIGH); delay(delayTime);
delayTime = analogRead(0);
while (digitalRead(10) == HIGH && pos < 170) {
pos++;
servo.write(pos);
delay(5);
}
while (digitalRead(11) == HIGH && pos > 20) {
pos--;
servo.write(pos);
delay(5);
}

digitalWrite(8, LOW); delay(delayTime);
digitalWrite(8, HIGH); delay(delayTime);

while (digitalRead(10) == HIGH && pos < 170) {
pos++;
servo.write(pos);
delay(5);
}
while (digitalRead(11) == HIGH && pos > 20) {
pos--;
servo.write(pos);
delay(5);
}

}
User avatar
By CountDeMonet
#4905367
The big thing I see in the code are all of those delays. The delays add up and start causing your program to stall. You want to basically eliminate them and replace them with intervals. If you look at the LEDLoop function in my code one of the first things I do is grab the current time.

unsigned long currentMillis = millis();

Then using duration I can make things like animations or servo movements happen.

if ((unsigned long)(currentMillis - previousMillis) >= ledSpeed){

previousMillis holds the last time this loop did something and ledSpeed is how often it should do it. You can completely replace delays using this template.

I think if you can work out the delays you'll find the code runs a lot smoother.
User avatar
By slicerd1
#4905368
Thanks for the pointer count I will see what I can figure out.

Meanwhile I have parts printed and thought I would share actual pictures.

Comparison next to the matty PKE
Image

Full body Shot
Image

Upper body Shot
Image

Side Matty comparison
Image

Obviously there are some differences and you can see the layers but I am pretty happy overall. I have already done a bunch since I printed these including, place for potentiometer, place for servo, holes for screws, bigger button holes, hollowed out wings, wing led holes.
User avatar
By slicerd1
#4905380
The big thing I see in the code are all of those delays. The delays add up and start causing your program to stall. You want to basically eliminate them and replace them with intervals. If you look at the LEDLoop function in my code one of the first things I do is grab the current time.

unsigned long currentMillis = millis();

Then using duration I can make things like animations or servo movements happen.

if ((unsigned long)(currentMillis - previousMillis) >= ledSpeed){

previousMillis holds the last time this loop did something and ledSpeed is how often it should do it. You can completely replace delays using this template.

I think if you can work out the delays you'll find the code runs a lot smoother.
Hey Count, this was super helpful. I looked at your code and some detail online and once I wrapped my head around what it was doing it makes a lot of sense. My new code is below and it appears to work exactly the way I want.

#include<Servo.h>
int pos = 0;
Servo servo;
int LEDNum = 0; // current LED that is lit
unsigned long previousMillis; // will store last time LED was updated
unsigned long servopreviousMillis; // will store last time servo was updated

int ledSpeed = 0;
int servoSpeed = 10;

void setup() {
pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(10, INPUT);
pinMode(11, INPUT);
servo.attach(9);
}

void loop() {
unsigned long currentMillis = millis();
ledSpeed = analogRead(0);

if (currentMillis - servopreviousMillis >= servoSpeed)
{
servopreviousMillis = millis();
if (digitalRead(10) == HIGH && pos < 170) {
pos++;
servo.write(pos);
//delay(15);
}
else if (digitalRead(11) == HIGH && pos > 20) {
pos--;
servo.write(pos);
//delay(15);
}
}


if ((currentMillis - previousMillis >= ledSpeed))
{
previousMillis = millis();

if ( LEDNum == 0 ) {
digitalWrite(2, LOW);
LEDNum = 1;
} else if ( LEDNum == 1 ) {
digitalWrite(2, HIGH);
digitalWrite(3, LOW);
LEDNum = 2;
} else if ( LEDNum == 2 ) {
digitalWrite(3, HIGH);
digitalWrite(4, LOW);
LEDNum = 3;
} else if ( LEDNum == 3 ) {
digitalWrite(4, HIGH);
digitalWrite(5, LOW);
LEDNum = 4;
} else if ( LEDNum == 4 ) {
digitalWrite(5, HIGH);
digitalWrite(6, LOW);
LEDNum = 5;
} else if ( LEDNum == 5 ) {
digitalWrite(6, HIGH);
digitalWrite(7, LOW);
LEDNum = 6;
} else if ( LEDNum == 6 ) {
digitalWrite(7, HIGH);
digitalWrite(8, LOW);
LEDNum = 7;
} else if ( LEDNum == 7 ) {
digitalWrite(8, HIGH);
digitalWrite(2, LOW);
LEDNum = 1;
}
}
}
User avatar
By slicerd1
#4905399
Weideman, thanks! I am looking forward to seeing your new big project progress, pretty jealous of that.

Count, I was going to try GB1 sequence but when I figure it out I have the 7 and 4 switched. I will check it out again.

All the small things. Wings, buttons, knobs, screens, etc. I took me about 4 designs to get wings that I liked how they fit together.
Image

Testing out the wings and servo location. I am pretty happy with how it's working. The only thing I am debating is how to hold the servo in place. One screw side is cut out for the cable but I guess I can just glue it.
https://youtu.be/0v_tKaky7cg


I am struggling with getting the buttons and gear to fit into the same place. They share the same section of the handle and dont leave a lot of room to play with. Also the wings can move smoothly I was just showing that they can stop anywhere you want them too.
User avatar
By slicerd1
#4905402
I do plan on releasing the files. I might sell a few first but it will definitely hit thingiverse or similar sooner or later. I will post more about electronics here, obviously the Arduino code is already posted here and I am no wizard with electronics so the schematics will be pretty simple. I will also post a BOM so people can easily purchase all the parts they need.
Mrdopey, robpenfold, Deciusx liked this
User avatar
By Mrdopey
#4905486
I do plan on releasing the files. I might sell a few first but it will definitely hit thingiverse or similar sooner or later. I will post more about electronics here, obviously the Arduino code is already posted here and I am no wizard with electronics so the schematics will be pretty simple. I will also post a BOM so people can easily purchase all the parts they need.
I would love to purchase one as I do not have a 3d printer of my own. I look forward to hearing more on when you will offer these.

UNSUBSCRIBE! ???

I learned about these strain relief connectors bac[…]

Relaunching theecto1.com

You know I'm in

GB Headquarters and equipment

Jeffrey Shreck got a hold of 1st floor plans Lorin[…]