Auto bed leveling sensor for Cetus3D
After having my Cetus3D fitted with the tinyFab CPU, I wanted to implement automatic bed leveling. The SmoothieWare firmware supports this and is described here. As the rest of the Cetus3D hardware is quite a closed system, I had to rely on information collected by tinyFab about the workings. I found the following image on the Cetus3D Facebook group
This became the basis for my auto bed leveling implementation.
Sensor
It all starts with the sensor. Most applications rely on either an inductive sensor or a mechanical switch. The problem with inductive sensors, however, is that they rely on voltages from 6 - 36V. This voltage is not readily available on the Cetus, it’s all 5 Volt. After reading some forums and paging through Aliexpress, I found a sensor that could work, the 3D Touch sensor.
This sensor combines two things
Actuator to drop a pin
Sensor to sense touching the bed
It needs the following connections
3-pin: Brown (-, GND) Red (+5V) Orange (control signal)
2-pin: Black (-, GND) White (Z min)
The actuator is triggered by a PWM signal on the three pin connector where the duty cycle determines the functions
3% - Push pin down
7% - Push pin up
8.4% - Self Test
10.6% - Alarm Release
5.5% - M119 Test Mode
Based on the image show earlier we have two port on the tinyFab CPU that we can use
Port 1.18 - This is connected to the second header on the extruder board.
Port 2.13 - This is attached to the door check on the mainboard
So I started with the easy stuff solder a socket to the mainboard for the door check like so
Then came the next challenge connecting the actuator. I hoped life would be easy and I could just connect the three pins to the auxiliary connector on the extruder. As can be seen, by the diagram, there is a transistor attached to pin 1.18 that pulls the signal low on a high from a pin. This meant that I needed something to make the signal go high against the GND pin. TinyFab suggested using a 10k resistor between 5V and the signal. Now I got the right signal between GND and the Signal pen. The only minor issue was that setting the pin to 3% resulted in a 97% duty cycle. By reverse logic setting it to 97% got me a 3% duty cycle and I could trigger the actuator. This is how I eventually modified my extruder board to get the right connections to the auxiliary connector.
The pins on the left are from top to bottom:
Signal (connected to 5V with 10k resistor)
GND (from Pin 3 of the Fan connector)
5V
Putting everything together and connecting the actuator to the extruder board it looks like this.
Configuration
There are three things that need to be setup in the config.txt file. First the servo, this controls the up and down movement of the pin. Modify the following lines in your config.txt file:
switch.servo.enable true switch.servo.input_on_command M280 S97.0 # 100 - 3% switch.servo.input_off_command M280 S93.0 # 100 - 7% switch.servo.output_pin 1.18 # Pin connected to the aux-port switch.servo.output_type hwpwm # H/W PWM output settable switch.servo.pwm_period_ms 20 # Default is 50Hz
Make sure that there is no other reference in your confiuration file to pin 1.18
The second part is are the leveling settings:
leveling-strategy.three-point-leveling.enable true # leveling-strategy.three-point-leveling.point1 38,0 # first probe point leveling-strategy.three-point-leveling.point2 175,0 # second probe point leveling-strategy.three-point-leveling.point3 175,180 # third probe point leveling-strategy.three-point-leveling.home_first true leveling-strategy.three-point-leveling.tolerance 0.03 leveling-strategy.three-point-leveling.probe_offsets 37,0,0 # based on the bracket leveling-strategy.three-point-leveling.save_plane false
The final part are the z-probe settings. That determine what pin is connected to the switch.
zprobe.enable true zprobe.probe_pin 2.13 zprobe.slow_feedrate 5 zprobe.fast_feedrate 100 zprobe.probe_height 10
Most of these settings are already in the confix.txt file, you will need to modify and uncomment based on the above settings
Bracket
To mount the 3D Touch sensor to the extruder assembly I designed a bracket. This can be downloaded from Thingiverse. I printed this using 0.1 layer height and 0.2 mm nozzle. You will need 2 10mm M3 bolts to mount it on the extruder assembly and 2 10mm M3 to mount the sensor to the bracket. The end result should look something like this:
Calibration G-Code
Now that we have the sensor mounted and hooked up to the door connector and the modified auxiliary port on the extruder board we can test if everything is working. Upon startup of your printer the sensor will light up and do a self test. Use the following commands to test the up and down movement of the pin
M280 S97 - Pin up M280 S93 - Pin down
When the pin is in the down position it should be lower than the nozzle on my printer the triggerpoint of the sensor if 0.5mm higher than the requested nozzle height. To check do the following:
Home axis: G28
Drop pin: M280 S97
To go center (based on offset of sensor): G1 X52 Y90
Now move the extruder downward until the sensor is triggered (If the sensor is not triggered before nozzle hits the bed you may need to add a washer between the sensor and the bracket.
Get a reading on the Z-Height and make a note: M114
Now you can add the following code to your slicer:
G28 ; home all axes M280 S97 ; Pin Down G32 ; Level Bed G1 X52 Y90 ; Go to center G30 Z0.5 ; Set sensor offset <-- use value seen at step 5 of the previous process M280 S93 ; Pin Up
And now we are done,.















