0
\$\begingroup\$

I'm moving my project from the Uno to the smaller ATTiny85, and I'm having some problems. It builds and uploads just fine, but I think I've messed up the serial communication somewhere along the way.

What I have is a cheap RF link and a Dallas 18B20 temperature sensor. When I moved to the ATTiny the compiler stated it could not find SoftwareSerial.h, so I'm using TinyDebugSerial.h instead.

I connected the RF transmitter on the pysical pin 2 (or digital 3 / analog 3) but nothing happens. Anyone have a clue?

The code: http://pastebin.com/m0W1SNuY

The wireless transmitter: http://www.dx.com/p/433mhz-wireless-transmitter-module-superregeneration-for-arduino-green-149254#.VJqsZl4AQ

The temperature sensor: http://www.dx.com/p/ds18b20-temperature-measurement-module-blue-215793#.VJqsq14AQ

\$\endgroup\$
4
  • \$\begingroup\$ Maybe provide some links to your hardware parts? What is supposed to happen? \$\endgroup\$ – Nazar Dec 23 '14 at 21:49
  • \$\begingroup\$ Check the timing maybe? I found timing seriously off when running Arduino at 8MHz but 1-Wire is very timing sensitive. \$\endgroup\$ – Maxthon Chan Dec 24 '14 at 10:43
  • \$\begingroup\$ @Naz added the links! :D \$\endgroup\$ – Jason94 Dec 24 '14 at 15:29
  • \$\begingroup\$ It is difficult to guess based on your information what is wrong. You are saying that nothing happens. How do you know? What did you do to check? Is it the software or hardware problem? The c-code that you posted is only the part of the code that is supposed to be uploaded into the uC. I would suggest first to get up and running the 85 simply by making the LED blink. Then, when you know that your 85 is properly configured you could try programming it with the program from UNO, note that config. registers are probably different between the two uCs, so you need to set the registers correctly. \$\endgroup\$ – Nazar Dec 24 '14 at 18:51
1
\$\begingroup\$

When you say "nothing happens" ... something's happening, just you don't know what it is. Hook your circuit up to a logic analyser or run it through an AVR simulator so you can find out what is happening.

Also regarding serial comms, you could look at (https://github.com/nickandrew/avr-fd-serial) which is a software serial interface I wrote specifically for the ATTiny85; it's timer-driven so your tiny can do other things while communicating bidirectionally at 9600 bits/second.

I also wrote (https://github.com/nickandrew/avr-onewire) which implements the 1-Wire protocol for the DS18B20 sensor ... put the two together and that's a lot of the code for your project.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.