2.3. Hardware Extensions¶
This guide will show you how to use the extension port to communicates with hardware extensions.
2.3.1. Understanding the extension port¶
The extension port is located at the top cap of FLUX Delta. It has 10pins, including - 1 UARTs, 1 stepper motor control, 1 GND, 1 analog output, 3 digital input/output pins, 3.3V and 24V outputs.
DESCRIPTION
Tx / Rx - Used for UART communication.
EN / STP / CT-REF / DIR - Used for stepper motor control.
INPUT0 - Digital input.
OUTPUT 0-1 - Digital outputs.
PWM0 - Analog outputs.
GND - Ground pin.
3.3V - Can be used for powering MCUs, for example like Arduino Pro Mini. The maximum current is 3A.
24V - Can be used for powering heater, drills or other power consuming components. The maximum current is 3A.
2.3.2. Developing firmware for hardware extensions¶
A typical toolhead uses UART to communicate with its hosting machine , clone or download the example project to build your tool head.
git clone https://github.com/flux3dp/selfdefined_toolhead_example
2.3.3. Communicating with hardware extensions¶
*The delta firmware must be upon 1.3b4
This example shows how to communicate to self-defined toolhead using a self-defined command ( like arduino digitalWrite function ) .
from fluxclient.commands.misc import get_or_create_default_key
from fluxclient.robot import FluxRobot
from fluxclient.sdk.delta import Delta
from time import sleep
#Swap your Delta's ip here
delta = Delta.connect_delta(ip='192.168.18.114', client_key='./sdk_connection.pem', kick=True, blocking=False)
delta.home()
# Use self-defined toolhead
result = delta.set_head('USER')
if result:
print('Tool head ready')
# Set pin 2 HIGH
resp = delta.serial_write(b'DIGITALWRITE 2 STATE 1\n')
print(resp)
sleep(1)
# Set pin 2 LOW
resp = delta.serial_write('DIGITALWRITE 2 STATE 0\n')
print(resp)
sleep(1)
else:
print('Tool head never ready')
delta.close()