Beginner concept question for serial communication

  • Hello,

    I am a complete beginner. I want to integrate a 3 probe temperature arduino (one-wire) with displays into my home assistant setup (on a pi 0).

    The arduino nano clone has 3 Dallas temperature probes connected with onewire, and a Serial adapter on pins 00 and 1. The serial port is connected to a Moxa Nport serial server for the local LAN.

    My idea was to have a mysensors gateway on a Raspberry Pi 1b which connects to the virtual serial port (Nport) to exchange with the arduino. The gateway would further connect to the home assistant controller on the pi0. I also plan to make a node-red connection to influxDB and grafana.

    Most exemples are for radio communication, which I would not use for the moment (extension possible in the future).

    Is this a reasonable approach ? For the moment I cannot figure out the sketch for the arduino with serial only communication. I compiled the mysensors gateway on the pi1b as ethernet and configured also the serialport. It fails to initiate as there is no node active yet.

    Thank you for your help,


  • @hubertus I'm not getting the description of you setup. Perhaps a sketch would be good?

    Wen I need serial communication, with the Arduino, I use SoftwareSerial on two other I/O lines. That way I can debug real time, SoftwareSerial is slower but you're only doing temperature so 9600BAUD would be fin

    Also, don't try to do too much at once. Break the task down into small, manageable sections. You have a lot of different things going on, get one thing going at a time.


  • You can enable direct one-wire input on the Raspberry Pi itself. Here's some python code that I use in my domestic heating monitoring. It uses an 'OpenPi' which was an early kickstarter project using a 1st generation R Pi compute board, but any Pi has the one-wire libraries available.

    find all the active one-wire sensors

    base_dir = '/sys/bus/w1/devices/'
    device_files = []
    for n in range(0,3):
    device_folder = glob.glob(base_dir + '28*')[n]

    print device_folder

    	device_file =  device_folder + '/w1_slave'
    	device_files.append (device_file)		

    print device_file

    	print n
    	nend = n

    print device_files

    #data logging of my OpenPi DS18B20 sensor

    def read_temp_raw(n):

    print n,device_files[n]

    f = open(device_files[n], 'r')
    lines = f.readlines()

    print lines

    return lines

  • Hi there and thank you for your help. The answers came later than I expected (never mind) and during a period as I am away from my arduinos and raspberry.
    I will try to make a sketch to show you the set up. But I am not interested to connect the sensor directly to raspberry pi by one-wire. The set up is like this

    Arduino with Dallas Temperature <> Serial interface <Serial cable> Moxa Serial to IP <Ethernet / virtual serial port> Raspberry pi as gateway with virtual serial port <Ethernet> Home assistant

    I will try to use SoftwareSerial, which is what I used already without mysensors on pin 00 et 1. What I am struggling with is the mysensors configuration for serial port and the gateway on raspberry with the virtual serial port.

    Keep you updated.

Log in to reply

Suggested Topics