Go Down

Topic: ATTiny84 and dallas one wire (Read 258 times) previous topic - next topic

ottsm

I have no problem getting the a Dallas one wire temperature sensor working on a Uno and I've done several projects without any major issues.

But I'm struggling with the ATTiny84.  I'm using 8Mhz and I've tried two different cores.  Also have tried several different versions of both the Onewire and the Temperature library.  I'm using the 84A-PU chip version (not the 20).
I've stripped the program down to the basics.  The same exact code (just with a serial print command and pin changes) works fine on the Uno.  On the ATTiny84 I have it blink an LED if the temperature goes above ambient (I warm the sensor with my hands), still doesn't work.  I also tried using the Morse code library to blink the LED.  I'm about ready to give up, it blinks the correct code for a missing sensor, so at least I know my program is running.  I'm using IDE 1.6.9.  I've done enough to know that it seeing the sensor.  Yes, I am on the correct pins, the two cores I tried using are different as far as the pin arrangements but I've tested all the outputs to make sure they work.

Anyone have any luck?   Could it by my boot loader?


BJHenry

It is unlikely to be the bootloader since the 84 doesn't support bootloading (at least using TinyCore- I assume that is what you're using).
What versions of the library are you using?

ottsm

By bootloader I really meant the Programming shield that I am using.

I've tried using several versions of the library, both old and the latest.  For "Onewire" it's 2.3.3, the one on the Teensy web site.  For "DallasTemperature" its 3.7.5 by Milesburton.  I've tried others as well, if I take the same code they all work fine on the Uno 328p.


DrAzzy

#3
Sep 18, 2017, 03:54 pm Last Edit: Sep 18, 2017, 04:17 pm by DrAzzy
Link to the onewire library and temperature library, and link to the core you're using. Preferably github links so we don't have to download anything to see the code.
ATtiny core for 841+1634+828 and x313/x4/x5/x61/x7/x8 series Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts (some assembled), mosfets and awesome prototyping board in my store http://tindie.com/stores/DrAzzy

ottsm

Onewire link;

https://www.pjrc.com/teensy/td_libs_OneWire.html
https://github.com/PaulStoffregen/OneWire

DallasTemperature link;
https://github.com/milesburton/Arduino-Temperature-Control-Library


I've also used the following links;
http://www.pjrc.com/teensy/arduino_libraries/OneWire.zip
http://download.milesburton.com/Arduino/MaximTemperature/DallasTemperature_LATEST.zip


ottsm

Example of code using.  I have two different cores, for the other core the LED_STATUS pin needs to be 7 and the OneWire_DATA_Pin needs to be 0.  This just counts up the number of devices.  


#include <morse.h>
#include <OneWire.h>
#include <DallasTemperature.h>

#define LED_STATUS 3
#define OneWire_Data_Pin 10

const float wpms = 20.0;

//Setup Morse Code LED
LEDMorseSender Sender(LED_STATUS, wpms);

//Configure One Wire Bus
OneWire OneWire_Bus(OneWire_Data_Pin);
DallasTemperature OneWire_Sensors(&OneWire_Bus);

void setup()
{
   Sender.setup();
   delay(1000);
}

void loop()
{
 OneWire_Sensors.begin();
 uint8_t numberOfDevices = OneWire_Sensors.getDeviceCount();
 Sender.setMessage(String(numberOfDevices, DEC));
 Sender.sendBlocking();
 delay(500);
}

ottsm

Cores that I am using are;

https://github.com/Coding-Badly/TinyCore1

https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json

ottsm

Well I finally figured out my problem.  One of the moments where you just feel stupid.  I forgot that the chips I am using had been set it to 1Mhz during some other test I was doing and I forgot to re-burn the bootloader to set the fuses to 8Mhz.  I knew I had read that 1Mhz wouldn't work and that I needed to set the speed to 8Mhz, I had selected the 84 8Mhz setting but you have to reburn if it was set at 1Mhz previously.  Getting old I guess.
   

Coding Badly


BJHenry

Good to know you got it working :)

Go Up