Comments (9)
so you say you still have your gps-master and it works with sensor A and sensor B separate, but when both are on the bus this experiment fails? Both have individual bus-addresses? seems that your master does not support "search rom" command and just uses "skip rom". so it does not have to discover the divices. Just adresssing "that" one device on the bus.
from onewirehub.
No, when I attach ds18b20 and ds18s20 at the same time my master was able to read the reading. But when I try to attach 2 ds18b20 instead of 1 ds18b20 and 1 ds18s20, my master couldtn't read anything.
from onewirehub.
very odd, indeed. This example with 2x ds18b20 and 1x 18s20 does not have any problems. Do you use the newest library 2.1.1 and have every debug-code disabled in config?
/*
* Example-Code that emulates a DS18B20
*
* Tested with:
* - https://github.com/PaulStoffregen/OneWire --> DS18x20-Example, atmega328@16MHz as Slave
* - DS9490R-Master, atmega328@16MHz and teensy3.2@96MHz as Slave
*/
#include "OneWireHub.h"
#include "DS18B20.h" // Digital Thermometer, 12bit
constexpr uint8_t pin_led { 13 };
constexpr uint8_t pin_onewire { 8 };
auto hub = OneWireHub(pin_onewire);
auto ds18b20 = DS18B20(DS18B20::family_code, 0x00, 0x00, 0xB2, 0x18, 0xDA, 0x00); // DS18B20: 9-12bit, -55 - +85 degC
auto ds18s20 = DS18B20(0x10, 0x00, 0x00, 0xA2, 0x18, 0xDA, 0x00); // DS18S20: 9 bit, -55 - +85 degC
auto ds1822 = DS18B20(DS18B20::family_code, 0x00, 0x00, 0x22, 0x18, 0xDA, 0x00); // DS1822: 9-12bit, -55 - +125 degC
bool blinking(void);
void setup()
{
Serial.begin(115200);
Serial.println("OneWire-Hub DS18B20 Temperature-Sensor");
Serial.flush();
pinMode(pin_led, OUTPUT);
// Setup OneWire
hub.attach(ds18b20);
hub.attach(ds18s20);
hub.attach(ds1822);
// Test-Cases: the following code is just to show basic functions, can be removed any time
Serial.print("Test - set Temperatures to -56 degC (out of range): ");
ds18b20.setTemperature(int8_t(-56));
Serial.println(ds18b20.getTemperature());
Serial.print("Test - set Temperatures to -55 degC: ");
ds18b20.setTemperature(int8_t(-55));
ds18s20.setTemperature(int8_t(-55));
Serial.print(ds18b20.getTemperature());
Serial.print(", ");
Serial.println(ds18s20.getTemperature()); // ds18s20 is limited to signed 9bit, so it could behave different
Serial.print("Test - set Temperatures to 0 degC: ");
ds18b20.setTemperature(int8_t(0));
ds18s20.setTemperature(int8_t(0));
Serial.print(ds18b20.getTemperature());
Serial.print(", ");
Serial.println(ds18s20.getTemperature());
Serial.print("Test - set Temperatures to 21 degC: ");
const int8_t temperature = 21;
ds18b20.setTemperature(temperature);
ds18s20.setTemperature(temperature);
ds1822.setTemperature(temperature);
Serial.print(ds18b20.getTemperature());
Serial.print(", ");
Serial.println(ds18s20.getTemperature());
Serial.print("Test - set Temperatures to 85 degC: ");
ds18b20.setTemperature(int8_t(85));
ds18s20.setTemperature(int8_t(85));
Serial.print(ds18b20.getTemperature());
Serial.print(", ");
Serial.println(ds18s20.getTemperature());
Serial.print("Test - set Temperatures to 126 degC (out of range): ");
ds1822.setTemperature(int8_t(126));
Serial.println(ds1822.getTemperature());
Serial.println("config done");
}
void loop()
{
// following function must be called periodically
hub.poll();
// this part is just for debugging (USE_SERIAL_DEBUG in OneWire.h must be enabled for output)
if (hub.hasError()) hub.printError();
// Blink triggers the state-change
if (blinking())
{
// Set temp
static float temperature = 20.0;
temperature += 0.1;
if (temperature > 30.0) temperature = 20.0;
ds18b20.setTemperature(temperature);
ds18s20.setTemperature(temperature);
ds1822.setTemperature(temperature);
Serial.println(temperature);
}
}
bool blinking(void)
{
constexpr uint32_t interval = 1000; // interval at which to blink (milliseconds)
static uint32_t nextMillis = millis(); // will store next time LED will updated
if (millis() > nextMillis)
{
nextMillis += interval; // save the next time you blinked the LED
static uint8_t ledState = LOW; // ledState used to set the LED
if (ledState == LOW) ledState = HIGH;
else ledState = LOW;
digitalWrite(pin_led, ledState);
return 1;
}
return 0;
}
from onewirehub.
This is the response of my master. My server can show reading of ds18b20 and ds18s20 but there is always a difference of 0.7 between ds18b20 and ds18s20.
I think this is the newest library because I just downloaded it yesterday
from onewirehub.
Can't confirm your results. I extended the ds18b20-example to use ds18b20, ds18s20 and ds1822, twice each. setTemperature() was fed with 10 and 30 °C for these twins in int8 and float. and my ds9490-master showed the right temperatures every time. the master and the software-tool are both from maxim/dallas, so they should know their stuff. And i double-checked my emulation code twice. it is easy to get the datasheet wrong, because they do some silly stuff there.
i'm afraid as long as you can't provide a log from a logic-analyzer you are on your own.
auto ds18b20 = DS18B20(DS18B20::family_code, 0x00, 0x00, 0xB2, 0x18, 0xDA, 0x00);
auto ds18b21 = DS18B20(DS18B20::family_code, 0x00, 0x01, 0xB2, 0x18, 0xDA, 0x00);
auto ds18s20 = DS18B20(0x10, 0x00, 0x00, 0xA2, 0x18, 0xDA, 0x00);
auto ds18s21 = DS18B20(0x10, 0x00, 0x01, 0xA2, 0x18, 0xDA, 0x00);
auto ds1822A = DS18B20(0x22, 0x00, 0x0A, 0x22, 0x18, 0xDA, 0x00);
auto ds1822B = DS18B20(0x22, 0x00, 0x0B, 0x22, 0x18, 0xDA, 0x00);
bool blinking(void);
void setup()
{
hub.attach(ds18b20);
hub.attach(ds18b21);
hub.attach(ds18s20);
hub.attach(ds18s21);
hub.attach(ds1822A);
hub.attach(ds1822B);
constexpr float tempA = 10;
constexpr float tempB = 30;
ds18b20.setTemperature(tempA);
ds18b21.setTemperature(tempB);
ds18s20.setTemperature(tempA);
ds18s21.setTemperature(tempB);
ds1822A.setTemperature(tempA);
ds1822B.setTemperature(tempB);
}
from onewirehub.
Hi guys,
When i'm connecting the emulator to a teltonika device its show an error of300 on the server side,
can anyone help me with this isuue.
Thanks,
ShanmukhaGanesh
from onewirehub.
@ShanmukhaGanesh - not with this little information. Please work at least through the start page of the project. Especially section "HELP"
from onewirehub.
@orgua - While I'm connecting the ds18b20 to a teltonika device(GPS TRACKER) directly it is able to transmit the data to my server.
Now I'm trying to use an arduino and emulate ds18b20 and connect it to my GPS tracker(teltonika) but it is not able to transmit the temperature reading to my server.
As I'm trying to make this wireless I'm using a wireless transmitter and a receiver the data from the transmitter is being transmitted on the receiver which is visible on the serial monitor in Arduino IDE but it is not able to send the data to teltonika which has a 1-wire port to accept the data from ds18b20.
Kindly, help me with this issue.
from onewirehub.
sorry, a basic set of embedded skills on your side is needed to solve this problem. if you have serious effort, you would have a logic analyzer at hand. your problem sounds like a timing-issue. impossible to solve without a timing-analysis.
and i think it would be easier to send the wireless received data directly via usb/serial to your server. onewire not needed
from onewirehub.
Related Issues (20)
- OneWireHub on ESP32 PROBLEM HOT 4
- ZONT controller HOT 4
- Possible 24B33 support ?
- error:first bit of byte timeout HOT 1
- Issue on ESP32. Missing bit because interrupts executed
- Why DS2506_EEPROM.ino can't emulate more than 574 bytes of data? HOT 1
- Build issues on PlatformIO (for Arduino Uno)
- Stability / timing issue HOT 1
- Non-Volatile Memory / Save Page Data to EPROM
- Would it be possible to adapt this project with ATtiny85 for 1-wire + I2C? HOT 1
- ESPHome , Home Assistant HOT 1
- Need solution for ESPHome HOT 1
- Support for Raspberry RP2040 HOT 3
- Supported and tested Hardware: Attiny84 - Global variables use 574 bytes (112%) of dynamic memory HOT 17
- samd51 m4
- Instability when connected with several real slaves HOT 2
- Support for ATtiny816 / 1-series ATtiny HOT 1
- Not Run Correctly on STACK-M5 ATOM-U (ESP32) HOT 4
- DS2431 wrong answer (0x55) at Copy Scratchpad Command
- DS2430 is not included in keywords.txt.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from onewirehub.