Go Down

Topic: Attiny 84 and 433 Mhz receiver problems (Read 582 times) previous topic - next topic

kingbf

Hi Folks!
First, let me say that this topic has been discussed intensely and I have researched on google and the various forums as much as I could garner. I have attempted to try all the "fixes" I could find but to no avail. So, here is where I am and what I am trying to accomplish. I want to use an Attiny 84 to receive transmissions from an FS1000A 433 MHz transmitter to an XY-MK-5V receiver using the VirtualWire library. The message I am sending is either "main" or "bran". I am having no problems with the transmitter, only the receiver. I realize the Attiny does not support serial so I have eliminated any usage of commands that use serial. The program I am using works fine on an Uno, including serial print commands which the Uno does support and allows me to see that the correct message is being received. For hardware testing purposes I have connected a bi-color LED to two pins on the Attiny. This way I can tell if I am receiving "different" messages. I also attached an LED to the receive data pin on the Attiny to see if there is any incoming data. This LED will increase in intensity when a message is sent and then dim back down. Upon initialization of the program, the bi-color LED lights up. However, the bi-color LED doesn't change color regardless of which message is sent. I thought the LED attached to the data pin might be causing problems so I disconnected it and obtained the same results. I also chose differetnt p[ins so as to avoid conflicts with any pins that used the timers. Still no good. I believe there must be a method to do what I am attempting, just that I am missing something. Can someone please help. Thanks.
         Brian

DrAzzy

What core, and what version of the library (link to where it came from)
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

kingbf

core:     Attiny by David A. Mellis version 1.0.2

library:     $Id: VirtualWire.h,v 1.6 2013/02/14 22:02:11 mikem Exp mikem $

DrAzzy

#3
Sep 18, 2017, 11:19 pm Last Edit: Sep 18, 2017, 11:20 pm by DrAzzy
Do you get the same behavior with my core?

I cannot determine what the correct version of VirtualWire is, nor where to get it from a quick google search. There are copies of it in a bunch of repos on github, and it's not clear which is the official one...
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

BJHenry

Also I'm not sure what your pin allocation is, but DrAzzy's TinyCore has software serial that works beautifully for debugging messages.

kingbf

No luck so far. The general concensus is the core is causing problems. I'll keep plugging away and see if I can find a solution. Thanks.

DrAzzy

I am not convinced the core is the problem!

It may be; if it fails with my core and someone can point to the problem, I'll try to get it sorted out.

Does that exact sketch (with corrections for pin numbers) really work on the Uno? I'm just looking at how you're doing the tests with the Strings, and it makes me uneasy. I don't know if you can do that (I do *not* use String, ever)
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

kingbf

DrAzzy,
     I put together an Uno and programmed the exact pins I have described in the sketch. Since the program receives correctly with the Uno and the Uno supports the serial commands, I opened the monitor to see what was being received. The monitor indicates that the received information from the string is correct. Additionally, I added your library to the IDE which, unfortunately, made no difference. Where I get so confused is that the transmitter works perfectly with an Attiny85. I have a small transmitter I constructed powered by batteries and it transmits the correct message and the Arduino receiver receives the message perfectly. This means, to me anyway, that there is something either different or missing in the Attiny. As usual, it will probably be something simple that I am overlooking. At least, I hope so. Are there any major differences between the 84 and the 85 that would cause problems? Should I attempt to use an 85 instead of an 84 to see if that makes any difference? The problem with that is that I need the extra pins of the 84. Any advice is greatly appreciated. Thanks.
                Brian

DrAzzy

Hmm. Interesting. I *think* I found the same version of the library you're using (is it this one? https://github.com/JeffCost/VirtualWire/ ). It's got special handling for the '85 (as it must, since in other Arduinos it uses the 16-bit timer, Timer1). There's no special handling for tiny84, but that's okay, because, like almost every device in Atmel's AVR line, the tiny84 has that 16-bit timer1.

Did you say that the Tiny84 worked as the transmitter? Are you sure you've bootloaded it to set the fuses so it will run at 8mhz (or use a crystal if you're using one)? Out of the box they're set to run at 1mhz, and if you compile for 8mhz but upload to chip running at 1mhz, it won't work.
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

kingbf

DrAzzy
     I looked up the VirtualWire reference you posted and it coincides with the one I am using. The names have been changed over time apparently, but the "guts" remain the same. Now I seem to have some new issues. I am now unable to program "blink" on either an ATTiny 84 OR ATTiny 85. I will obviously need to get this dilemma resolved before I can move forward. I am sure this will be a contributing factor to my inability to program the 84 with the receiver program. In an attempt to resolve the current issue, I uninstalled the current version of the Arduino IDE and installed an earlier version. (1.6.5 R2) That didn't work so I went back to the current version. (1.8.4 I think) Still no luck. The only substitute for intelligence is perseverance so I'll keep at it.
        Brian

kingbf

DrAzzy
     The combination of persistence and overcoming stupidity solved at least part of my problem. The reason the Attiny 84 and 85 weren't working was because of the power supply. I was using a battery pack that output around 10 volts and the two chips were not happy with that. Who knew? Anyway, after applying the appropriate voltage, both chips now run the blink program properly. This puts me back to where we left off. What next? Thanks.
                    Brian

kingbf

DrAzzy
     To answer your question about the bootloader for the 84 if I recall correctly from my other readings if the wrong frequency (1 Mhz) is selected, the LED in the blink program will blink at a much slower and noticeable rate. This is not the case. The 84 blink works as predicted, about 1 Hz blink rate. I assume, and I know this may be an error, that the 84 is set to operate at 8 Mhz from this observation. Just in case, I tried running the bootloader from the tools menu but got an error "invalid device signature". I have no idea what that means or how it would affect the 84's performance. Is this something I need to address or will it not cause problems?
     As for the transmitter issue, still no go. The 85 works but not the 84. I'm baffled.
                    Brian

DrAzzy

Oh, so the tiny84 doesn't work for transmit or receive? Have you calibrated the internal oscillator? I don't know how close it needs to be for virtualwire, but the factory calibration of the internal oscillator is only +/-10% on most AVRs, that may not be good enough. If you have the pins, try throwing an 8mhz crystal (and caps, though on breadboard, try without caps too - sometimes the stray capacitance on breadboard is enough that it works without loading caps, and doesn't work with them) on it and setting it to use the crystal as clock source and burn bootloader like that.

"invalid device signature" means you connected the wires wrong (or that you had previously set it to use a crystal or other external clock source, and same is not connected).
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

kingbf

DrAzzy
     Back to foolishness. I managed to attempt to bootload the chip with EXTERNAL 8 Mhz. After correcting this I tried programming the chip again. It programs, just doesn't work, though. Wanting to ensure that the chip was not at fault, I bootloaded a new chip, set up a small program that sequences through four LEDs from different pins and repeats. I tested this program and it works fine, so I figured at least this chip is okay. I then added "#include<VirtualWire.h>" to the heading and the program uploads and still works okay. Next, I tried the transmit program. This does not work. This is the only means I have of checking for the correct clock frequency since I don't have any 8 Mhz crystals. As a guess I would think that the VirtualWire include has something in the code that is making the timer or interrupts react to the architecture of the ATTiny in a debilitating fashion. Here is where I am totally lost. I have no idea of how to address the internals of the chip or their operations. Again, this is only a guess on my part, so it may be something entirely different.  Thanks for not giving up on me, yet.
               Brian

Erni

I just remembered that I used a t84 with VW a long time ago.
So I just tried it out again, and it worked just fine, so there is nothing wrong with using ATTiny84 as transmitter. (I used an Uno as receiver)

I used the same library as proposed by DrAzzy:

https://github.com/JeffCost/VirtualWire/


and I use DrAzzy's core.

The tiny is running at 8Mhz, I don't know how sensitiv the VW is to the clock frequence

Go Up