Home › Forums › Environmental Sensors › Multiple OneWire Sensors Multiple Pins
- This topic has 0 replies, 1 voice, and was last updated 2022-06-12 at 12:30 PM by KBR Kings River.
-
AuthorPosts
-
-
2022-06-12 at 12:30 PM #17096
I would like to monitor temperature, of water, ground and air. I was thinking of building one wired sensor to the water, then another wired sensor to ground and air. Thus I would need two OneWire Bus Pins, .and the one OneWire Bus pin would have two sensors attached.
Using a few Arduino Example sketches I can get this to work and read, multiple sensors on multiple buses, using unique addresses.
However in the ModularSensors a_la_cart example it just has 1 sensor on 1 bus. I have tried adding an changing some of the const but but cant get to compile.
How do I change the code to have multiple sensors… and
How do I change the code to have multiple OneWire Buses
Thanks Ron
12345678910111213141516171819202122// ==========================================================================// Maxim DS18 One Wire Temperature Sensor// ==========================================================================#include <sensors/MaximDS18.h>// OneWire Address [array of 8 hex characters]// If only using a single sensor on the OneWire bus, you may omit the addressDeviceAddress OneWireAddress1 = {0x28, 0xA9, 0xDB, 0x49, 0xF6, 0x16, 0x3C, 0x8E};// DeviceAddress OneWireAddress2 = {0x28, 0xB3, 0x54, 0x49, 0xF6, 0x47, 0x3C, 0x0D};const int8_t OneWirePower = sensorPowerPin; // Pin to switch power on and off (-1 if unconnected)const int8_t OneWireBus = 5; // Pin attached to the OneWire Bus (-1 if unconnected) (D24 = A0)const int8_t ds18NumberReadings = 3;// Create a Maxim DS18 sensor objects (use this form for a known address)MaximDS18 ds18(OneWireAddress1, OneWirePower, OneWireBus);// Create a Maxim DS18 sensor object (use this form for a single sensor on bus with an unknown address)//MaximDS18 ds18(OneWireAddress1, OneWirePower1, OneWireBus1, ds18NumberReadings1);new MaximDS18_Temp(&ds18, "bus5"),
-
-
AuthorPosts
- You must be logged in to reply to this topic.