Re: [Owfs-developers] Non related OWFS help with 1-Wire devices.

2020-10-08 Thread Henrik Östman
Nice setup Nico!
And a useful watchdog for the DS2408, thanks for sharing the schematics!
I'm still struggling with my implementation, resetting the microcontroller
will get the DS2480 out of sync somehow, and the only way to get back on
track is to powercycle the beast.
I have tried to send a master control reset to the DS2480, but it doesn't
seem to work, the chip is notoriously hard to reset.

So I threw the circuit away and have ordered a new PCB based upon the
DS2484(I2C), hopefully it works better than the serial DS2480, at least it
requires less external components and a reset is only a I2C-instruction
away. :-)
Crossing my fingers that this one works better...

// Henrik

Den tors 8 okt. 2020 kl 10:30 skrev Nico Bouthoorn :

> Also comment on what Mick mentioned  about power supply  problems.  I 've
> made a kind of ups.   5V 3A regulator IC, driven by a normal switched PS
> 12V and  a 12V battery, divided bij Schottky diodes.
> But i'm using  a BeageBone Black, a uptime in this way of 2 years is not a
> problem.
> i'm using also a watchdog circuit behind the DS2408 for temperature
> runaways.
>
> I did just a refresh/rework of my 1-wire project website: https://fstab.nl
> I'm controlling my greenhouse(s) in this way
>
> Nico
>
> Henrik Östman wrote:
>
> Hi!
> I have been following the OWFS project for 20+ years and I really think
> it's a marvelous piece of software. It's been run on a Raspberry Pi for
> many years now to control the heating in our house.
> However lately my Raspberry Pi has been more and more unstable,
> overheating problems, diskfailure, hanging, owserver unexpectedly going
> down and soo forth. It really got me thinking if my setup is the best
> approche, my wife and kids should not have to be Unix admins and be able to
> SSH to my server and restart the Docker container with Owserver just to not
> freeze when I'm out on a business trip! So in a true Unix spirit I'm
> splitting my Home automation system appart into well defined pieces that
> "do one thing and do it well".
> My house is heated by water-based floor heating, and there are three floor
> heating control centers, with relays opening and closing the water-valves.
> Each control center has a DS2408 controlling the relayes of 3-5 valves. A
> made a small circuit board with a commonly used Arduino compatible
> microcontroller that reads the temperature in the rooms using DS1820
> sensors, then instructs the DS2408 to open/close the right valve. There is
> one circuit board for each control center, so if one goes down only a few
> rooms get affected. There is a reset-button on each circuit board that
> could be used to restart it for whatever reason, and since there are no
> filesystems mounted there is no problem with corruption in case of power
> loss, and restarting only takes a second. The Raspberry Pi is now only used
> for plotting graphs, MQTT and other home automation tasks.
>
> Since I no longer use Owserver in my setup, I understand that it may be
> inappropriate to ask for help within this forum. But I know that there are
> some 10+ years skilled developers here with deep knowledge of 1-Wire
> systems so I'm still going to pop the questions, maybe you could direct me
> to a more suitable forum where we could continue the discussion?
>
>  The problem I'm having is with the DS2408 devices, I only seem to be able
> to communicate with them using the SKIP-ROM command, if I try to address
> them individually then I only get garbage and errors back. The same code
> works great when addressing DS2423 and DS18(B/S)20 devices, so I think the
> code itself should work. Maybe I have missed something when communicating
> or initializing the DS2408? I tried to read all the Maxim specs, and it
> feels like I'm doing everything right. During startup I begin with
> initializing the DS2408 and set the pins to output and to a known state.
>
> void ds2408_reset(DS2480B , onewireNode ) {
> ESP_LOGD(TAG, "Reset DS2408, id: %s.", node.idStr.c_str());
> if (existTestMode(ds, node)) {
> // Configure RSTZ as STRB output.
> //ds.select(node.id); // reselect last selected device.
> ds.write(SKIP_ROM); // HACK, this select all devices on the bus, but we
> should select only this single device. Though I get CRC-errors using above
> line.
> ds.write(0xCC); // Issue Write Conditional Search Register command
> ds.write(0x8D); // TA1, target address = 8Dh
> ds.write(0x00); // TA2, target address = 008Dh
> ds.write(0x04); // Write byte to Control/Status Register, RSTZ as STRB
> output
> // Verify configuration setting
> if (!ds.reset()) {
> ESP_LOGW(TAG, "Reset DS2408 failed after non-success configure RSTZ as
> STRB.");
> node.errors++;
> return;
> }
> ds.write(RESUME); // reselect last selected device.
> ds.write(0xF0); // Issue Read PIO Registers command
> ds.write(0x8D); // TA1, target address = 8Dh
> ds.write(0x00); // TA2, target address = 008Dh
> auto status = ds.read(); // Read Control/Status Register and verify
> ESP_LOGD(TAG, "DS2408 

Re: [Owfs-developers] Non related OWFS help with 1-Wire devices.

2020-10-08 Thread Nico Bouthoorn via Owfs-developers
Also comment on what Mick mentioned about power supply  problems.  I 've 
made a kind of ups.   5V 3A regulator IC, driven by a normal switched PS 
12V and  a 12V battery, divided bij Schottky diodes.
But i'm using  a BeageBone Black, a uptime in this way of 2 years is not 
a problem.
i'm using also a watchdog circuit behind the DS2408 for temperature 
runaways.


I did just a refresh/rework of my 1-wire project website: https://fstab.nl
I'm controlling my greenhouse(s) in this way

Nico

Henrik Östman wrote:

Hi!
I have been following the OWFS project for 20+ years and I really 
think it's a marvelous piece of software. It's been run on a Raspberry 
Pi for many years now to control the heating in our house.
However lately my Raspberry Pi has been more and more unstable, 
overheating problems, diskfailure, hanging, owserver unexpectedly 
going down and soo forth. It really got me thinking if my setup is the 
best approche, my wife and kids should not have to be Unix admins and 
be able to SSH to my server and restart the Docker container with 
Owserver just to not freeze when I'm out on a business trip! So in a 
true Unix spirit I'm splitting my Home automation system appart into 
well defined pieces that "do one thing and do it well".
My house is heated by water-based floor heating, and there are three 
floor heating control centers, with relays opening and closing the 
water-valves. Each control center has a DS2408 controlling the relayes 
of 3-5 valves. A made a small circuit board with a commonly used 
Arduino compatible microcontroller that reads the temperature in the 
rooms using DS1820 sensors, then instructs the DS2408 to open/close 
the right valve. There is one circuit board for each control center, 
so if one goes down only a few rooms get affected. There is a 
reset-button on each circuit board that could be used to restart it 
for whatever reason, and since there are no filesystems mounted there 
is no problem with corruption in case of power loss, and restarting 
only takes a second. The Raspberry Pi is now only used for plotting 
graphs, MQTT and other home automation tasks.


Since I no longer use Owserver in my setup, I understand that it may 
be inappropriate to ask for help within this forum. But I know that 
there are some 10+ years skilled developers here with deep knowledge 
of 1-Wire systems so I'm still going to pop the questions, maybe you 
could direct me to a more suitable forum where we could continue the 
discussion?


 The problem I'm having is with the DS2408 devices, I only seem to be 
able to communicate with them using the SKIP-ROM command, if I try to 
address them individually then I only get garbage and errors back. The 
same code works great when addressing DS2423 and DS18(B/S)20 devices, 
so I think the code itself should work. Maybe I have missed something 
when communicating or initializing the DS2408? I tried to read all the 
Maxim specs, and it feels like I'm doing everything right. During 
startup I begin with initializing the DS2408 and set the pins to 
output and to a known state.


void ds2408_reset(DS2480B , onewireNode ) {
ESP_LOGD(TAG, "Reset DS2408, id: %s.", node.idStr.c_str());
if (existTestMode(ds, node)) {
// Configure RSTZ as STRB output.
//ds.select(node.id ); // reselect last selected device.
ds.write(SKIP_ROM);// HACK, this select all devices on the bus, but we 
should select only this single device. Though I get CRC-errors using 
above line.

ds.write(0xCC);// Issue Write Conditional Search Register command
ds.write(0x8D);// TA1, target address = 8Dh
ds.write(0x00);// TA2, target address = 008Dh
ds.write(0x04);// Write byte to Control/Status Register, RSTZ as STRB 
output

// Verify configuration setting
if (!ds.reset()) {
ESP_LOGW(TAG, "Reset DS2408 failed after non-success configure RSTZ as 
STRB.");

node.errors++;
return;
}
ds.write(RESUME);// reselect last selected device.
ds.write(0xF0);// Issue Read PIO Registers command
ds.write(0x8D);// TA1, target address = 8Dh
ds.write(0x00);// TA2, target address = 008Dh
auto status = ds.read();// Read Control/Status Register and verify
ESP_LOGD(TAG, "DS2408 verify configuration setting: %s.", 
String(status, HEX));

// Set all relays off.
setState(ds, node, B);
} else {
ESP_LOGW(TAG, "Reset DS2408 failed for id: %s.", node.idStr.c_str());
}
}

/**
* Exit test-mode.
* "The DS2408 is sensitive to the power-on slew rate and can 
inadvertently power up with a test mode
* feature enabled. When this occurs, the P0 port does not respond to 
the Channel Access Write command."

* @return0=failed, 1=success
*/
bool existTestMode(DS2480B , onewireNode ) {
// RST PD 96h <64-bit DS2408 ROM Code> 3Ch RST PD
if (ds.reset()) {// onewire initialization sequence, to be followed by 
other commands

ds.write(0x96);
for (uint8_t i = 0; i < 8; i++) {
ds.write(node.id[i]);
}
ds.write(0x3C);
if (ds.reset()) {
return 1;
}
}
return 0;
}

int16_t setState(DS2480B , onewireNode , uint8_t state) {
if 

Re: [Owfs-developers] Non related OWFS help with 1-Wire devices.

2020-09-16 Thread Henrik Östman
Thanks for your suggestions Mick! And interesting to read about how you
tackle the lookups.

I also use a quality Meanwell 5 volt power supply that is connected to a
230v UPS, and the Raspberry Pi is equipped with a PiJuice Hat(
https://uk.pi-supply.com/products/pijuice-standard), so there are two
layers of uninterruptible power supplies in the system. To reduce wear on
the Flash-card it's only used during booting, the rest of the filesystem is
on an external USB-harddrive. All 1-Wire devices are powered, no
parasite-mode here, but I'm using telephone cables to connect the devices
and not Cat5-cables. I used to have a similar DS2482-800 card as you
described (*AbioWire, *https://axiris.eu/en/index.php/1-wire/abiowire) on
top of my Raspberry, all the channels help to keep the number of devices
per channel down.

However that's in the past, instead of having "all eggs in the same basket"
and where you need SSH knowledge to restart the "basket" I now try to be
more microservice with small autonomous 1-Wire controllers that can be
restarted by my wife with a button pressed.

More suggestions about my code and lowlevel pitfalls of 1-Wire devices are
welcome!
Are there any alternatives to these traditional mailing lists? Like
Discord-group?

// Henrik

Den mån 14 sep. 2020 kl 12:45 skrev Mick Sulley :

> Hi Henrik,
>
> I can't answer you questions I'm afraid but I would add a few comments.
>
> I have been using Pi's since they were first released and yes, I have had
> a few problems as well.  The most common problem I have found is power
> supply, always worth using a decent one, I use Meanwell units in critical
> situations.  Second on the list is SD cards, I have had loads of failures
> there and I generally use hard drives recovered from old laptops instead of
> SD cards.
>
> The biggest problem I have had with 1-wire is that it occasionally locks
> up.  I use a Sheepwalk RPi3 adapter to give me 8 channels, that uses the
> DS2482-800 chip.  When a lock-up occurs it needs a power cycle of 1-wire,
> reboot does not reset it.  The solution I use for that is to use a second
> Pi which drives a relay (driven via GPIO pins) and 1-wire power is routed
> through a normally closed contact on the relay.  Pi-monitor reads a
> heartbeat file on pi-control and if the heartbeat is more than 30 seconds
> old it energises the relay for 10 seconds.  This is controlling a solar hot
> water system, which can easily boil (and has several times) if the controls
> do not function correctly.
>
> Best of luck with your system.
>
> Mick
> On 12/09/2020 11:32, Henrik Östman wrote:
>
> Hi!
> I have been following the OWFS project for 20+ years and I really think
> it's a marvelous piece of software. It's been run on a Raspberry Pi for
> many years now to control the heating in our house.
> However lately my Raspberry Pi has been more and more unstable,
> overheating problems, diskfailure, hanging, owserver unexpectedly going
> down and soo forth. It really got me thinking if my setup is the best
> approche, my wife and kids should not have to be Unix admins and be able to
> SSH to my server and restart the Docker container with Owserver just to not
> freeze when I'm out on a business trip! So in a true Unix spirit I'm
> splitting my Home automation system appart into well defined pieces that
> "do one thing and do it well".
> My house is heated by water-based floor heating, and there are three floor
> heating control centers, with relays opening and closing the water-valves.
> Each control center has a DS2408 controlling the relayes of 3-5 valves. A
> made a small circuit board with a commonly used Arduino compatible
> microcontroller that reads the temperature in the rooms using DS1820
> sensors, then instructs the DS2408 to open/close the right valve. There is
> one circuit board for each control center, so if one goes down only a few
> rooms get affected. There is a reset-button on each circuit board that
> could be used to restart it for whatever reason, and since there are no
> filesystems mounted there is no problem with corruption in case of power
> loss, and restarting only takes a second. The Raspberry Pi is now only used
> for plotting graphs, MQTT and other home automation tasks.
>
> Since I no longer use Owserver in my setup, I understand that it may be
> inappropriate to ask for help within this forum. But I know that there are
> some 10+ years skilled developers here with deep knowledge of 1-Wire
> systems so I'm still going to pop the questions, maybe you could direct me
> to a more suitable forum where we could continue the discussion?
>
>  The problem I'm having is with the DS2408 devices, I only seem to be able
> to communicate with them using the SKIP-ROM command, if I try to address
> them individually then I only get garbage and errors back. The same code
> works great when addressing DS2423 and DS18(B/S)20 devices, so I think the
> code itself should work. Maybe I have missed something when communicating
> or 

Re: [Owfs-developers] Non related OWFS help with 1-Wire devices.

2020-09-14 Thread Mick Sulley

Hi Henrik,

I can't answer you questions I'm afraid but I would add a few comments.

I have been using Pi's since they were first released and yes, I have 
had a few problems as well.  The most common problem I have found is 
power supply, always worth using a decent one, I use Meanwell units in 
critical situations.  Second on the list is SD cards, I have had loads 
of failures there and I generally use hard drives recovered from old 
laptops instead of SD cards.


The biggest problem I have had with 1-wire is that it occasionally locks 
up.  I use a Sheepwalk RPi3 adapter to give me 8 channels, that uses the 
DS2482-800 chip.  When a lock-up occurs it needs a power cycle of 
1-wire, reboot does not reset it.  The solution I use for that is to use 
a second Pi which drives a relay (driven via GPIO pins) and 1-wire power 
is routed through a normally closed contact on the relay.  Pi-monitor 
reads a heartbeat file on pi-control and if the heartbeat is more than 
30 seconds old it energises the relay for 10 seconds.  This is 
controlling a solar hot water system, which can easily boil (and has 
several times) if the controls do not function correctly.


Best of luck with your system.

Mick

On 12/09/2020 11:32, Henrik Östman wrote:

Hi!
I have been following the OWFS project for 20+ years and I really 
think it's a marvelous piece of software. It's been run on a Raspberry 
Pi for many years now to control the heating in our house.
However lately my Raspberry Pi has been more and more unstable, 
overheating problems, diskfailure, hanging, owserver unexpectedly 
going down and soo forth. It really got me thinking if my setup is the 
best approche, my wife and kids should not have to be Unix admins and 
be able to SSH to my server and restart the Docker container with 
Owserver just to not freeze when I'm out on a business trip! So in a 
true Unix spirit I'm splitting my Home automation system appart into 
well defined pieces that "do one thing and do it well".
My house is heated by water-based floor heating, and there are three 
floor heating control centers, with relays opening and closing the 
water-valves. Each control center has a DS2408 controlling the relayes 
of 3-5 valves. A made a small circuit board with a commonly used 
Arduino compatible microcontroller that reads the temperature in the 
rooms using DS1820 sensors, then instructs the DS2408 to open/close 
the right valve. There is one circuit board for each control center, 
so if one goes down only a few rooms get affected. There is a 
reset-button on each circuit board that could be used to restart it 
for whatever reason, and since there are no filesystems mounted there 
is no problem with corruption in case of power loss, and restarting 
only takes a second. The Raspberry Pi is now only used for plotting 
graphs, MQTT and other home automation tasks.


Since I no longer use Owserver in my setup, I understand that it may 
be inappropriate to ask for help within this forum. But I know that 
there are some 10+ years skilled developers here with deep knowledge 
of 1-Wire systems so I'm still going to pop the questions, maybe you 
could direct me to a more suitable forum where we could continue the 
discussion?


 The problem I'm having is with the DS2408 devices, I only seem to be 
able to communicate with them using the SKIP-ROM command, if I try to 
address them individually then I only get garbage and errors back. The 
same code works great when addressing DS2423 and DS18(B/S)20 devices, 
so I think the code itself should work. Maybe I have missed something 
when communicating or initializing the DS2408? I tried to read all the 
Maxim specs, and it feels like I'm doing everything right. During 
startup I begin with initializing the DS2408 and set the pins to 
output and to a known state.


void ds2408_reset(DS2480B , onewireNode ) {
ESP_LOGD(TAG, "Reset DS2408, id: %s.", node.idStr.c_str());
if (existTestMode(ds, node)) {
// Configure RSTZ as STRB output.
//ds.select(node.id ); // reselect last selected device.
ds.write(SKIP_ROM);// HACK, this select all devices on the bus, but we 
should select only this single device. Though I get CRC-errors using 
above line.

ds.write(0xCC);// Issue Write Conditional Search Register command
ds.write(0x8D);// TA1, target address = 8Dh
ds.write(0x00);// TA2, target address = 008Dh
ds.write(0x04);// Write byte to Control/Status Register, RSTZ as STRB 
output

// Verify configuration setting
if (!ds.reset()) {
ESP_LOGW(TAG, "Reset DS2408 failed after non-success configure RSTZ as 
STRB.");

node.errors++;
return;
}
ds.write(RESUME);// reselect last selected device.
ds.write(0xF0);// Issue Read PIO Registers command
ds.write(0x8D);// TA1, target address = 8Dh
ds.write(0x00);// TA2, target address = 008Dh
auto status = ds.read();// Read Control/Status Register and verify
ESP_LOGD(TAG, "DS2408 verify configuration setting: %s.", 
String(status, HEX));

// Set all relays off.
setState(ds, node, 

[Owfs-developers] Non related OWFS help with 1-Wire devices.

2020-09-12 Thread Henrik Östman
Hi!
I have been following the OWFS project for 20+ years and I really think
it's a marvelous piece of software. It's been run on a Raspberry Pi for
many years now to control the heating in our house.
However lately my Raspberry Pi has been more and more unstable,
overheating problems, diskfailure, hanging, owserver unexpectedly going
down and soo forth. It really got me thinking if my setup is the best
approche, my wife and kids should not have to be Unix admins and be able to
SSH to my server and restart the Docker container with Owserver just to not
freeze when I'm out on a business trip! So in a true Unix spirit I'm
splitting my Home automation system appart into well defined pieces that
"do one thing and do it well".
My house is heated by water-based floor heating, and there are three floor
heating control centers, with relays opening and closing the water-valves.
Each control center has a DS2408 controlling the relayes of 3-5 valves. A
made a small circuit board with a commonly used Arduino compatible
microcontroller that reads the temperature in the rooms using DS1820
sensors, then instructs the DS2408 to open/close the right valve. There is
one circuit board for each control center, so if one goes down only a few
rooms get affected. There is a reset-button on each circuit board that
could be used to restart it for whatever reason, and since there are no
filesystems mounted there is no problem with corruption in case of power
loss, and restarting only takes a second. The Raspberry Pi is now only used
for plotting graphs, MQTT and other home automation tasks.

Since I no longer use Owserver in my setup, I understand that it may be
inappropriate to ask for help within this forum. But I know that there are
some 10+ years skilled developers here with deep knowledge of 1-Wire
systems so I'm still going to pop the questions, maybe you could direct me
to a more suitable forum where we could continue the discussion?

 The problem I'm having is with the DS2408 devices, I only seem to be able
to communicate with them using the SKIP-ROM command, if I try to address
them individually then I only get garbage and errors back. The same code
works great when addressing DS2423 and DS18(B/S)20 devices, so I think the
code itself should work. Maybe I have missed something when communicating
or initializing the DS2408? I tried to read all the Maxim specs, and it
feels like I'm doing everything right. During startup I begin with
initializing the DS2408 and set the pins to output and to a known state.

void ds2408_reset(DS2480B , onewireNode ) {
ESP_LOGD(TAG, "Reset DS2408, id: %s.", node.idStr.c_str());
if (existTestMode(ds, node)) {
// Configure RSTZ as STRB output.
//ds.select(node.id); // reselect last selected device.
ds.write(SKIP_ROM); // HACK, this select all devices on the bus, but we
should select only this single device. Though I get CRC-errors using above
line.
ds.write(0xCC); // Issue Write Conditional Search Register command
ds.write(0x8D); // TA1, target address = 8Dh
ds.write(0x00); // TA2, target address = 008Dh
ds.write(0x04); // Write byte to Control/Status Register, RSTZ as STRB
output

// Verify configuration setting
if (!ds.reset()) {
ESP_LOGW(TAG, "Reset DS2408 failed after non-success configure RSTZ as
STRB.");
node.errors++;
return;
}

ds.write(RESUME); // reselect last selected device.
ds.write(0xF0); // Issue Read PIO Registers command
ds.write(0x8D); // TA1, target address = 8Dh
ds.write(0x00); // TA2, target address = 008Dh
auto status = ds.read(); // Read Control/Status Register and verify
ESP_LOGD(TAG, "DS2408 verify configuration setting: %s.", String(status, HEX
));

// Set all relays off.
setState(ds, node, B);
} else {
ESP_LOGW(TAG, "Reset DS2408 failed for id: %s.", node.idStr.c_str());
}
}

/**
* Exit test-mode.
* "The DS2408 is sensitive to the power-on slew rate and can inadvertently
power up with a test mode
* feature enabled. When this occurs, the P0 port does not respond to the
Channel Access Write command."
* @return 0=failed, 1=success
*/
bool existTestMode(DS2480B , onewireNode ) {
// RST PD 96h <64-bit DS2408 ROM Code> 3Ch RST PD
if (ds.reset()) { // onewire initialization sequence, to be followed by
other commands
ds.write(0x96);
for (uint8_t i = 0; i < 8; i++) {
ds.write(node.id[i]);
}
ds.write(0x3C);

if (ds.reset()) {
return 1;
}
}

return 0;
}

int16_t setState(DS2480B , onewireNode , uint8_t state) {
if (node.id[0] != DS2408) {
ESP_LOGW(TAG, "Device is not a DS2408!");
return -1;
}

if (ds.reset()) { // onewire initialization sequence, to be followed by
other commands
ESP_LOGD(TAG, "Set DS2408 state to: %s.", String(state, BIN));
uint8_t retries = MAX_CONSECUTIVE_RETRIES;
//ds.select(node.id); // issues onewire "MATCH ROM" address which selects a
SPECIFIC (only one) 1-Wire device
ds.write(SKIP_ROM); // HACK, this select all devices on the bus, but we
should select only this single device. Though I get CRC-errors using above
line.

do {
ds.write(0x5A); // Issue