Arduino uno a Attiny85 433mhz Manchester

Odpovědět
ArduXPP
Příspěvky: 361
Registrován: 14 pro 2017, 19:31
Reputation: 0
Kontaktovat uživatele:

Arduino uno a Attiny85 433mhz Manchester

Příspěvek od ArduXPP » 08 úno 2018, 13:57

Neví někdo jak zprovoznit attiny85 jako vysílač, a arduino uno jako přijímáč . Arduino jede na 16Mhz a attiny85 na 8Mhz.
Autor píše, že

Kód: Vybrat vše

"Manchester coding states that there will always be a transition of the message signal
at the mid-point of the data bit frame.
What occurs at the bit edges depends on the state of the previous bit frame and
does not always produce a transition. A logical '1' is defined as a mid-point transition
from low to high and a '0' is a mid-point transition from high to low.

We use Timing Based Manchester Decode.
In this approach we will capture the time between each transition coming from the demodulation
circuit."

Timer 2 is used with a ATMega328. Timer 1 is used for a ATtiny85.

This code gives a basic data rate as 1200 bauds. In manchester encoding we send 1 0 for a data bit 0.
We send 0 1 for a data bit 1. This ensures an average over time of a fixed DC level in the TX/RX.
This is required by the ASK RF link system to ensure its correct operation.
The data rate is then 600 bits/s.

Timer 2 in the ATMega328 and Timer 1 in a ATtiny85 is used to find the time between
each transition coming from the demodulation circuit.
Their setup is for sampling the input in regular intervals.
For practical reasons we use power of 2 timer prescaller for sampling, 
for best timing we use pulse lenght as integer multiple of sampling speed.
We chose to sample every 8 ticks, and pulse lenght of 48 ticks 
thats 6 samples per pulse, lower sampling rate (3) will not work well for 
innacurate clocks (like internal oscilator) higher sampling rate (12) will
cause too much overhead and will not work at higher transmission speeds.
This gives us 16000000Hz/48/256 = 1302 pulses per second (so it's not really 1200) 
At different transmission speeds or on different microcontroller frequencies, clock prescaller is adjusted 
to be compatible with those values. We allow about 50% clock speed difference both ways
allowing us to transmit even with up to 100% in clock speed difference
Jak by měl tedy vypadat kod, aby komunikace se mezi Arduino uno a Attiny85 dohodly mezi sebou. :)

jankop
Příspěvky: 1029
Registrován: 06 zář 2017, 20:04
Reputation: 0
Bydliště: Brno
Kontaktovat uživatele:

Re: Arduino uno a Attiny85 433mhz Manchester

Příspěvek od jankop » 08 úno 2018, 16:05

Tx/Rx na 433MHz mají běžně hodně omezenou přenosovou rychlost. Měl bys vyjít z tvých modulů, které máš k dispozici, co vlastně umožňují, zvolit si rychlost na které budeš komunikovat a naprogramovat si komunikaci. Ten Manchester je jen třešnička na dortu. Používá se proto, protože demodulační obvody přijimače jsou většinou hodně primitivní a Manchester kód eliminuje stejnosměrnou složku vznikající v demodulátoru. Vyhnout se tomu by možná šlo použitím kvalitních obvodů vysílače včetně příjimače superhet. V každém případě nečekej, že komunikace na 433Mhz je něco jako RS232, tedy definováno.
Tu komunikace musíš vymyslet sám, nebo z něčeho obouchnout. Za běžných podmínek je naprosto šumafuk, jestli procesor pracuje na 8 nebo 16MHz. Komunikační rychlosti běžně dosažitelné a používané na 433MHz jsou nesrovnatelně nižší.

ArduXPP
Příspěvky: 361
Registrován: 14 pro 2017, 19:31
Reputation: 0
Kontaktovat uživatele:

Re: Arduino uno a Attiny85 433mhz Manchester

Příspěvek od ArduXPP » 08 úno 2018, 16:26

Mezi arduinem 16Mhz a Arduinem 16Mhz komunikuje 9600. Mezi attiny85 a attiny85 komunikuje 2400 .
Protože to funguje na Timer 2 arduino uno, a attiny timer 1. Tak to je popsané v tom kodu. A vlastně jsem to psal prvním příspěvku, je to v tom anglickém jazyku.

Odpovědět

Kdo je online

Uživatelé prohlížející si toto fórum: Žádní registrovaní uživatelé a 15 hostů