I’m developing a Modbus RTU architecture. The master of this architecture is my Beagebone Black , which I want to connect via RS-485 serial communication to my sensors. Since I’m using RS-485 converters (RS-485 Converter) which need a UART input as far as I understand, I was looking for sensors capable of taking environmental data, or even motion sensors or whatever, in order to connect them directly to my converters to “simulate” a Modbus communication.
Do you know any UART compatible sensors that I can use?? Some links to the products would help me.
Some XBee sensors handle themselves via commands from USB or your own connections.
One issue w/ XBee, spacing of the pins are not regular
breadboard spacing.
Seth
P.S. Here are some basic links to XBee products:
- https://www.sparkfun.com/pages/xbee_guide
- https://www.sparkfun.com/search/results?term=Xbee
I found that some older models handle UART connections very well! I am sort of out-of-the-loop now w/ XBee and ZigBee tech for now but I may show something soon…
I will try. Using the XBee w/ BBB is simple (sort of)…
Here: XBee Python Library — Digi XBee Python library 1.4.1 documentation (xbplib.readthedocs.io)
usually w/in their arch, there are some changes needing to be made like instead of COM one would use /dev/ttyS2
.
from digi.xbee.devices import XBeeDevice
from digi.xbee.io import IOLine, IOMode
import time
import threading
# TODO: Replace with the serial port where your local module is connected to.
PORT = "COM1" # Use '/dev/ttyS2' on Linux machines like the BBB!
# TODO: Replace with the baud rate of your local module.
BAUD_RATE = 9600
IO_LINE_IN = IOLine.DIO3_AD3
IO_LINE_OUT = IOLine.DIO4_AD4
def main():
print(" +----------------------------------------------+")
print(" | XBee Python Library Get/Set Local DIO Sample |")
print(" +----------------------------------------------+\n")
stop = False
th = None
device = XBeeDevice(PORT, BAUD_RATE)
try:
device.open()
def io_detection_callback():
while not stop:
# Read the digital value from the input line.
io_value = device.get_dio_value(IO_LINE_IN)
print("%s: %s" % (IO_LINE_IN, io_value))
# Set the previous value to the output line.
device.set_dio_value(IO_LINE_OUT, io_value)
time.sleep(1)
th = threading.Thread(target=io_detection_callback)
device.set_io_configuration(IO_LINE_IN, IOMode.DIGITAL_IN)
device.set_io_configuration(IO_LINE_OUT, IOMode.DIGITAL_OUT_LOW)
time.sleep(1)
th.start()
input()
finally:
stop = True
if th is not None and th.is_alive():
th.join()
if device is not None and device.is_open():
device.close()
if __name__ == '__main__':
main()
This is from some source I found online at Digi’s github.com account.
Seth
P.S. This may get you started! Enjoy…