Control Arduino LED from ServiceNow

Bharath Kumar A
Mega Sage

Please help me to know the procedure to control an LED connected to Arduino uisng ServiceNow REST/MQTT protocol

1 ACCEPTED SOLUTION

Amarjeet Pal
Kilo Sage
Kilo Sage

To control an LED connected to an Arduino using ServiceNow REST/MQTT protocol, you can follow these general steps:

1. Connect the LED to one of the digital output pins on the Arduino. You will also need a resistor to limit the current flow through the LED.

2. Write an Arduino sketch that listens for incoming MQTT messages and sets the state of the LED accordingly. You can use a library like PubSubClient to simplify this process.

3. Flash the sketch onto your Arduino board using the Arduino IDE or another programming tool.

4. Set up an MQTT broker server that can receive messages from ServiceNow and forward them to your Arduino board. You can use a cloud-based service like AWS IoT or Microsoft Azure IoT Hub, or set up your own MQTT broker on a local machine.

5. In ServiceNow, create a REST message record that sends an HTTP POST request with the desired state of the LED as a payload in JSON format.

6. Create a business rule in ServiceNow that triggers when changes are made to a specific table or field, and sends an HTTP POST request with the desired state of the LED to your MQTT broker server using the REST message record created in step 5.

7. When the MQTT broker receives this message, it forwards it to your Arduino board over MQTT.

8. The Arduino board receives this message and sets the state of the LED accordingly using digital output commands.

Note that there may be additional configuration steps required depending on your specific hardware and software setup, as well as any security requirements or network restrictions in place within your organization.

View solution in original post

2 REPLIES 2

Amarjeet Pal
Kilo Sage
Kilo Sage

To control an LED connected to an Arduino using ServiceNow REST/MQTT protocol, you can follow these general steps:

1. Connect the LED to one of the digital output pins on the Arduino. You will also need a resistor to limit the current flow through the LED.

2. Write an Arduino sketch that listens for incoming MQTT messages and sets the state of the LED accordingly. You can use a library like PubSubClient to simplify this process.

3. Flash the sketch onto your Arduino board using the Arduino IDE or another programming tool.

4. Set up an MQTT broker server that can receive messages from ServiceNow and forward them to your Arduino board. You can use a cloud-based service like AWS IoT or Microsoft Azure IoT Hub, or set up your own MQTT broker on a local machine.

5. In ServiceNow, create a REST message record that sends an HTTP POST request with the desired state of the LED as a payload in JSON format.

6. Create a business rule in ServiceNow that triggers when changes are made to a specific table or field, and sends an HTTP POST request with the desired state of the LED to your MQTT broker server using the REST message record created in step 5.

7. When the MQTT broker receives this message, it forwards it to your Arduino board over MQTT.

8. The Arduino board receives this message and sets the state of the LED accordingly using digital output commands.

Note that there may be additional configuration steps required depending on your specific hardware and software setup, as well as any security requirements or network restrictions in place within your organization.

Bharath Kumar A
Mega Sage

Thank you very much for your patience and a detailed explanation of the process. Can you please help me sample code to send data using REST Message to the MQTT Broker? Remaining all I can do.