RC Servo on Jackpot Controller

So I have my new MPCNC-inspired cartesian build up and running on the Jackpot controller. It’s going to be a laser engraver but for calibration and testing purposes I’m setting it up as a pen plotter.

So while X & YY axes are homing and working perfectly right now, for the life of me I cannot get my RC servo to move as a Z axis. I’m using this code in my config.yaml file:

z:
steps_per_mm: 100.000
max_rate_mm_per_min: 5000.000
acceleration_mm_per_sec2: 100.000
max_travel_mm: 5.000
soft_limits: true
homing:
cycle: 1
positive_direction: true
mpos_mm: 5.000

motor0:
  rc_servo:
    pwm_hz: 50
    output_pin: gpio.27
    min_pulse_us: 1000
    max_pulse_us: 2000

The servo does nothing at all at power up or in response to movement commands from the WebUI. It does get hot AF though. It’s a cheap SG90 from Amazon, but it works fine when connected to receiver and in response to my radio.

Has anyone else gotten an RC servo working on the Jackpot?

Thanks!

How did you wire the servo?

Red - 5v
Brown - Gnd
Orange - GPIO-27

Different colored wires on my servo, but I did match the 5V/GND/Signal colors as they’re plugged into my receiver for my RC plane “test bench”.

I have an MG-90 on my Jackpot (should be the same as the SG), but it is configured as a spindle, not an axis motor. Anyways, here were the numbers that worked for me. Sorry I can’t be more help.

besc:
  pwm_hz: 50
  output_pin: gpio.27
  direction_pin: NO_PIN
  enable_pin: NO_PIN
  disable_with_s0: false
  s0_with_disable: false
  spinup_ms: 0
  spindown_ms: 0
  tool_num: 100
  speed_map: 0=0.000% 100=100.000%
  min_pulse_us: 600
  max_pulse_us: 1100
  off_on_alarm: false
1 Like

Thanks Stoli, I’ll give that a try

I don’t think most of my settings apply when configuring the servo as the z-axis motor. Just the pwm and pulse numbers, and yours look to be within acceptable limits.

Found this as an example config for a similar setup:

 z:
    steps_per_mm: 100
    max_rate_mm_per_min: 1000
    acceleration_mm_per_sec2: 50
    max_travel_mm: 5.00
    soft_limits: false
    homing:
      cycle: 1
      positive_direction: true
      mpos_mm: 5
      feed_mm_per_min: 100.000
      seek_mm_per_min: 200.000
      settle_ms: 500
      seek_scaler: 1.100
      feed_scaler: 1.100

    motor0:
      rc_servo:
        pwm_hz: 50
        output_pin: gpio.22
        min_pulse_us: 1000
        max_pulse_us: 2100

Where are you pulling the 5V from? Seems strange that it is getting so hot.

From the 5V on the expansion board header.

I remember experiencing some weirdness when I was first configuring a servo. It worked sometimes and not others. To get it to work when it wasn’t, I would physically turn the servo arm and that would get it working for a while. Eventually I replaced it and haven’t had any problems.

The only other thing I can think of would be to test the servo using my configuration. You shouldn’t have to change the wiring. Just change the GPIO pin number in the “z motor0:” section of your config to an unused pin (or perhaps NO_PIN), then insert the “besc:” section as shown in my previous post. When you reboot the board, you should be able to move the servo with the M3Sx command where x is a number between 0 and 100. i.e. M3S0 will be one extreme and M3S100 will be about a 45 degree difference. If you change the max_pulse_us: from 1100 to 2000, you should get a bigger swing.

Be careful with the GPIO pin numbering in the config. If you use the same number in 2 places, the board will reject your config.yaml and boot to a generic instance.

I tried your spindle config and it still didn’t work. So I swapped out the servo, tried your besc spindle code again, and it works!

I may go back later and try the z axis code to see if it works too, but at least I have a workable solution as the besc spindle.

Thanks Stoli!

I just went back to try my original z-axis config settings with one change - soft_limits: false. Now that I have a good servo connected that code works in addition to the besc spindle configuration.

So there are two ways to skin the servo cat :slight_smile:

Glad you got it working. I wouldn’t have thought of that, but I’m sure there is a good reason. I was thinking it might have something to do with the homing cycle, which I associate with limit switches. So if you home a servo without a limit switch, I assume it would run until the pre set max travel limit is reached which could account for some erratic behavior based on the settings. I’m sure you’ll figure it out as you experiment with your configuration. I only needed my servo arm to move 45 degrees and that took me over an hour experimenting with the different PWM and timing values. The motor values make perfect sense to me, but the servos… not so much.

Using the Bart Dring pen/laser board, I have a servo set up as the Z axis on my drag knife.

With no limit switch, $HZ moves the servo to the highest position, and sets the machine Z coordinate to 0. I have 5mm set as the movement limit (though it is actually more than this.) I use G92 to tell the machine to use 4mm as the home position. I have a macro defined that issues:

$HZ
G92 Z4

labelled as “Init Servo” so that I can call it whenever I need it. In Estlcam, I tell it to use 4mm as a clearance plane and 1mm DOC for the drag knife tool. This works we for me.

I don’t have a servo on my Jackpot, currently, but I expect it would work the same

Those settings I posted were actually an example from your board, but since they apply to FluidNC running on an ESP-32 (common to both boards) I assume they would be identical on the Jackpot.