[IDEA] Monitor Tap List at Bar

@peekay123 I get a “1-wire device present: 0” … I’m obviously doing something wrong!

Here’s my RS2431 Fritzing sketch to see if I have it setup wrong! The sketch shows the UNO R3, but I looked and have the UNO R2, do you think that would make any difference? (I wouldn’t think so.)

Also, the sketch shoes a PNP transistor… but that’s only because there wasn’t a RS2431 readily available. But, it’s the same shape, so hopefully it makes sense.

@austinpe, the differences between the R2 and R3 should not have any affect on this test. The diagram looks fine. So it could be the code or the device. I’m at a bit of a loss. You could get a Bus Pirate to do the testing. Without having one of these, I’m stuck :frowning:

If you have a DS18B20 temperature sensor, you could test the 1-wire library with that to at least make sure the UNO stuff works. A simple DS18B20 demo is located here.

@peekay123 – I don’t have a bus pirate or a DS18B20 sensor :cry:

Do you think it’d be worth trying it on the spark?

I guess I can order a DS18B20 as well as the MUX breakout board that @dougal was talking about.

Bummer.

So, I got desperate and tried EVERY combination of pins to ground/IO and … it worked!
The documentation shows:

I thought that the “side view” was really a top down view, but it’s really a bottom-up view (as if the pins are pointing towards you) :blush:

I feel pretty dumb :frowning:

so @peekay123 , now that I got it to work on arduino… wanna practice some of your magic on a port when you get some time (I’ll try my own port, too, just so I don’t put you out) :smiley: :stuck_out_tongue:

@austinpe, don’t feel dumb, I did the same thing!!! Showing “side view” is the dumbest thing I have ever seen. Problem is, I have seen this type of view so many times, I KNOW it’s bottom view. But NOooo, today I fell for it! LOL :stuck_out_tongue:

Ok, so now that it’s working, I will look at the rest of the library :smile:

UPDATE: Before I proceed, the easiest way to identify each unique DS2431 is by its serial number. No need to write anything to the eeprom! Is this the way you want to proceed?

1 Like

@peekay123 yes, I th ink that is the best way to go about it as well.

We are not dealing with a very large distance (4-5 feet max wire length… if even).

The idea I was having would be do just do a database of the serial numbers for each EEPROM. Then I could just easily update it in the database instead of having to write the data to the device.

So, this is the only code that would be used.
I just uploaded this sketch to my arduino and tested it, and it comes back with JUST the address of the EEPROM.

#include <OneWire.h>

OneWire  ds(2);    // 1-wire on pin 2
byte     addr[8];  // Contains the eeprom unique ID
void setup(void)
{
  Serial.begin(9600);
}
  
void loop(void) 
{
  byte i;
  byte dat[13];

  SearchAddress(addr);
  
  while(1);
}

void SearchAddress(byte* address) //Search for address and confirm it
{
  int i;
  if ( !ds.search(address))
  {
    Serial.print("No device found.\n");
    ds.reset_search();
    delay(250);
    return;
  }
  
  Serial.print("ADDR= ");
  for( i = 0; i < 8; i++)
  {
    Serial.print(address[i], HEX);
    Serial.print(" ");
  }

  if ( OneWire::crc8( address, 7) != address[7])
  {
      Serial.print("CRC is not valid, address is corrupted\n");
      return;
  }
  
  if ( address[0] != 0x2D) 
  {
      Serial.print("Device is not a 1-wire Eeprom.\n");
      return;
  }
  Serial.println();
}

edit
It’s interesting that if I have multiple DS2431 chained together, it will only read ONE of them.
If I then add another call of “SearchAddress(addr)”, then it’ll show two devices, etc.
But, it shows the “last” DS2431 (the one connected furthered right) in the chain FIRST.

I’ll have to edit the code to search for however many devices there are.

1 Like

@austinpe, @peekay123: There’s definitely something unintuitive about that diagram. I looked at it, compared the two views, and thought to myself, “Wait, that’s backwards, isn’t it?” I had to look at it for a minute before I figured out what the orientation was.

1 Like

@austinpe, as per the Arduino 1-wire library comments:

// Perform a search. If this function returns a '1' then it has
// enumerated the next device and you may retrieve the ROM from the
// OneWire::address variable. If there are no devices, no further
// devices, or something horrible happens in the middle of the
// enumeration then a 0 is returned. If a new device is found then
// its address is copied to newAddr. Use OneWire::reset_search() to
// start over.

The idea is that you keep calling search until it returns '0' indicating no more devices have been found. The order of the devices found is entirely dependent on their device addresses so the physical order is irrelevant. :smile:

2 Likes

If you do decide to try two of those MUX breakouts, it should be pretty easy to address your inputs. You’ll have one analog :spark: pin for reading a value from the slats. Five digital pins for addressing. Four of those would go to the S0-S3 pins on both breakouts. The fifth would go directly to /E on one breakout, and through an inverter to /E on the other breakout.

The lines to /E would enable one breakout or the other, which is how you’d share the S0-S3 address lines between them.

And I guess you’d have another resistor in place to make a voltage divider into the common I/O on the breakouts.

Sounds good in theory, anyways! :wink:

so I am going to be the guy with the noobie question.
Did you guys get the DS2431 as a onewire-slave to run with a spark core?

I am designing a home-brewery that is spark/photon controlled and has business logic and “power lifting” in separated locations: small terminal with spark/photon and nice display in the front and then via 1-wire connected to an enclosure that will trigger SSRs for 30 Amp and 50 Amp circuits.
So besides onewire and DS2431 I am also looking at PWM via onewire.

@BayerischBier, how far do you anticipate the DS2431 to be from the Core/Photon? Also, what type of load will you be switching with the SSRs? A 50A load sounds huge and may be better switched with a relay.

@peekay123, it should be less than 10ft between controller unit and “switch-box”. “traditional” electric brewing rigs have a large enclosure containing all switches, SSRs, breakers etc. To keep the 220V 30Amp and 50Amp wiring short, I want to put the breakers and SSRs into an enclosure on the back of the brewstand (think: large workbench that makes hoppy drinks). In terms of SSR, here is an example for a 40A http://www.auberins.com/index.php?main_page=product_info&cPath=2_30&products_id=30 - with voltage and amperage like this you rather switch without mechanical parts (i.e., relay) when PWM in mind. To many on-off cycles on the mechanical contacts.

I think the SSR side is covered but the questions remains whether the spark/photon will do onewire with the DS2431 and then PWM via onewire.
Does this help?

@BayerischBier, what are you controlling via SSR that requires 30/50Amps?

What frequency do you expect to use for the PWM? One possible solution is to use an ATtiny85 at the “hot” end which can do 8-bit PWM and support one-wire back to the Core.

@peekay123, I am looking at (up to) two water heat elements of 5,500 W pulling each around 25A when on full load (roughly calculated).
Frequency is around 1hz.

To give you an impression about the physical setup in mind, here are two pics (from a homebrewforum):
[View into a kettle for hot water and other purposes (coil is for heating the mash) but the heat element (black twisty thing)to ‘power’ this is nicely shown.]

[general setup of an electric brewstand] And I want to reduce the ‘footprint’ of the front box and turn it into panel.

Ok, so those are resistive heating elements. Are they presently controlled via PWM? 1KHz with variable duty cycle sounds high given the thermal mass of these things.

@peekay123, one hertz :wink: 1 hz :wink: [1 KHz might turn this into a flying saucer]
you can use PWM to “dial” in temperature - based on the amount/timing of on-offs you will regulate if you stay at i.e. 180F or boil with 212F.

1 Like

@peekay123, I’ve had too much caffeine, explaining the 1KHz!! :stuck_out_tongue_winking_eye:

You may need to experiment with the PWM frequency to get the best results. Using one-wire with an ATtiny85 will give you a lot of flexibility. You could set the PWM frequency via one-wire and it could even have one or two local sensors to feed back to the Core. The (over)killer way to do this would be to use Bluz bluetooth nodes (up to 8) and a Core gateway to go totally wireless!

BTW, have you experimented with PWM control of your heating elements yet?

@peekay123, interesting thought with the ATtiny85. I am not familiar with that chip.
Something like this? https://youtu.be/3K74PAxL5Xk

So instead of searching for the onewire device, addressing and controlling on/off via Core based logic you suggest that the Attiny85 has its own PWM ‘program’ running and I send via onewire/i2c the value needed via a simply function call?

Let me do some pseudo code for a Core, ATtiny85 setup with a heat-element and temperature sensor.
Spark Core:
Receive new temperature target i.e 180F from touchUI or other input logic.
Send TempTarget = 180 to Attiny85.
Read back current temp received from Attiny85
Do other stuff until Attiny85 send “done” signal.

ATtiny85
Read current temp on DS18b20 or similar.
Read/receive TempTarget = 180
Do PID algorithim and heat functions (PWM), switch on/off the SSR as needed.
Read current temp on DS18b20 or similar.
Send current temp into the “bus” to Core.

So this actually abstracts out the logic and physical design of onewire/pwm/ssr-control…into a more object oriented approach. I am thinking that this could be even like a class style setup. [gotta dust of my coding though]

The ATtiny85 is this:

Enough flash, RAM and EEPROM to do what you need IMO. Not sure about PID running on it but possible. Your core could do this since the PID cycle time will be slow. Remember, one-wire devices are polled so the Core polls each device in rotation. So yes, absolutely object oriented with each ATtiny node self identifying (pre-programmed or via other method). :smile: