Pages: [1]   Go Down
Author Topic: Running engines with Mega2560  (Read 955 times)
0 Members and 1 Guest are viewing this topic.
Springfield, IL
Offline Offline
Newbie
*
Karma: 0
Posts: 27
Oohhh.... what does THIS button do?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello world, can someone help me figure out why my engines aren't running? I have a 10S LiPo battery, a Phoenix ICE2 HV 80 ESC and a brushless motor connected to a breadboard and an Arduino Mega 2560. Please note, I am using the arduino to control the motor instead of a receiver/throttle stick setup.

When I run my program, the motor beeps 5 times, which according to the manual means:

Radio Signal: Signal from receiver is corrupt or non-existent. Check transmitter and receiver.

The motor occasionally has run on this setup, so I think the power is being fed ok, although the motor has run for brief periods while I was trying to figure things out. The signal wires seem to be connected, nice and solid... Am I missing something? I'm going outside to hook up the battery to the charger and see what the reading on that is. But if you have any ideas, please let me know. Thank you.

Before I forget, here is the code I'm using.

************** CtrlEngine.ino
#include <Servo.h>
#include <Wire.h>

Servo eng1;              // Engine left of nose.
const int pinEng1 = A8;

void armEngs()   
{
  eng1.attach(pinEng1);
  setThrottle1(0);
  delay(1000);
}

void setThrottle1(int thrust)
{
  int angle = map(thrust, 0, 100, 0, 180);
  eng1.write(angle);
}

************** UAVHover1_0ctrltest.ino
#include <Servo.h>
#include <Wire.h>

void setup()
{
  Serial.begin(9600);
  armEngs();
}

// Main loop
void loop()

  setThrottle1(10);
  delay(2000);
  setThrottle1(20);
  delay(2000);
  setThrottle1(00);
  delay(2000);
}
Logged

Me speak bad English? That's un-possible!

~Ralph Wiggum

UK
Offline Offline
Shannon Member
****
Karma: 184
Posts: 11173
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The motor occasionally has run on this setup, so I think the power is being fed ok, although the motor has run for brief periods while I was trying to figure things out.

Do you mean it's an intermittent problem? If so, concentrate on finding ways to make it come and go.

Oh, and please use [ CODE ] [ /CODE ] tags when posting code. You've been here long enough to know that by now.
Logged

I only provide help via the forum - please do not contact me for private consultancy.

Springfield, IL
Offline Offline
Newbie
*
Karma: 0
Posts: 27
Oohhh.... what does THIS button do?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Intermittent, like it spun up once or twice in 10 minutes without any input or changes in wiring. I'm wondering if the Serial.begin(9600) might be interfering somehow. And, actually, no one told me about [ CODE ] [ /CODE ] . What does it do?

[ CODE ] [ /CODE ]
This is a sample so I can what this does.
Please ignore these lines.
Logged

Me speak bad English? That's un-possible!

~Ralph Wiggum

UK
Offline Offline
Shannon Member
****
Karma: 184
Posts: 11173
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

That intermittent behaviour supports the theory that the Arduino output is not quite what the motor controller is looking for - but is close enough that it manages to lock on to something occasionally.

If I were you I'd be looking for wiring faults and make sure all the grounds were sound. If something was floating, you might get this sort of behaviour.

The CODE tags tell the forum software that the enclosed text should be displayed exactly as-is and not interpreted as forum control codes. Insert code tags by clicking the # button when you're editing your post.

Code:
// Like this
Logged

I only provide help via the forum - please do not contact me for private consultancy.

Springfield, IL
Offline Offline
Newbie
*
Karma: 0
Posts: 27
Oohhh.... what does THIS button do?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Can you clarify something is 'floating'?

# Is this coding?

Code:
Is it working now?
Okay, the brackets and the words code not capitalized is working.
Note to self: Keep code in between brackets.


Thank you for that tidbit, by the way.
« Last Edit: February 13, 2013, 06:02:53 pm by gln6fgsl » Logged

Me speak bad English? That's un-possible!

~Ralph Wiggum

UK
Offline Offline
Shannon Member
****
Karma: 184
Posts: 11173
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Can you clarify something is 'floating'?

I mean that something which is supposed to be connected to the Arduino ground is not actually at the same voltage as the Arduino ground.

If your Arduino is producing a 5V PWM signal but the motor controller ground is at higher voltage than the Arduino ground then the motor controller would not see the full 5V.
Logged

I only provide help via the forum - please do not contact me for private consultancy.

Offline Offline
Edison Member
*
Karma: 28
Posts: 2037
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

That message from the motor seems rather strange.   In what application does the motor receive a signal from
a controller ?   Usually,  the ESC receives control signals,  and the motor just behaves according to the current
which the ESC supplies to it.
Logged

Springfield, IL
Offline Offline
Newbie
*
Karma: 0
Posts: 27
Oohhh.... what does THIS button do?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

To michinyon: The application is a UAV, and the motor is connected and controlled by a ESC. I've been assuming when PeterH says motor controller, he means a ESC. But again, assuming.

To PeterH: The ESC is connected to a breadboard, and I'm using the +/- slots on the sides. Those slots(? What are they called?) Are connected to the Mega's 5V and Gnd pin. The signal is coming from the analog pin number 8. But none of that should cause floating, should it?

Logged

Me speak bad English? That's un-possible!

~Ralph Wiggum

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 331
Posts: 16518
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I would consider dropping the servo.write commands using degree values, as that assumes rather non standard min and max pulse widths that the servo library uses as default values and your ESC may not like them. So change:

Code:
void setThrottle1(int thrust)
{
  int angle = map(thrust, 0, 100, 0, 180);
  eng1.write(angle);
}

To:

Code:
void setThrottle1(int thrust)
{
  int value = map(thrust, 0, 100, 1000, 2000); // convert 0-100% throttle to 1000 to 2000 usec servo pulse
  eng1.writeMicroseconds(value);
}

Lefty
« Last Edit: February 14, 2013, 10:30:16 am by retrolefty » Logged

Springfield, IL
Offline Offline
Newbie
*
Karma: 0
Posts: 27
Oohhh.... what does THIS button do?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

That did it. Thank you again, retrolefty. And thank you all for taking a look and suggesting.
Logged

Me speak bad English? That's un-possible!

~Ralph Wiggum

Czech Republic
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi, I'm using PhoenixICE240HV and Hi-Flow Thruster 400HFS-L, power source has 12V/10A.
I'm trying to control via arduino, but unsuccessfully.
Accordingly to user manual I'm gererating 1,5 ms pulse -neutral,than full rev - 1ms than full fwd(2ms).

ARDUINO CODE :
Code:
#include <Servo.h>
Servo myservo;
void setup()
{
  myservo.attach(3);
}
void loop() {
  myservo.write(95); // 1,5 ms -> neutral
  delay(5000);
  myservo.write(45); // 1 ms -> full reverse
  delay(5000);
  myservo.write(145); // 2 ms -> full forward
  delay(5000);
}
CONNECTION :
Phoenix ICE2 HV 40 is connected to power source, thruster, and to arduino (brown line to arduino GND, orange line to arduino pin 3 (PWM)).

Motor doesn't rotate, only beeps. Please,do you know, where is a error?
Thank you so much indeed.
Tomas.
« Last Edit: April 02, 2013, 08:33:38 am by tomasm » Logged

Offline Offline
God Member
*****
Karma: 27
Posts: 829
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Did you seriously just hijack a thread AND missed the whole part about the code tags? Did you read the thread you hijacked?
Logged

Czech Republic
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry next time I'll use this tags.
Tomas
Logged

Offline Offline
God Member
*****
Karma: 27
Posts: 829
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I would suggest trying what retrolefty suggested just 3 posts above. It seems to have solved the original posters problem which is the same as yours.
Logged

Springfield, IL
Offline Offline
Newbie
*
Karma: 0
Posts: 27
Oohhh.... what does THIS button do?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Just saw the hijacking. ... Hope retrolefty's advice helped you as well as it did me. And it seems you got the code tags.  smiley Well, have a good day folks.
Logged

Me speak bad English? That's un-possible!

~Ralph Wiggum

Pages: [1]   Go Up
Jump to: