Home JGAurora A5S, A1 & A3S-V2 Modifications & Upgrades

Auto Bed Leveling

FrezapFrezap Posts: 21Member, 🌟 Super Member 🌟
Hi everyone!

I would like to add a BL-Touch to my JGAurora A5S.
Do you know if I will be able to use the x-max (for example) pin as the control/servo pin?
Otherwise I will try my luck with a capacitive sensor.

Thanks in advance!
Frezap

«1

Comments

  • ZmanZman Posts: 1Member
    Let me know if you had any success in getting A5S working with a BL-Touch.
  • mkohlermkohler Posts: 1Member
    Hello everybody
    I have been an owner of an A5s since last week. As with others, the print bed is not straight.
    Is it possible to block a BLTouch on the A5s? Has anyone done that successfully? The search is very difficult, because always the results of the A5 are displayed.

    Thank you for your help

    Mike
    Thanked by 1Al_G
  • Samuel PinchesSamuel Pinches Posts: 2,997Administrator
    Welcome Mike! ( @mkohler )
    i don’t know if anyone who has done that yet. There are no servo pins on the motherboard, so you would need to remap a pin being used for another function, like the z-max pin for example.

    Because of this, you would also need to use the custom firmware. I have one working build for the A5S, but I’m really trying to redo it at the moment with the very latest version of Marlin. Unfortunately I can’t give an eta but it is a live work in progress.
    Thanked by 1mkohler
  • SomeoneYouLikeSomeoneYouLike Posts: 38🌟 Super Member 🌟
    edited June 2019
    Hello!

    @Samuel Pinches Goob job on the latest custom firmware! It works amazing. It opens us to whole new possibilities including auto leveling. Can you show me which pins to take out to install a IR sensor or BLTouch sensor? Using Dai Hai's image below:



    Would this IR Sensor mount be compatible with the A5S? https://www.thingiverse.com/thing:2750505
    Thanked by 1Samuel Pinches
    Post edited by SomeoneYouLike on
  • Samuel PinchesSamuel Pinches Posts: 2,997Administrator
    Well, there's a couple of pins spare - currently the filament sensor port is not used in the custom firmware, and the z-x-y max endstop sockets are free too.
  • SomeoneYouLikeSomeoneYouLike Posts: 38🌟 Super Member 🌟
    I will give it a go tomorrow when BLTouch arrives :smile:

  • Samuel PinchesSamuel Pinches Posts: 2,997Administrator
    Just don't plug it all in and hope haha - check out the pinout for the bltouch and also use a multimeter to check which pins/ports on the motherboard are ground, 5v or signals.
  • FrezapFrezap Posts: 21Member, 🌟 Super Member 🌟
    I am currently trying to compile a firmware with bltouch enabled.
    I added the line #define SERVO0_PIN PC5 to the pins file.

    Its done the same way for the mks robin...

    It is unsuccesfull due to this error:

    Marlin\src\HAL\shared\servo_private.h:51:4: error: #error "This library only supports boards with an AVR or SAM3X processor."

    I have already seen that the STM32F1 HAL has some servo specific files. But they don't seem to be used by the compiler?

    I'm kinda lost with this, it seems way beyond my current knownledge. I hope someone has an insight!
  • Samuel PinchesSamuel Pinches Posts: 2,997Administrator
    Are there any required libraries? Check that they are not commented out in platformio.ini in the root marlin folder.
  • FrezapFrezap Posts: 21Member, 🌟 Super Member 🌟
    Doesn't seem to be a library issue.


    "Evidently you can't even compile STM32F1 with servos. The HAL code for this seems to be essentially broken. The STM32F1 platform doesn't even use the same methodology for servos that the other platforms do. Each servo in STM32F1 is an instance of the <i>Servo</i> class, rather than just an element in an array within the <i>Servo</i> class. There is no <i>MAX_SERVOS</i> defined."

    Seems like the code for servos on STM32F1 needs to be rewritten from scratch :/


    We are not alone with this tho. This seems to be a similar issue: https://github.com/MarlinFirmware/Marlin/issues/14315

    Maybe we could switch HALs or maybe there is code to bring over.


    All this stuff is kinda old by now, so I am not sure if I am looking in the right places.

    I won't have any more time this week so I can't look into it further right now.


    My complete error message for reference:

    Compiling .pioenvs\JGAURORA_A5S_A1\src\src\HAL\HAL_STM32F1\HAL_Servo_STM32F1.cpp.o
    Marlin\src\HAL\HAL_STM32F1\HAL_Servo_STM32F1.cpp: In member function 'bool libServo::attach(int32_t, int32_t, int32_t)':
    Marlin\src\HAL\HAL_STM32F1\HAL_Servo_STM32F1.cpp:101:11: warning: unused variable 'tchan' [-Wunused-variable]
       uint8_t tchan = PIN_MAP[pin].timer_channel;
               ^~~~~
    Marlin\src\HAL\HAL_STM32F1\HAL_Servo_STM32F1.cpp: In member function 'bool libServo::setupSoftPWM(int32_t)':
    Marlin\src\HAL\HAL_STM32F1\HAL_Servo_STM32F1.cpp:224:51: warning: no return statement in function returning non-void [-Wreturn-type]
       bool libServo::setupSoftPWM(const int32_t pin) {}
                                                       ^
    Compiling .pioenvs\JGAURORA_A5S_A1\src\src\HAL\shared\servo.cpp.o
    Compiling .pioenvs\JGAURORA_A5S_A1\src\src\Marlin.cpp.o
    Compiling .pioenvs\JGAURORA_A5S_A1\src\src\feature\Max7219_Debug_LEDs.cpp.o
    In file included from Marlin\src\HAL\shared\servo.cpp:59:0:
    Marlin\src\HAL\shared\servo_private.h:51:4: error: #error "This library only supports boards with an AVR or SAM3X processor."
       #error "This library only supports boards with an AVR or SAM3X processor."
        ^~~~~
    Marlin\src\HAL\shared\servo_private.h:62:0: warning: "MAX_SERVOS" redefined
     #define MAX_SERVOS   (_Nbr_16timers  * SERVOS_PER_TIMER)
     
    In file included from Marlin\src\HAL\shared\servo.h:78:0,
                     from Marlin\src\HAL\shared\servo.cpp:58:
    Marlin\src\HAL\shared\../HAL_STM32F1/HAL_Servo_STM32F1.h:32:0: note: this is the location of the previous definition
       #define MAX_SERVOS 3
     
    Compiling .pioenvs\JGAURORA_A5S_A1\src\src\feature\babystep.cpp.o
    In file included from Marlin\src\HAL\shared\servo.cpp:59:0:
    Marlin\src\HAL\shared\servo_private.h:62:23: error: '_Nbr_16timers' was not declared in this scope
     #define MAX_SERVOS   (_Nbr_16timers  * SERVOS_PER_TIMER)
                           ^
    Marlin\src\HAL\shared\servo_private.h:93:31: note: in expansion of macro 'MAX_SERVOS'
     extern ServoInfo_t servo_info[MAX_SERVOS];
                                   ^~~~~~~~~~
    In file included from Marlin\src\HAL\shared\servo.cpp:59:0:
    Marlin\src\HAL\shared\servo_private.h:97:21: error: variable or field 'initISR' declared void
     extern void initISR(timer16_Sequence_t timer);
                         ^~~~~~~~~~~~~~~~~~
    Marlin\src\HAL\shared\servo_private.h:97:21: error: 'timer16_Sequence_t' was not declared in this scope
    Marlin\src\HAL\shared\servo_private.h:97:21: note: suggested alternative: 'timer_resume'
     extern void initISR(timer16_Sequence_t timer);
                         ^~~~~~~~~~~~~~~~~~
                         timer_resume
    Marlin\src\HAL\shared\servo_private.h:98:20: error: variable or field 'finISR' declared void
     extern void finISR(timer16_Sequence_t timer);
                        ^~~~~~~~~~~~~~~~~~
    compilation terminated due to -fmax-errors=5.


    Have a nice day!
    Frezap
    Thanked by 1Samuel Pinches
  • Samuel PinchesSamuel Pinches Posts: 2,997Administrator
    edited June 2019
    One idea .... the bltouch needs only two set servo angles. Wouldn’t be too hard to program an arduino nano to take a on/off input and spit out the correct 5V pwm duty for those angles... or is that cheating haha?? It sounds like the coding required for adding servo support to stm32f1 is both absent and beyond my skill level to implement...
    Post edited by Samuel Pinches on
  • Al_GAl_G Posts: 1Member
    The bed is clearly not straight! 
  • eyeseyes Posts: 70🌟 Super Member 🌟
    Did you ever get the BLTouch working? I am considering changing to the SKR v1.3 board. It works for that board. I am using a magnetic build plate and I think when I remove and replace it my manual mesh leveling is changing slightly. I would like to use bilinear leveling and have it run before each print.
  • Samuel PinchesSamuel Pinches Posts: 2,997Administrator
    Sorry, nope, haven't got time to look at it at the moment sorry.
  • eyeseyes Posts: 70🌟 Super Member 🌟
    If I know the pin to use I want to see if I can get it working. I want to use the unused z max. It is  labeled as PB1. Do I enter it exactly way - vs any decimals like PB.1.
    for example:
    #define Z_MIN_PROBE_PIN PB1
  • Samuel PinchesSamuel Pinches Posts: 2,997Administrator
    Yes exactly right. Except, the pin out I posted is actually slightly wrong. The correct pins are:

    //#define X_MAX_PIN          PC5
    //#define Y_MAX_PIN          PC4
    //#define Z_MAX_PIN          PB0
  • Samuel PinchesSamuel Pinches Posts: 2,997Administrator
    @Frezap you mentioned you had done some work on this?
    >  bl touch confirmed working with PD7 for the signal wire and PG0 for the white "endstop" wire
  • eyeseyes Posts: 70🌟 Super Member 🌟
    Thank you I'll try that. Interested to see I those settings worked @Frezap. If so where did you put those in configuration.h? Marlin 2.0 is a little different than the last time I set up a bltouch
  • Samuel PinchesSamuel Pinches Posts: 2,997Administrator
    edited August 2019
    At a minimum you’ll need to configure configuration.h as well as the pins_jgaurora_A5S_A1.h file.

    I haven’t done this myself simply due to a lack of time at the moment - I don’t have time to walk you through the process, but maybe others can help.
    Thanked by 1eyes
    Post edited by Samuel Pinches on
  • eyeseyes Posts: 70🌟 Super Member 🌟
    I have done that before but with instructions for the board I was using. I think I may be able to figure it out. I'll update here if I'm successful. Thank you for your help. 
    Thanked by 1Samuel Pinches
  • eyeseyes Posts: 70🌟 Super Member 🌟
    I started to attempt the install of my new BLTouch 3.0. I created a new .bin file and uploaded it.  I connected the BLTouch to the main power (24V), heard a pop and now it's dead. So I took the V2 from my other printer and it goes through the power cycle now when I turn it on. I have red to 5v, brown to ground, white and black to Z Min, and orange to what I think is the correct pin. I am using 
    #define BLTOUCH
    #define SERVO_PIN PB0
    #if ENABLED(BLTOUCH)
    //#define BLTOUCH_DELAY 100 // (ms) Enable and increase if needed
    #endif
    in configuration.h 
    and 
    #define SERVO_PIN PB0
    in pins.JGAURORA_A5S_A1.h.

    But when I try to run M280 P0 S10 I get the response 
    Recv: echo:Unknown command: "M280 P0 S10"Recv: ok
    
    Can anyone help here? I feel like I am missing something simple.
    
    
    
    
    
  • Samuel PinchesSamuel Pinches Posts: 2,997Administrator
    edited August 2019
     I suggest PD7 for servo pin, and PG0 for endstop pin.

    You don’t need to define servo pin twice.

    Have you set :
    - Z_MIN_PROBE_PIN
    - NUM_SERVOS
    - SERVO_ENDSTOP_ANGLES
    - Z_ENDSTOP_SERVO_NR

    Thanked by 1eyes
    Post edited by Samuel Pinches on
  • eyeseyes Posts: 70🌟 Super Member 🌟
    So PD7 orange wire and PG0 white wire ( I think the white and black are the same as the 2 wires on the microswitch). I will look at my file for the first one but I know I don't have 2-4 set. I've never set those values so I'll look them up and see what to set. I see those pins will have to be accessed via the ribbon cable. Any particular reason for using them?
    Thank you. I know you said you don't have time to work on this right now so I really appreciate your help. 
    Thanked by 1Samuel Pinches
  • Samuel PinchesSamuel Pinches Posts: 2,997Administrator
    I could be wrong - I have a bltouch too (about 2 years old now in box!!) but haven’t had a chance to setup, so I’m not really familiar with it.
  • eyeseyes Posts: 70🌟 Super Member 🌟
    Forgot to ask... Testing 5v and ground are simple but how do you use a multimeter to test to see what pins are signals?
  • Samuel PinchesSamuel Pinches Posts: 2,997Administrator
    Sorry, I probably can answer, but can you please be more specific - what model is your multimeter (or a photo), and what exactly are you trying to do? Pinout is on the wiki: https://jgaurorawiki.com/a5s

    note: max endstops are incorrect, I still need to update those, should be
    #define X_MAX_PIN          PC5
    #define Y_MAX_PIN          PC4
    #define Z_MAX_PIN          PB0

  • eyeseyes Posts: 70🌟 Super Member 🌟
    I want to know how to identify which wire of a socket is the pin. For example in the Z max plug socket on the board the center wire appears to be negative and the ones on either side are 5v and 3v. Which one of these is Pin PB0? 
  • FrezapFrezap Posts: 21Member, 🌟 Super Member 🌟
    For the Endstops the most right pin should be PB0 when looking from this perspective: 
    But I didn't have any luck using the endstop pins!!!


    I got my 3DTouch from triangle Labs working. But it was with Klipper and I dont use that anymore currently. I get a way better surface finish with marlin.

    My set up was:
    red wire to 3.3V on endstop
    black wire to ground on endstop
    orange wire to PD7 on the lcd header
    white wire to PG0 on the lcd header
    brown wire not connected

    Yes, I didn't have my lcd screen plugged in when using the Probe. No I don't know if the wireing would be the same for an original BLTouch.

    I would like to try using a BLTouch again with Marlin, but the tests I did a while back weren't promising. I will only tinker with firmware stuff again once I got my A5S converted to a Hypercube...


    Thanked by 1eyes
  • eyeseyes Posts: 70🌟 Super Member 🌟
    I will try my original BL Touch and see if it works. I wonder if you could splice into the ribbon cable and keep the LCD plugged in. I'm considering changing the board to an SKR v1.3 32 bit board if I can't get this working. It actually has included servo pins. t would also be quieter because you can choose your stepper drivers, but I really hate to just stop using an otherwise perfectly good A5S board.
    Thank you for your response. I'll let you know how it goes.

    What did you have #define SERVO_PIN set to? 
  • eyeseyes Posts: 70🌟 Super Member 🌟
    Almost forgot - I have an unused 3D Touch so I can compare the results between the two.
Sign In or Register to comment.