# Noob here. trying to put together an oscillating unit

I’ll make this as concise as I can.

Goal:

I need to make a mechanism capable of oscillating a can of soda pop. I need to be able to control the speed and amount of rotation both ways. I need it to be easy enough to control the speed and rotation that anyone can do it, preferably with some simple external, physical input device rather than by using programming. I will be doing all the programming, but my boss wants the actual adjustments of operation to be simple and intuitive.

When I was asked to do this project, I immediately thought of using an Arduino and a stepper. So I looked through the forum, and I only found one article that touches on this project.

Does anyone know of a thread that describes a similar project? I’m not sure I am wording my query appropriately.

Thank you for any help!!!

(PS. This is for a project at my new job, and I’m trying to earn brownie points).

It sounds like you want to rotate the can - but, about which axis?
Another way to oscillate an object is up and down with no rotary motion.

If you just want to shake something back and forth (whether rotary or not) I would be inclined to mount a crank on the shaft of a DC motor and use a connecting rod to move the oscillating platform back and forth.

A stepper motor sounds like over-kill.

Can you post a diagram of the mechanism you are thinking of using for mounting and rotating(?) the can?

...R

I totally agree that it would be easier to do this with a DC motor and a crank. That was something that we discussed when we were planning this.

The only problem with that is that it will be a bit of a task to vary the amount of oscillation because we would have to adjust the linkage. My boss wants it to be basically a pushbutton device.

The can will be rotating on it’s long axis, as if it were a roller but the can will remain upright because it will be submerged, and the oscillation apparatus will grip it from the top.

I don't have a diagram for it yet. The mechanical part of it should be reasonably easy for me to assemble, it's just the electrical components and interfaces I am unfamiliar with.

Something like this but faster?

Stepper bouncing

Check out the "Bounce" example in the accel stepper library.

http://www.airspayce.com/mikem/arduino/AccelStepper/

NITEBREED:
The only problem with that is that it will be a bit of a task to vary the amount of oscillation because we would have to adjust the linkage.

It would be a nice exercise (and not too difficult I think) to develop an adjustable linkage like what is used on steam railway locomotives to vary the stroke of the steam valves. A small servo could be used to adjust the linkage.

...R

Yes Outsider just like that, but with external physical input devices like a rheostat for speed adjustments, and also to adjust the distance of travel in each direction.

Is that going to be pretty straight-forward? I can accommodate these functions in the code right?

Robin2, again you are spot on. I love tinkering with clever mechanisms like that as well. I have been in industrial maintenance for well over 20 years, and I still never grow weary of seeing how machines complete their tasks. Unfortunately for me, the owner of my company isn't as interested in the task as he is in the goal in this case.

amplitude and frequency of the oscillation?

A windscreen wiper motor gives you push and pull - now you just have to arrange an oscillating platform with a gland and bearing through the bottom of the tank to a crank with variable length attachment for different angles of turn. Since the load is light you coulld probably over-volt it a bit for higher speed if you need it without too much worry.

Control the speed of the motor with arduino PWM and a big logic-level power MOSFET. Perhaps use a potentiometer and analogRead for speed setting.

If you need precise motor speed control at different points as it turns , use a tachogenerator or optical shaft encoder and a feedback loop in the arduino - if you really need this contact me and I'll describe a solution.

regards

Allan

Allanhurst, what you are describing sounds a lot like what Robin2 was describing yes? I think the biggest reason my boss wants it to be controlled electrically is because he wants to be able to adjust things on the fly. We are monitoring changes in the can commensurate with the atmosphere outside the can, and we want to see if we can manipulate the conditions in the can by varying the oscillations.

Have you considered using a servo to cause the oscillations?

It is easy to adjust the amount a servo arm moves and the speed at which it moves. See the servo sweep example that comes with the Arduino IDE.

...R

Go to a house paint store or super hardware store in the paints section, where they have oscillating units to shake up paint cans. Can learn from their mechanisms and can adopt their matured approach.

Yes, my idea was much the same as Robin2's.

But it may not be sufficiently versatile.

If you want a comrehensive solution the environmental test sytems built by such people as Ling Dynamic, Royston, England do what you want ( there must be many others - they're the ones I know) - they make vibrators driven by power amplifiers in all axes, with programmable excitation for amplitude, frequency , noise spectrum etc.

not cheap

regards

Allan.

Really starting to feel stupid here.

I got my IDE configured correctly (I think) I got my motor shield working OK now and have an external pwr supply running the stepper on M3 and M4. I even have it oscillating using the example ‘stepper test’ I think.

So, now I’m trying to add the pot to the mix. I have the pot on A0 but DOGGONE it! I am having trouble trying to assign the analog to the motor. What am I not understanding?

Any help? Bueller? Bueller?

``````/*
This is a test sketch for the Adafruit assembled Motor Shield for Arduino v2
It won't work with v1.x motor shields! Only for the v2's with built in PWM
control

For use with the Adafruit Motor Shield v2
*/

#include <Wire.h>
#define ANALOG_IN A0

int sensorPin = A0;    // select the input pin for the potentiometer
int sensorValue = 0;  // variable to store the value coming from the sensor

// Create the motor shield object with the default I2C address
// Or, create it with a different I2C address (say for stacking)

// Connect a stepper motor with 200 steps per revolution (1.8 degree)
// to motor port #2 (M3 and M4)

void setup() {
Serial.begin(9600);           // set up Serial library at 9600 bps
Serial.println("Stepper test!");
AFMS.begin();  // create with the default frequency 1.6KHz
//AFMS.begin(1000);  // OR with a different frequency, say 1KHz
pinMode(myMotor, OUTPUT);
myMotor->setSpeed(200);  // 200 rpm
}

void loop() {
myMotor.->(analog_in);
myMotor.setSpeed(200);
myMotor.runSpeedToPosition();

Serial.println("Double coil steps");
myMotor->step(100, FORWARD, DOUBLE);
myMotor->step(100, BACKWARD, DOUBLE);

}
``````

What?

``````  myMotor.->(analog_in);
``````

myMotor is a pointer, you always use ‘->’ with pointers, not ‘.’ and certainly not ‘.->’

OK, Thanks Mark. I didn't know that. I will go back and try more.