So every 5 secs HI, MED, LO 'happens' ~ do HI MED and LO correspond to the wires leading into the motor that go around the spokes in the stator to make the electromagnets? There's 4 sections, 3 electromagnets each.
I think you have a motor controller between your Arduino and motor. Non of the controllers I've seen give you the ability to control and the stator winding level. So its not clear what you are actually trying to accomplish.
Electromagnets with a strong field are expensive to have made. This fairly inexpensive drone motor has strong light weight electromagnets inside.
Instead of getting a custom electromagnet dealing w switches and all the other things I don’t know anything about - using the components of a brushless motor for a drone seemed ideal. I can use a premade ESC and battery with an Arduino for the function.
I want to isolate just 1 spoke, cut it up group the electromagnets together according to their corresponding wire. And from there use only one of the coils. Essentially making a mini mag launcher. These electromagnets are strong and light weight, that’s what I need.
what I want to do:
I want to basically turn it on then immediately off and a few seconds later turn it on then immediate off again. The speed or torque or Kv, Amps, current - whatever you want to call it at this point, whichever is appropriate for the code part should ideally be maxed out-fastest speed, most torque, most Kv, etc.
And the only other thing is setting when it turns on/off the second time. I’d like to be able to adjust this, e.g. 2 secs or 1.5secs later, etc.
Electromagnets with a strong field are expensive to have made. This fairly inexpensive drone motor has strong light weight electromagnets inside.
Instead of getting a custom electromagnet dealing w switches and all the other things I don’t know anything about - using the components of a brushless motor for a drone seemed ideal. I can use a premade ESC and battery with an Arduino for the function.
I want to isolate just 1 spoke, cut it up group the electromagnets together according to their corresponding wire. And from there use only one of the coils. Essentially making a mini mag launcher. These electromagnets are strong and light weight, that’s what I need.
what I want to do:
I want to basically turn it on then immediately off and a few seconds later turn it on then immediate off again. The speed or torque or Kv, Amps, current - whatever you want to call it at this point, whichever is appropriate for the code part should ideally be maxed out-fastest speed, most torque, most Kv, etc.
And the only other thing is setting when it turns on/off the second time. I’d like to be able to adjust this, e.g. 2 secs or 1.5secs later, etc.
He's not using a servo. He has a high powered sensorless brushless motor and an ESC and also has some very strange ideas about how electromagnetism, motors and ESCs work. Several of us have tried to explain but it seems he didn't like the answers so started some new threads.
esc.write(179); // HI
delay(5000);
esc.write(1); // LO
delay(5000);
esc.write(90); // MID
delay(10000);
esc.write(120); // SPEE
Typically, an ESC intended for an airplane motor has a special startup sequence so that you can avoid chopping your fingers off with the prop when you're fiddling with the battery connections or whatever. You push your joystick all the way to "HIGH" speed for some seconds, then all the way to "LOW", and then let it sit near the middle. Then the motor starts spinning, and future joystick movement actually controls the speed.
So the initial code you're asking about is doing this automatically, to get the motor to turn on.
I'm not sure how you turn the motor OFF, after that, actually...
This fairly inexpensive drone motor has strong light weight electromagnets inside.
Um. They are inexpensive because they are very trivial electromagnets - soft iron armatures with only a small number of windings. They're only "strong" because the ESC pulses a really HIGH current through them.
You can make one yourself in a couple of minutes (in fact, you can find online instructions for rewinding the motors from a discarded CD drive into a high-power aircraft motor. It's supposed to be pretty easy.)
The ESC drives the windings of the motor with a rather complex variable frequency 3-phase PWM signal; it's probably not what you want if you're just after an electronmagnet!
You can also get inexpensive electromagets: https://www.aliexpress.com/item/P25-20-Holding-Electric-Magnet-Lifting-5KG-Solenoid-Electromagnet-DC-6V-12V-24V/32443268486.html (MANY turns of wire on a carefully designed shape.)
I want to isolate just 1 spoke, cut it up group the electromagnets together according to their corresponding wire. And from there use only one of the coils. Essentially making a mini mag launcher. These electromagnets are strong and light weight, that's what I need.
It sounds like you are physically trying to make a linear motor out of the parts of a rotary motor.
I'm not sure how your ESC will react to the conversion. On startup an ESC energizes the motor with some slow sequential pulses. It then looks for the back emf (voltage) caused by a magnet passing by a pole to know when to apply the next pulse of power, expecting to ramp up the speed of the rotor to some sustainable operating speed. At that point the ESC starts to look at the commands from the Arduino.
The point being, the Arduino controlling the ESC will limited or no control over the first movements of the motor, depending on the number of poles in your motor, depends on how many revolutions or part of a revolution will be solely controlled by the ESC.
I do applaud your creativity in considering this approach
The ESC is a pure red herring. You have made an instance of the Servo class and called it esc.
This does not make it and ESC it is just the name you have given to the servo libiary. This has caused a lot of people to think you have an ESC, you have not.
The way a servo works ( simplified ) is by changing the pulse width of a signal. The electronics inside the servo translates this into a voltage which is compared to to voltage of a pot which is connect to the shaft and so acts as a shaft position indicator. When the shaft is in a position that equals that of the pulse width signal the motor stops.
These pulses are somewhere between 1 and 2 mS repeated at 40mS intervals. So if you just connect these pulses to a motor's coil then you will get very little in terms of a PWM signal's duty cycle change. So the numbers you write to the libiary that change the pulse with will have very little difference to the speed of a normal DC motor connected to them, and you will not be able to change the duty cycle enough to turn off the motor.
To control the speed of a motor you will need to use a proper PWM signal given by an analogWrite to one of the PWM capable pins, indicated on the board by a ~ symbol.
I know you are a beginner but by using the wrong words you have confused a lot of people. You are using the wrong libiary and have a lot of concepts confused.
The original original message clearly said T-motor U7 brushless motor with 80A ESC (Mystery brand).
What he didn't say, even after being asked several times, was that he didn't want to run the motor as a motor but wanted to pull it apart and use only a few of the bits while still expecting that the ESC would do something useful with them. It won't.
Yes, I can easily see why you're confused. We started off with a question about normal brushless motors and RC-style ESCs. You can't control a brushless DC motor using simple PWM. As I'm sure you know they need a brushless ESC which is normally controlled using the Servo library.
But that's all out of date now that the OP has finally told us more about what is going on, which is nothing like running any normal sort of motor, brushless or not. The OP has interesting ambitions but very little grasp of how brushless motors and their control circuitry work.