Go Down

Topic: 1-Wire Slave (Read 33 times) previous topic - next topic

ringram2077

Thanks for the reply. Still getting compile errors.  I got the latest GitHub files.  Here is result:

Code: [Select]
[/Arduino: 1.0.5-r2 (Windows 7), Board: "Teensy 3.1"
C:\arduino-1.0.5-r2\hardware\tools\arm-none-eabi\bin\arm-none-eabi-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mcpu=cortex-m4 -DF_CPU=96000000 -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -mthumb -nostdlib -D__MK20DX256__ -DTEENSYDUINO=118 -fno-rtti -felide-constructors -std=gnu++0x -DUSB_SERIAL -DLAYOUT_US_ENGLISH -IC:\arduino-1.0.5-r2\hardware\teensy\cores\teensy3 -IC:\Arduino\libraries\OneWireSlave C:\Users\Richard\AppData\Local\Temp\build8964515928240465406.tmp\DS18B20_Slave_Interrupt_universal_analogread_fulllib.cpp -o C:\Users\Richard\AppData\Local\Temp\build8964515928240465406.tmp\DS18B20_Slave_Interrupt_universal_analogread_fulllib.cpp.o

In file included from DS18B20_Slave_Interrupt_universal_analogread_fulllib.ino:3:0:
C:\Arduino\libraries\OneWireSlave/OneWireSlave.h:212:2: error: #error "Please define I/O register types here"
C:\Arduino\libraries\OneWireSlave/OneWireSlave.h:231:0: warning: "EXTERNAL" redefined [enabled by default]
In file included from C:\arduino-1.0.5-r2\hardware\teensy\cores\teensy3/wiring.h:33:0,
                 from C:\arduino-1.0.5-r2\hardware\teensy\cores\teensy3/WProgram.h:15,
                 from C:\arduino-1.0.5-r2\hardware\teensy\cores\teensy3/Arduino.h:1,
                 from C:\Arduino\libraries\OneWireSlave/OneWireSlave.h:7,
                 from DS18B20_Slave_Interrupt_universal_analogread_fulllib.ino:3:
C:\arduino-1.0.5-r2\hardware\teensy\cores\teensy3/core_pins.h:711:0: note: this is the location of the previous definition
In file included from DS18B20_Slave_Interrupt_universal_analogread_fulllib.ino:3:0:
C:\Arduino\libraries\OneWireSlave/OneWireSlave.h:260:4: error: 'IO_REG_TYPE' does not name a type
C:\Arduino\libraries\OneWireSlave/OneWireSlave.h:261:14: error: 'IO_REG_TYPE' does not name a type
DS18B20_Slave_Interrupt_universal_analogread_fulllib.ino: In function 'void blinking()':
DS18B20_Slave_Interrupt_universal_analogread_fulllib.ino:56:39: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
In file included from DS18B20_Slave_Interrupt_universal_analogread_fulllib.ino:3:0:
C:\Arduino\libraries\OneWireSlave/OneWireSlave.h: At global scope:
C:\Arduino\libraries\OneWireSlave/OneWireSlave.h:306:22: warning: 'static_OWS_instance' defined but not used [-Wunused-variable]code]

Markus_L811

Strange, I used the files directly from git and tested it, compiled without errors can, test if it compile for other boards from the list? What verion of teensyduino did you use?

ringram2077

#77
Mar 31, 2014, 01:44 pm Last Edit: Mar 31, 2014, 02:08 pm by ringram2077 Reason: 1
For the Mega 2560 I get this:
I don't see where to find version of Teensyduino but I just got it yesterday.  It does support Teensy 3.1 and will load the blink sketch.  May be I am not going about this the correct way. I got the latest onewireslave files from get hub and the ino sketch. Then simply load your ino sketch to Arduino GUI  hit Verify.  That's it.

Code: [Select]
[/Arduino: 1.0.5-r2 (Windows 7), Board: "Arduino Mega 2560 or Mega ADK"
C:\arduino-1.0.5-r2\hardware\tools\avr\bin\avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega2560 -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -IC:\arduino-1.0.5-r2\hardware\arduino\cores\arduino -IC:\arduino-1.0.5-r2\hardware\arduino\variants\mega -IC:\Arduino\libraries\OneWireSlave C:\Users\Richard\AppData\Local\Temp\build5803949998534887674.tmp\DS18B20_Slave_Interrupt_universal_analogread_fulllib.cpp -o C:\Users\Richard\AppData\Local\Temp\build5803949998534887674.tmp\DS18B20_Slave_Interrupt_universal_analogread_fulllib.cpp.o

In file included from DS18B20_Slave_Interrupt_universal_analogread_fulllib.ino:3:
C:\Arduino\libraries\OneWireSlave/OneWireSlave.h:35:4: error: #error "Not an Interrupt Pin"
C:\Arduino\libraries\OneWireSlave/OneWireSlave.h:36:4: error: #error "Use 2, 3, 18, 19, 20 or 21"
C:\Arduino\libraries\OneWireSlave/OneWireSlave.h:231:1: warning: "EXTERNAL" redefined
In file included from C:\Arduino\libraries\OneWireSlave/OneWireSlave.h:7,
                from DS18B20_Slave_Interrupt_universal_analogread_fulllib.ino:3:
C:\arduino-1.0.5-r2\hardware\arduino\cores\arduino/Arduino.h:56:1: warning: this is the location of the previous definition
DS18B20_Slave_Interrupt_universal_analogread_fulllib.ino: In function 'void blinking()':
DS18B20_Slave_Interrupt_universal_analogread_fulllib.ino:56: warning: comparison between signed and unsigned integer expressions
C:\Arduino\libraries\OneWireSlave/OneWireSlave.h: At global scope:
C:\Arduino\libraries\OneWireSlave/OneWireSlave.h:306: warning: 'static_OWS_instance' defined but not usedcode]

ringram2077

#78
Apr 01, 2014, 02:31 am Last Edit: Apr 01, 2014, 04:00 pm by ringram2077 Reason: 1
UPDATE:
Current GitHub files compile correctly for Teensy 3.1. Must have been picking up old version of onewireslave.h.  I put the current onewireslave.h file in sketch folder and referenced it there and successfully compiled.  Thanks for making changes for 3.1.
Richard

Markus_L811

#79
Apr 11, 2014, 06:11 pm Last Edit: Apr 11, 2014, 06:31 pm by Markus_L811 Reason: 1

UPDATE:
Current GitHub files compile correctly for Teensy 3.1. Must have been picking up old version of onewireslave.h.  I put the current onewireslave.h file in sketch folder and referenced it there and successfully compiled.  Thanks for making changes for 3.1.
Richard

No Thanks needed at all, have fun with it.

Looks like the Slave works more proper with the Teensy 3 and above may its an idea to port the timer and interrupt driven version to the Arduino to get better work with the Megas.

Punkt3

Hi Markus,

i tried the OneWireSlave-Library to work on an Arduino Pro Mini.
If i compiled the example DS18B20_Slave_Interrupt_universal_analogread_fulllib.ino and i get the following errors:

In file included from DS18B20_Slave_Interrupt_universal_analogread_fulllib.ino:3:
Eigene Dateien\Arduino\libraries\OneWireSlavemaster/OneWireSlave.h:140:4: error: #error "Not an Interrupt Pin"
Eigene Dateien\Arduino\libraries\OneWireSlavemaster/OneWireSlave.h:141:4: error: #error "Use 0, 1, 2, 3, 4 or 5"

Is there a way to get this Library working with my Arduino Pro Mini?


regards

Michael

Punkt3

ok - think i got it.

In the DS18B20_Slave_Interrupt_universal_analogread_fulllib.ino i changed the dsslavepin to 1 - that worked.
The Sketch compiled.

Now i will try to test it out.

Is there anywhere a wiring scheme to connect to the 1wire-Bus?
Or will the following work:

Bus  <->  Arduino
5V    <->  5V
GND <->  GND
Data  <->  Pin1 (the pin assigned to dsslavepin)

Is this correct?


regards

Michael

Punkt3

soo...update:

i wired my nano like Markus as shown in Post #36.
But my nano istn listet on my 1wire-Bus.

I set Pin2 as dsslavepin - but it seems that this doesnt work.

Markus: you got your Nano running as 1wire slave - what can i do to get mine working?  :smiley-red:
Can you give me e litte hint?

ilevans

You will need a 4.7K ohm resister between +5v and the data line for the arduino to act as a master.

Punkt3

I don't want the Arduino to act as a master.
The Arduino should act as an 1wire slave.

For testings i have an Raspberry with an 1wire bus master to which i would connect the Arduino (as slave).
The bus master works fine - tested with an normal DS18B20.

On this bus i connected the Arduino with the 1wire slave sketch - but the Arduino is not listed on the 1wire bus...

ilevans

Quote
For testings i have an Raspberry with an 1wire bus master to which i would connect the Arduino (as slave).
The bus master works fine - tested with an normal DS18B20.


Quote
Bus  <->  Arduino
5V    <->  5V
GND <->  GND
Data  <->  Pin1 (the pin assigned to dsslavepin)


If you are not using the Raspberry  +5v to power the Arduino it should not be connected to the Arduino +5v. You only need to connect GND and Data.

Punkt3

thanks for the hint.

so far i connected only the data pin (connected to digital2) and ground pin to the Arduino.
At the moment the Arduino is powered via the usb connector.

however if i tested the simple code for simulating the DS1990A - the Arduino (simulated DS1990A) is not listed in the bus list. =(
somehow i have no idea what i can do to get this setup work - but i know that it must work.
Markus got this running on an Arduino nano if i am not wrong...  :smiley-roll:

ilevans

#87
Jun 07, 2014, 11:55 pm Last Edit: Jun 08, 2014, 08:39 am by ilevans Reason: 1
I have finally got ATTiny85's working as 1-wire slaves but not using Markus' library, I used a modified version of the one wire library from Alexander Gordeev . I finally succeeded once I discovered I could run the ATTiny85 at 16Mhz, that was the big breakthrough.  

I now have ATTiny85s as slaves for a rain gauge and another for a humidity sensor. I am using the  PinChange Interrupt Library so that the slaves only process one-wire commands once a One Wire Reset is detected. An LED flashes to provide visual feedback when the slave sends sensor data. Like the DS18B20 I use 0x44 as a request to calculate the sensor data and 0xBE to return the results.

I am running an Arduino as the weather station and One wire Master with Serial Communication to a computer. I had problems once I started adding multiple ATTiny85s but a 100nF decoupling ceramic capacitor across the +5v and GND lines has fixed them. My currently setup includes . . .

  • 1 x 4x20 LCD

  • 1 x MPL115A1 SPI Barometer

  • 1 x DS1904 One Wire Real Time Clock

  • 4 x DS18B20 One Wire Temperature Sensors

  • 1 x ATTiny85 One Wire Rain Gauge Sensor

  • 2 x ATTiny85 One Wire Humidity Sensors


I have attached the modified library along with the slave code for the rain Gauge and Humidity Sensors. The Weather Station Sketch is a work in progress that I am willing to make available should anyone be interested.

Markus_L811


thanks for the hint.

so far i connected only the data pin (connected to digital2) and ground pin to the Arduino.
At the moment the Arduino is powered via the usb connector.

however if i tested the simple code for simulating the DS1990A - the Arduino (simulated DS1990A) is not listed in the bus list. =(
somehow i have no idea what i can do to get this setup work - but i know that it must work.
Markus got this running on an Arduino nano if i am not wrong...  :smiley-roll:

Looks like I have some work to do!

Markus_L811

#89
Jun 11, 2014, 02:56 pm Last Edit: Jun 19, 2014, 10:19 pm by Markus_L811 Reason: 1

soo...update:

i wired my nano like Markus as shown in Post #36.
But my nano istn listet on my 1wire-Bus.

I set Pin2 as dsslavepin - but it seems that this doesnt work.

Markus: you got your Nano running as 1wire slave - what can i do to get mine working?  :smiley-red:
Can you give me e litte hint?


Damn it really don't work on the Arduino Nano...

ATM. I will give the external ceramic resonator from the Nano the guiltiness, the ceramic resonator isn't as accurate as the crystal resonator who is used on the Leonardo or Uno. Following this
http://jorisvr.nl/arduino_frequency.html


But this means the ATtiny85 with the internal RC would be more accurate than the ceramic resonator

So far so good, my Trinket response as 1-wire device with some drops on the line but works. For the next step an self calibration for the Nano and Trinket would be nice to solve the timing problems. I will try to include overdrive support

Did someone run 2 Nano's against another?

Go Up