Good micro processor

djsfantasi

Joined Apr 11, 2010
9,155
Honestly not well experienced in C+ basic but I’m learning more all the time by reading and experimenting with different commandS
Check out the Halloween-L group on Facebook. You’ll find many projects animating skeletons or other props using an Arduino and RC servos.

The Arduino and Adafruit shield is an EXCELLENT choice for your project. You just need to read more about how people are using it in Halloween props.

I’ve mentioned my project several times, so I thought I’d post a video. This animatronic uses an Arduino and 11 RC servos. And in addition to the movement, it controls an MP3 shield to make the animatronic talk. And the Arduino has an Ethernet shield so multiple characters collaborate and have conversations, sing in multipart harmony, etc...

So I’m confident an Arduino will work for you.

 

strantor

Joined Oct 3, 2010
6,781
Any single core processor that you pick is only going to be able to do "one thing at a time". The thing is that it can do so many things one thing at a time, that on timescales within our perception it looks like they are happening simultaneously.

We have a reaction time to a visual stimulus on the order of 0.25 seconds.

In that 0.25 seconds, an ATmega328 running with a 16 MHz. clock can execute 4,000,000 instructions because each "one thing at a time" instruction takes only 62.5 nanoseconds. I know that you might not be familiar with nanoseconds, but there are one billion of them in one second or 250,000,000 in one quarter of a second. I think it is a pretty big stretch to conclude that an Arduino will have trouble performing what seems like a series of simple choreographed tasks.

If you are still not convinced then, maybe you cold think about doing the servos with one and doing the pneumatics with another. They could even communicate with each other on when certain events are scheduled to happen and finish.
Ok. makes. What is your opinion on the parallax propeller?
They specifically claim simultaneous multi tasking.
What @Papabravo is saying, is that your concern about "only doing one thing at a time" is misplaced. All microcontrollers (incl this propeller) "only do one thing at a time," and they all do it so blazing fast that it's (for all practical purposes) simultaneous.

If you think that an arduino "only does one thing at a time" in any way that matters, then you are mistaken. An arduino is way more than capable of running your animatronic Halloween decorations. In fact a single arduino could probably automate a whole yard full of them simultaneously.

I 100% agree with other suggestions that arduino is your best bet. This parallax thing is no different than arduino in any practical sense and it will only be harder to get help with as it has a much smaller support base.
 

be80be

Joined Jul 5, 2008
2,072
Its simple what he wants and what he needs are 2 different things.
The arduino would do what he needs he just needs to work on putting the parts together and code to get it going more cores just going to make it harder code wise.
 

strantor

Joined Oct 3, 2010
6,781
I have been going about a repetitive task in mental autopilot, with the front of my unhealthy dual core celeron brain occupied by (1) an annoying k-pop song that's been stuck there since yesterday and (2) pondering what situation @navyguy could have possibly gotten himself into that led him to believe that arduino wasn't suited to the task.

I have $5 on the delay() command. When you use this, it halts your entire program for the duration specified, and anything else you wanted to happen during this time, won't happen. Am I hot or cold?
 

Beau Schwabe

Joined Nov 7, 2019
155
I'm not going to try and sell Parallax, as I was an employee there for 10 years and after 10 years quite frankly have a bad taste in my mouth.

However, I will explain the multi core .... Imagine a 1 lane road as a normal processor (once kind of car). Now imagine an 8 core processor as having 8 lanes with the possibility of having 8 unique different cars in each lane. Each car has independent functionality within each car (passengers doing stuff inside of the car... playing games, singing, etc.) but you also have the ability to communicate and share information from one car to the other, i.e blinker, horn, brakes, yelling out the window, etc.

I have been a PIC assembly programmer for nearly 30 years and actually prefer that over anything at the moment, but what your asking for mostly comes down to technique and experience and can be accomplished on any micro controller in just about any language.

Bear with me, I am a little old-school, but I firmly believe in creating a flow chart of what it is that you want to do. Then convert the flowchart into a state machine (or treat it as a state machine from the beginning).

You could stop there, or you can take this a step further. Design each node in your flowchart as a fall-through module meaning that no part of the flow chart will result in an endless loop or delay, instead allow the flow chart to facilitate the advancement of a state machine index when certain conditions are met in each node. In this way you can process the flow chart (state machine) in such a way that you can integrate more state machines.... this only works if the state machine is index based where each additional state machine has it's own independent index counter. Even a step further you can take the index counters into a dispatch mode where each node returns to a common dispatcher that directs the next node to execute but not necessary for this application. Again each level is based on experience.

In your case for example utilize your servo "dead time" ... A servo only requires a position pulse of 1-2 ms every 20ms. During that 20 ms of dead time, you could be doing a bunch of other stuff, where the perception would be simultaneous action. The Servo handler would be one "state machine", and the other stuff would be a second, third, or fourth "state machine", as I briefly mentioned above.
 

jpanhalt

Joined Jan 18, 2008
11,087
Ok. makes. What is your opinion on the parallax propeller?
They specifically claim simultaneous multi tasking.
My earlier reply was too brief. I think the Parallax propeller is overkill.

There has been some discussion about making the servos act simultaneously. As others point out, the small time it takes for an MCU to make changes in not noticeable; however, you can get simultaneous changes if needed. Assume each servo is attached to a separate pin of the MCU, which seems likely if they are moving differently.* If they are all on the same port, that port can be set and updated simultaneously. If one assumes inexpensive servos with an 8 us dead band (i.e., any change in signal must for >= 8 us for the servo to respond, you could update that port every 6 to 8 us with new settings. Eight microseconds with a clock of 32 mHz and a PIC16Fxxxx MCU would allow 64 instructions between each update.

Again, I don't think simultaneous action is necessary, but there might be an advantage to having the servo control pulses in parallel as that leaves approximately 18 ms or more per frame for the MCU to do something else.

*This assumes a simple, 1 signal line per servo. Things are evolving, and serial bus servos are becoming more common (e.g., https://www.amazon.com/LewanSoul-Real-Time-Feedback-Position-Temperature/dp/B073WR3SK9 ).
 

djsfantasi

Joined Apr 11, 2010
9,155
I'm not going to try and sell Parallax, as I was an employee there for 10 years and after 10 years quite frankly have a bad taste in my mouth.

However, I will explain the multi core .... Imagine a 1 lane road as a normal processor (once kind of car). Now imagine an 8 core processor as having 8 lanes with the possibility of having 8 unique different cars in each lane. Each car has independent functionality within each car (passengers doing stuff inside of the car... playing games, singing, etc.) but you also have the ability to communicate and share information from one car to the other, i.e blinker, horn, brakes, yelling out the window, etc.

I have been a PIC assembly programmer for nearly 30 years and actually prefer that over anything at the moment, but what your asking for mostly comes down to technique and experience and can be accomplished on any micro controller in just about any language.

Bear with me, I am a little old-school, but I firmly believe in creating a flow chart of what it is that you want to do. Then convert the flowchart into a state machine (or treat it as a state machine from the beginning).

You could stop there, or you can take this a step further. Design each node in your flowchart as a fall-through module meaning that no part of the flow chart will result in an endless loop or delay, instead allow the flow chart to facilitate the advancement of a state machine index when certain conditions are met in each node. In this way you can process the flow chart (state machine) in such a way that you can integrate more state machines.... this only works if the state machine is index based where each additional state machine has it's own independent index counter. Even a step further you can take the index counters into a dispatch mode where each node returns to a common dispatcher that directs the next node to execute but not necessary for this application. Again each level is based on experience.

In your case for example utilize your servo "dead time" ... A servo only requires a position pulse of 1-2 ms every 20ms. During that 20 ms of dead time, you could be doing a bunch of other stuff, where the perception would be simultaneous action. The Servo handler would be one "state machine", and the other stuff would be a second, third, or fourth "state machine", as I briefly mentioned above.
It’s not even that difficult. He has the Adafruit shield. This is a co-processor dedicated to operating 16 servos simultaneously. A servo is given a command via a library function over I2C and then your sketch goes on its own way while the shield performs servo control. No need to assign any pins for each servo. No need to repeat the PWM servo signal fifty times a second, no need to maintain the control signal. Just command the servo to change positions.
 

Deleted member 115935

Joined Dec 31, 1969
0
So, @navyguy , have we managed to totaly confuse you ?

If so i'm sorry , its a feature of the forum, we always try to be "correct" , but like all legal correct wording, its is confusing and may not be of help.

I think we have all agreed that the Arduino is the beast for you.

its how you program it that is the next thing,

Unfortunately , its almost 60 years since I learnt how to program , so i dont have any links to hand as to how to learn robotics, and most of my books have disintegrated over the decades.

There are many different ways you could implement a program for this sort of job, I have a good idea how I'd do it,

but

a) Im certain others will spend great amount of time shouting us down,
b) I'd find it very hard to describe on a forum

May be , you could post on the arduino forum, ask about any books / sites to get into arduino robotics,

And remember , no matter how you end up doing it, if it works then thats what matters,

best of luck
 

trebla

Joined Jun 29, 2019
542
Before start writing actual program it is good idea writing to a sheet of paper all actions and movements you want to have. Then write down time scedule for all movements and actions. If cause of movements is not only time based then think about needed inputs. After that you can see how many inputs/outputs you need and choose the Arduino board type. And then you can draw program flow and start programming. I suggest start writing your code by small functional modules, for example turning head or moving arms to simplify testing and finding errors in your program.
 

BobTPH

Joined Jun 5, 2013
8,765
Have you seen a hobbyist level 3D printer operate? Guess what? They are typically controlled by an Arduino. Does it look like it is doing only one thing at a time?

Bob
 

Thread Starter

navyguy

Joined Sep 27, 2019
108
So, @navyguy , have we managed to totaly confuse you ?

If so i'm sorry , its a feature of the forum, we always try to be "correct" , but like all legal correct wording, its is confusing and may not be of help.

I think we have all agreed that the Arduino is the beast for you.

its how you program it that is the next thing,

Unfortunately , its almost 60 years since I learnt how to program , so i dont have any links to hand as to how to learn robotics, and most of my books have disintegrated over the decades.

There are many different ways you could implement a program for this sort of job, I have a good idea how I'd do it,

but

a) Im certain others will spend great amount of time shouting us down,
b) I'd find it very hard to describe on a forum

May be , you could post on the arduino forum, ask about any books / sites to get into arduino robotics,

And remember , no matter how you end up doing it, if it works then thats what matters,

best of luck
thank you for the input.
i think the comments are clear that I just need to learn how to program. I’m rampant ADD so sitting down and really learning it out of a book is very difficult for me to do.
the only programming I’ve ever done prior to this is my parallax micro processor which was super easy even for me.
Appreciate the feed back
 

Reloadron

Joined Jan 15, 2015
7,480
This came up before and I recall the thread. Here it is. I know this stuff can be a little confusing and I am well aware as we age things do not sink in quite as quick as they once did. Believe me you can get this done with an Arduino Uno.

Here is an example:
Code:
#include <Servo.h>

Servo myservo1;  // create servo object to control a servo1
Servo myservo2;  // create servo object to control a servo2
Servo myservo3;  // create servo object to control a servo3
// twelve servo objects can be created on most boards but here we use only 3 servo motors.

int pos1 = 0;    // variable to store the servo1 position
int pos2 = 0;    // variable to store the servo2 position
int pos3 = 0     // variable to store the servo3 position

void setup() {
  myservo1.attach(9);  // attaches the servo1 on pin 9 to the servo object
  myservo2.attach(10);  // attaches the servo2 on pin 10 to the servo object
  myservo1.attach(11);  // attaches the servo3 on pin 11 to the servo object
}

void loop() {
  for (pos1 = 0; pos1 <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
    // in steps of 1 degree
    myservo.write(pos1);              // tell servo to go to position in variable 'pos1'
 
   for (pos2 = 0; pos2 <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
    // in steps of 1 degree
    myservo.write(pos2);              // tell servo to go to position in variable 'pos2'
 
for (pos3 = 0; pos3 <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
    // in steps of 1 degree
    myservo.write(pos3);              // tell servo to go to position in variable 'pos3'
 
    delay(15);                       // waits 15ms for the servo to reach the position
  }
  for (pos1 = 180; pos1 >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
    myservo.write(pos1);              // tell servo to go to position in variable 'pos1'

  for (pos2 = 180; pos2 >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
    myservo.write(pos2);              // tell servo to go to position in variable 'pos2'
  
 for (pos3 = 180; pos3 >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
    myservo.write(pos3);              // tell servo to go to position in variable 'pos3'

    delay(15);                       // waits 15ms for the servo to reach the position
  }
}
Try running that code and I am willing to bet all 3 servos will respond about equally, any lag between servo 1 & 3 won't be noticeable. All of this was covered back in April the same way. All the above code does is run the servos 180 degrees and back over and over again. Written for an Arduino Uno and originally for a single servo. I do not have three servos to actually try it out and if anyone sees a problem with it feel free to critique it.

Ron
 

djsfantasi

Joined Apr 11, 2010
9,155
thank you for the input.
i think the comments are clear that I just need to learn how to program. I’m rampant ADD so sitting down and really learning it out of a book is very difficult for me to do.
the only programming I’ve ever done prior to this is my parallax micro processor which was super easy even for me.
Appreciate the feed back
If examples of code are how you learn, I strongly recommend you join the Halloween-L group on Facebook.
 

Thread Starter

navyguy

Joined Sep 27, 2019
108
thanks so much Ron!


This came up before and I recall the thread. Here it is. I know this stuff can be a little confusing and I am well aware as we age things do not sink in quite as quick as they once did. Believe me you can get this done with an Arduino Uno.

Here is an example:
Code:
#include <Servo.h>

Servo myservo1;  // create servo object to control a servo1
Servo myservo2;  // create servo object to control a servo2
Servo myservo3;  // create servo object to control a servo3
// twelve servo objects can be created on most boards but here we use only 3 servo motors.

int pos1 = 0;    // variable to store the servo1 position
int pos2 = 0;    // variable to store the servo2 position
int pos3 = 0     // variable to store the servo3 position

void setup() {
  myservo1.attach(9);  // attaches the servo1 on pin 9 to the servo object
  myservo2.attach(10);  // attaches the servo2 on pin 10 to the servo object
  myservo1.attach(11);  // attaches the servo3 on pin 11 to the servo object
}

void loop() {
  for (pos1 = 0; pos1 <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
    // in steps of 1 degree
    myservo.write(pos1);              // tell servo to go to position in variable 'pos1'

   for (pos2 = 0; pos2 <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
    // in steps of 1 degree
    myservo.write(pos2);              // tell servo to go to position in variable 'pos2'

for (pos3 = 0; pos3 <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
    // in steps of 1 degree
    myservo.write(pos3);              // tell servo to go to position in variable 'pos3'

    delay(15);                       // waits 15ms for the servo to reach the position
  }
  for (pos1 = 180; pos1 >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
    myservo.write(pos1);              // tell servo to go to position in variable 'pos1'

  for (pos2 = 180; pos2 >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
    myservo.write(pos2);              // tell servo to go to position in variable 'pos2'
 
for (pos3 = 180; pos3 >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
    myservo.write(pos3);              // tell servo to go to position in variable 'pos3'

    delay(15);                       // waits 15ms for the servo to reach the position
  }
}
Try running that code and I am willing to bet all 3 servos will respond about equally, any lag between servo 1 & 3 won't be noticeable. All of this was covered back in April the same way. All the above code does is run the servos 180 degrees and back over and over again. Written for an Arduino Uno and originally for a single servo. I do not have three servos to actually try it out and if anyone sees a problem with it feel free to critique it.

Ron
 
Top