Skip to main content

Digital Out

Hardware

The AutomatePro comes with 12x digital outputs for controlling external systems from small solenoids to LEDs or small DC motors. There are two different digital outputs available, one is setup as a highside output (DO_H_0x) which PWMs the onboard 12V as an output. The second is a Lowside sink (DO_L_0x) which sinks upto 36V with the first four being PWM controllable and

Connector Pinout

Digital Output Highside (DO_H_x) Specifications

There are 6x highside digital outputs with all 6 being PWM controllable switches.


ParameterValue
Output Voltage (Onstate)+12V (from on-board 12V)
Drive Current500mA
PWM ControllableAll (DO_H_01 - DO_H_06)
PWM Switching Frequency500Hz
Number of Outputs6

SVG Image created as Graphical Drawings-DO_H_x.svg date 2025/02/06 13:37:17 Image generated by Eeschema-SVG+12VMDO_H_xOnboardAutomatePro+12V


Digital Output Lowside (DO_L_x) Specifications

There are 6x lowside digital outputs the first four are PWM controllable while the final two are binary on/off switches.


ParameterValue
OnstateSinks up to 36V
Drive Current500mA
PWM ControllableDO_L_01
DO_L_02
DO_L_03
DO_L_04
D0_L_05 & DO_L_06 are On/Off switches
PWM Switching Frequency10Hz
Number of Inputs6

SVG Image created as Graphical Drawings-DO_L_x.svg date 2025/02/06 13:37:17 Image generated by Eeschema-SVGGNDMOnboardAutomateProDO_L_x


ROS API

Subscribers

TopicTypeDescription
/io/digital_outautomatepro_interfaces/msg/DigitalOutPublish the desired digital out states to this topic. AutomatePro supports 12 digital out pins (6 High Side and 6 Low Side). Each input pin is referred to as DIGITAL_OUT_H_XX or DIGITAL_OUT_L_XX, where H/L refer to High Side/Low Side, XX is the pin number, ranging from 01 to 06.

d_out_pin_id:
DataType: uint8
(Use ENUM constants defined in msg definiton. DigitalOut.DIGITAL_OUT_H_XX: 01-06
DigitalOut.DIGITAL_OUT_L_XX: 01-06)

duty_cycle_percent:
DataType: uint8
Min: 0 in percentage %
Max: 100 in percentage %

Response Rate: 200 ms

Example

Example code snippets toggles the duty cycle of Digital Out 01 by publishing to the /io/digital_out topic.

import rclpy
from rclpy.node import Node
from automatepro_interfaces.msg import DigitalOut

class DigitalOutPublisher(Node):

def __init__(self):
super().__init__('digital_out_publisher')
self.publisher_ = self.create_publisher(DigitalOut, '/io/digital_out', 10)
self.timer = self.create_timer(1.0, self.timer_callback) # 1s
self.duty_cycle_sequence = [0, 50, 100, 50]
self.sequence_index = 0

def timer_callback(self):
msg = DigitalOut()
msg.d_out_pin_id = DigitalOut.DIGITAL_OUT_H_01 # Digital Out High Side Pin 01
msg.duty_cycle_percent = self.duty_cycle_sequence[self.sequence_index] # Duty Cycle: 0%, 50%, 100%, 50%
# 0% - OFF, 100% - ON
self.publisher_.publish(msg)
self.get_logger().info('Publishing: "%s"' % msg)
self.sequence_index = (self.sequence_index + 1) % len(self.duty_cycle_sequence)

def main(args=None):
rclpy.init(args=args)
node = DigitalOutPublisher()
rclpy.spin(node)
node.destroy_node()
rclpy.shutdown()

if __name__ == '__main__':
main()

Run the node using the following command:

ros2 run automatepro_python_tutorials digital_out_node