Motor stop

I’m Using an Orangutan B-328 in combination with a Pololu High-Power Motor Driver 18v15 and an ACS715 Current Sensor Carrier 0 to 30 A.
I use these to drive a Faulhaber motor, type 2232 006 SR, 6 Volt, 11 Watt. I drive this motor up to 5.5 Amps for a couple of seconds. The current sensor is used to stop the motor if the current gets higher then 5.5 Amps.
The micon is also controlling a solenoid 3.3 V, 6 Watts. This solenoid is connected to the M1 ports PD5, PD6. The solenoid has a duty cycle of 50% and can be on for more then 50 seconds continuously. It’s never on longer then 8 seconds. The voltage over the solenoid is set to about 3.3 V. by programming “set_m1_speed(130)”.
The system is powered by Li Ion batteries 7.2 V. and 2500 mAh.

My programming and the hardware system is working as I would like to, exept for one thing. If the magnet and the motor are operated at the same time, the motor stops working. The solenoid is still working, but the motor doesn’t run anymore. I can reset my system by decoupling the batteries, if I power up again everything is working again.

I’ve been trying different things, but nothing really solved this problem:

  • Mounting the condensator (150u) that came with the Motor Driver.
  • Tried different values of condensators over the +/- of the batteries…
  • Tried different values of condensators over the solenoid.
  • Tried changing the voltage over the solenoid.
  • Disconnecting the solenoid. With the solenoid disconnected, the system still shuts down when the
    programming wants to move the solenoid and rotate the motor at the same time.

If someone has any idea of what could fix this problem, I would really like to hear it.
Hy5 Product Electronics.pdf (16.1 KB)

It seems that either the battery or the power wiring fail to deliver the current required, without a significant voltage drop, when both the motor and the solenoid are operating. You should check the voltages during operation.

What is the resistance of the solenoid coil? The specs suggest about 1.6 ohms, which means it will draw peak current in excess of what the B-328 motor driver can deliver on a steady state basis.

I admit that this is very puzzling and shouldn’t happen (you may have damaged the on board motor driver in an earlier experiment):[quote]- Disconnecting the solenoid. With the solenoid disconnected, the system still shuts down when the programming wants to move the solenoid and rotate the motor at the same time.[/quote]
In general, you are asking for trouble, expecting too much power from the motor (even on a short term basis) and expecting too much of the B-328 motor driver.

Hello.

Have you ruled out a software issue? In general, it seems like you should try to simplify this down to the most basic software and hardware setup that demonstrates the issue. For example, since we know the problem happens without the solenoid connected, remove that from your system. If you disconnect your motors and instead use an LED to indicate your program is running properly, does the problem still happen?

- Ben

Thank’s for your replies Jim and Ben, very helpfull!

I began by ruling out a software issue like Ben proposed. Instead of the motor and the solenoid I used LED’s. This showed that the program is running properly and that the problem is “gone”. Allready a big relieve for me, as this is my first program in C.

You where correct Jim, I changed the Li-ion, 7.2V batteries with a Ni-MH, 7.2V 3000 mAh batterie. This solved the problem of the motor stop, but showed another (related?) problem. The EMG-sensors as shown in my schematic, are used to control direction and speed of the motor. As my finger comes closer to an EMG-sensor the speed of the motor goes up, my finger doesn’t touch the EMG sensor to make this happen.
When I only use one finger in front of the EMG-sensor, I have very good motor speed control. When I have one finger in front of an EMG-sensor and one finger on the motor or the solenoid, I have very poor speed control. Is this a ground problem, or why is this?

The resistance of the solenoid is 1.8 ohms, so maybe I ask a bit too much of the motor driver? How can I solve the workings of my solenoid with minimum impact to my design and the smallest parts?

Thank’s for your help, learning all the time!!

What is an “EMG sensor”? It sounds like you have a grounding problem.

The peak current through the solenoid depends on the PWM frequency and the inductance, but in steady state would be about 7.4 V/1.8 ohms = 4 amps. This would greatly exceed the capability of the motor driver. However, it is hard to understand your description as the following two sentences are contradictory:

[quote]The solenoid has a duty cycle of 50% and can be on for more then 50 seconds continuously. It’s never on longer then 8 seconds.[/quote] In any case, another motor driver with higher current capability would solve the problem permanently.

An EMG sensor is a sensor that reacts on muscle contractions. It’s often used to control the movements of a motorized prosthetic.

It does look like a grounding problem, but what have I done wrong and what can I do about it?
The schematic enclosed in the first post, is what I’ve build.

Is it possible to use a MOSFET and an I/O port of the B-328 to control the solenoid?
How would I go about to go down from 7.2 V battery voltage, to 3.3 V to the solenoid?

I’m guessing that the EMG sensor reacts to very small voltages and currents, so proper grounding would be a major issue and is probably discussed in great detail somewhere, like the data sheet. If you can provide a link to the data sheet I might be able to help.

The voltage applied to the solenoid is not that important. You can exceed the rated voltage as long as you do not exceed the power dissipation, which is <I^2>*R (where <I^2> is the average squared coil current). One of Pololu’s stepper motor drivers that offers current limiting, e.g. pololu.com/catalog/product/2134 can be used to drive the solenoid from a voltage higher than 3.3V, if you set the coil current to a bit less than 2 A. Toggle the solenoid on and off using the /ENABLE input.

The enclosed file showes the limited datasheet of the used Otto Bock EMG sensor 13E2000=50.

The stepper motor driver you propose, is way to big for my application. There’s space for a quarter of the proposed stepper motor driver.
myobock_electrodes.pdf (248 KB)

The data sheet isn’t very helpful, except to suggest that grounding should not be an issue if the manufacturer’s cables and connectors are used (and are correctly connected to the mpu).

I agree that the data sheet is not very helpfull, but that’s all the information they give. I will check the connections of the sensors.

Do you have another, smaller, solution for controlling the solenoid?

A suitable MOSFET transistor, with a turn-on Vgs < 5V and an inductive kick diode, would take up less space and could be driven by a PWM output. Here is an example hobbytronics.co.uk/arduino-tutorial9-power

Hi Jim, thank’s for your reply.

I’ve been trying this for a while and it works like a charm as long as I use timer 1. Unfortunately for me, this timer is taken by the motor.
I can’t seem to get a good reaction from timer 0 or timer 2 for that matter. I’ve been using this code for timer 1:

[code] set_digital_output(IO_B1, HIGH); // Timer 1A, PWM output on PB1

TCCR1A = _BV(COM1A1) | _BV(WGM11);
TCCR1B = _BV(WGM13) | _BV(WGM12) | _BV(CS10);
ICR1 = 999;								// set TOP to 999 for a 20 kHz PWM

while(1)
{
	OCR1A = 600;
	delay(2000);
	OCR1A = 0;
	delay(2000);[/code]

And the following code for timer 0:

[code] set_digital_output(IO_D5, HIGH); // Timer 0, PWM output B
set_digital_output(IO_D6, HIGH); // Timer 0, PWM output A

TCCR0A = _BV(COM0A1) | _BV(WGM01) | _BV(WGM00);
TCCR0B = _BV(WGM02) | _BV(CS00);
			
while(1)
{
OCR0A = 200;				// Magnet ON
_delay_ms(2000);			// Wait
OCR0A = 0;					// Magnet OFF
_delay_ms(2000);			// Wait[/code]

Am I doing something wrong or is there just a difference in these timers that make timer 0 and 2 useless for your proposed solution?

Can you help me with this problem Jim or Ben?
I’m really stuck with this.

- Jos

Timer0 and Timer2 can provide PWM signals appropriate to the task if they are programmed correctly. However, it is not obvious what your code is doing, as there are no useful comments in the code and there is no motivation for the reader to look up the meanings of all the bits in the timer control registers.

It would help if you explained exactly what you think your Timer0 or Timer2 code should do and what it actually does instead. Careful reading of the timer section of the ATmega328 data sheet is highly recommended!

Ok, sorry, that was little information. Thank’s for pointing this out to me.
I’ll try again. The following program controls Timer 1. Timer 1 controls the proposed MOSFET with a turn-on Vgs < 5 V (a TIP 120 in my case). If I control the MOSFET with a PWM of 600 pulses, the voltage over the solenoid results to about 3.3 V (it drops as the battery voltage drops).

[code]set_digital_output(IO_B1, HIGH); // Set pin PB1 as output. Timer 1A, PWM output on PB1

TCCR1A = _BV(COM1A1) | _BV(WGM11); // Fast PWM. Clear OC1A/OC1B on compare Match,
TCCR1B = _BV(WGM13) | _BV(WGM12) | _BV(CS10); // set OC1A/OC1B at BOTTOM
// (non-inverting mode). No prescaling.
ICR1 = 999; // set TOP to 999 for a 20 kHz PWM

while(1)
{
OCR1A = 600;
delay(2000);
OCR1A = 0;
delay(2000);
}[/code]
The next program is a program where I try to control the solenoid with Timer 0 in the same manner as I did with Timer 1. The program of Timer 1 is working, but the following program of Timer 0 is not.

[code]set_digital_output(IO_D5, HIGH); // Set pin PD5 as output. Timer 0, PWM output A

TCCR0A = _BV(COM0A1) | _BV(WGM01) | _BV(WGM00); // Fast PWM Mode. Clear OC0A on
TCCR0B = _BV(WGM02) | _BV(CS00); // compare Match, set OC0A at BOTTOM
// (non-inverting mode). No prescaling

while(1)
{
OCR0A = 250; // Magnet ON
delay(2000); // Wait
OCR0A = 0; // Magnet OFF
delay(2000); // Wait
} [/code]
I’ve been trying to read the ATmega328 data sheet, but this is very hard to understand for me. I can see that there is a difference in the code for the setting of ICR1 between timer 1 and 0. The data sheet, however, doesn’t state anything about this for timer 0. So this part is certainly a mystery for me.

In case of timer 1, port PB1 is connected to pin 1 of the MOSFET.
In case of timer 0, port PD5 is connected to pin 1 of the MOSFET.

Thank’s for all your help!

- Jos

Again, you don’t say what the program actually does.

However, I can’t see why setting the OCR register to zero should work. I would stop the timer, disconnect the timer from the output pin and set the pin to turn off the magnet. A search for “timer0 pwm code” turns up a lot of hits.

From your original post, it looks like you are treating the Baby Orangutan motor driver output as the same as PD5, but this is not the case. PD5 is not broken out on the Baby Orangutan, and there is not a one-to-one relationship between the TB6612 output and what the PD5 pin is doing. Have you considered using Timer 0 interrupts to generate a PWM on an arbitrary digital output? Do you have an oscilloscope available so you can check to see if your code is doing what you think it is? Alternatively, you might consider getting a serial motor controller to drive your solenoid (or to drive your motor so that you can use Timer 1 for your solenoid MOSFET).

- Ben