Logo

What can we help you with today?

How to replace a 1-Wire sensor/actuator without restarting REXYGEN runtime core (RexCore)?

Input/Output drivers, target devices, software and hardware integration

How to replace a 1-Wire sensor/actuator without restarting REXYGEN runtime core (RexCore)?

A short guide to define aliases for 1-Wire devices.

Last updated on 21 Mar, 2019

All the 1-Wire devices are referenced by a "path" of the OWFS package (namely the owserver), which the 1-Wire driver of REXYGEN relies on. This "path" is hardcoded in the compiled application and it typically includes the 64-bit ID of the 1-Wire device, e.g. /28.551DDF030000/temperature12

Replacing a sensor therefore normally means you have to reconfigure the 1-Wire driver in your project, recompile it and download it to the target device, resulting in restarting the whole application, which is undesirable in some cases.

Luckily, the OWFS package supports the so-called aliases for individual 1-Wire devices. If you define the aliases, you can reference them in 1-Wire driver configuration in REXYGEN Studio. This adds one layer of hardware abstraction, which will allow you to replace a 1-Wire sensor/actuator on the fly if needed. In case of replacing the 1-Wire device, you'll just update the alias definition. But for REXYGEN runtime core, everything will look the same.

Configuring OWFS aliases

Please add the following line to your /etc/owfs.conf:

alias = /etc/ow-alias

Now create the file with aliases definition:

sudo nano /etc/ow-alias

And put the following content in (replace the 1-Wire IDs with the IDs of your own devices!):

/28.551DDF030000 = sensor1<br>/28.1FBFBC020000 = sensor2

Save the file and restart owserver:

sudo systemctl restart owserver

Now run owdir and you should see your aliases.

Instead of e.g. owread /28.551DDF030000/temperature12 you can now read the temperature using

owread /sensor1/temperature12

And you can use /sensor1/temperature12 in the OwsDrv driver configuration in REXYGEN Studio.

Image

As a result, you'll be able to replace a 1-Wire sensor/actuator without restarting REXYGEN runtime core (RexCore). In such a case, the only thing which you will need to do is editing the ID in /etc/ow-alias file and restarting the owserver. 

Did you find this article helpful?
Previous

Modbus RTU with the Monarco HAT on Raspberry Pi

Next