Am I doing this correctly?

Hello.

So I've been working on my DIY scratch quadcopter on and off, as I am busy with classes. I wish to ask about the arming of my ESC and I thought I'd ask here.

Anyway, I read that to arm the motor/ESC a PWM signal with the "desired values" must be sent, i.e. 700-2000ms. Quadcopter will map the range so that when the throttle stick is up a 1023 the ESC write.microseconds value is at 2000 or something.

My plan is to do this:

map(var, 0,1023, 700, 2000);

so that when control stick is down, ESC will turn off motor.

But my pot at the lowest setting is NOT perfectly 0 -- it is either like 10-18, and HIGHEST is at like 1015-1020

So,

map(var, 10, 1023, 700, 2000);

or is the first code good enough?

By the way, I learned that using map() for the pot is better because it l the code length instead of my stupid initial approach seen here

What you have descirbed is not correct. The details differ with different products but, if you have the numbers correct it probably means that you need something like this

Servo.writeMicroseconds(700);
delay(100);
Servo.writeMicroseconds(2000);

What you are trying to do is mimic the process of the user pulling the joystick all the way back and then pushing it all the way forward. I suspect that should be followed by another

Servo.writeMicroseconds(700);

so that it does not start at full speed.

The details will be in the ESC user manual.

...R

There was some guy who's code I used. He used servo values that were I think 30 and 180 or something to arm the similar ESC.

This is his video. The code is there in the comments, available via download.

That made me initially decide to use servo values, but I want to change my approach because servo values between 120 and 170 cannot be used, which the guy didnt have in his code. I thought I could have mapped servo vals instead... so I'll just use write.microseconds, which is what most people do.

Robin2:
The details will be in the ESC user manual.

Banggood didn't include one!

I tried finding datasheets online, but I only find similar ones.

I am using this. Based on my research, it is HobbyWing firmware.

When arming the motor is the ESC like mapping the min and max. If so, can I use 1000 for max instead of 2000? I want to have a mode where it doesnt go fast.

JeromeAriola:
When arming the motor is the ESC like mapping the min and max. If so, can I use 1000 for max instead of 2000? I want to have a mode where it doesnt go fast.

I can't understand that. I tried to show in Reply #1 that arming is not the same as setting the range with the map() function

Are you trying to use a human-operated potentiometer to do the arming or are you trying to do it just with program code?

...R

Robin2:
I can't understand that. I tried to show in Reply #1 that arming is not the same as setting the range with the map() function

Are you trying to use a human-operated potentiometer to do the arming or are you trying to do it just with program code?

...R

My goal in that paragraph is to make the motors go slowly or only halfway to full efficiency.

I know that arming is not the same as setting the range with map(). I started this to ask about the map() function and how I did it because I am planning to implement it in my code.

Both.

JeromeAriola:
I started this to ask about the map() function and how I did it because I am planning to implement it in my code.

Sorry. I was completely fooled by this bit

I wish to ask about the arming of my ESC and I thought I'd ask here.

...R

My bad...

It's my first time mapping anything, so I decided to ask for advice as well as advice on code for arming code.

But for arming without a human operated pot, the code you provided will assist me in my build.

That being said, do you think the ESC will arm as it does if I sent 1000 instead of 2000. And will it arm so that if i send a 1000 when it is armed the motor wont spin as fast, or will it still be at full throttle?

Partially unrelated question: I found this online at http://www.instructables.com/id/ESC-Programming-on-Arduino-Hobbyking-ESC/?amp_page=true and the image. Will this apply to all ESC types?

The second one is from a different site.

JeromeAriola:
That being said, do you think the ESC will arm as it does if I sent 1000 instead of 2000.

Not if it requires 2000 - how could it?

And will it arm so that if i send a 1000 when it is armed the motor wont spin as fast, or will it still be at full throttle?

The value you use for arming does not affect how it behaves afterwards.

Why don't you try these ideas yourself and see what happens?

I don't plan to read an Instructables Article. If you have a specific question about it I will try to help, but please minimise the need to scroll through the Instructables stuff as it is a very tedious website to navigate.

...R

Robin2:
Not if it requires 2000 - how could it?
The value you use for arming does not affect how it behaves afterwards.

Why don't you try these ideas yourself and see what happens?

Thanks. I should try it, but the lab has been closed for two weeks, and my stuff is there.
The post with the URL had a picture included -- the one with the colored letters and table (it was the first download link [my phone has no virus]). I found that pic on the instructable.

Im not sure if this uploaded correctly or the previous ones, but this one is connected to the second pic from my last post.

JeromeAriola:
Partially unrelated question: I found this online at http://www.instructables.com/id/ESC-Programming-on-Arduino-Hobbyking-ESC/?amp_page=true and the image. Will this apply to all ESC types?

No. Not all ESCs are the same.

It's really pointless trying to do this without being able to just test it. It wastes a lot of time when a few minutes with the real thing would allow you to work it all out easily.

Steve

slipstick:
No. Not all ESCs are the same.

It's really pointless trying to do this without being able to just test it. It wastes a lot of time when a few minutes with the real thing would allow you to work it all out easily.

Steve

I have tested the ESCs, but not in this manner. The code I used is in the video I linked does have arming that uses servo values. I used those in my testing, but now I want to move to write.microseconds since I found that most people use it, and my initial approach was inefficient, programming-wise.

I linked that too.

I also can't find the "duty cycles" (or whatever those PWM square waves are called in microseconds) that translate to servo. Like is 180 mapped from 2000us?

Also, I am not sure if I can use servo values between the tens (like 33, 59,etc since the guy used 30,40,50...), prompting me to switch.

Or perhaps I'll try using in-between servo vals...

If you're using writeMicroseconds() you put in the value you want within the limits 544-2400 (actually you can use numbers outside this range but it limits the actual pulse width to those).

If you want to know the mapping between angles in write() and microseconds look in Servo.h. I believe 0 = 544 and 180 = 2400 unless you have changed the limits when you did your attach().

And you can use any integer from 0 to 180 in a write(). The IDE example Sweep uses them all.

Steve