Code Example for Atmel UsersATP uses AFSK method to sending telemetry data over VideoTX’s audiochannel. The carrier is 2100Hz and a byte starts with one 1300hz wave(start bit), ATP sendsdata bits after the start bit. and it sends minimum 10 carrier wave(zero) before a new start bit.You can read my detailed information from this link (sorry for my English): http://www.flytron.com/pdf/audio_modem.pdf
Calibrating a PWM generator for 2100Hz carrier wave (for Atmega328)
TCCR1B = 0x00; //stop timerTCNT1H = 0;TCNT1L = 0;
ICR1 = ((Xtalfrequency/8) / 2100); //2100hz carrier generator value 878 for 14.7Mhz
OCR1B = ((Xtalfrequency/8) / 2100)/2; // ICR1 / 2 for %50 PWM waves
TCCR1A = 0x22;
TCCR1B = 0x1A; //start timer
This code generates static 2100hz square waves, put a 100nf capacitor on outside of processor and connect it on Audio in of TX, now you have a sinus on RX side ;)
You can send the bytes any time in your main code flow because AFSK protocol following waves not time sensitive protocol.
modem[] is an byte array that filled with data to send.
modem_byte is an integer for selecting byte of modem[] array
modem_bit is an char for counting sinus waves of AFSK
This code sends start bit at start and 8 bit of byte,
you should wait for 5ms for next byte for balancing sinus waves on audio stream, then you can send another byte also.
modem_bit = 0;while (modem_bit<18) //wait for all bit waves {
if ((modem_bit%2==0) && ((PINB & (1 2))) ) // wait for 1 on PWM output.
{
if (modem_bit==0) // start bit
{
TCNT1H = 1; // this values creates small delay for increasing the wave width
TCNT1L = 180; // and AFSK decoder can detect this big waves to 1, other small(2100hz) waves 0
}
if (modem_bit>1)
{
if (modem[modem_byte] & (1((modem_bit-2)/2))) // if bit of bte is 1, change the wave width for 1 on AFSK
{
TCNT1H = 1; // this values creates small delay for increasing the wave width
TCNT1L = 180; // and AFSK decoder can detect this big waves to 1, other small(2100hz) waves 0
}
}
modem_bit++;
}
if ((modem_bit%2==1) && (!(PINB & (1 2)))) // wait for 0 on PWM output
{
modem_bit++;
}
}ATP Modem SoftwareI wrote a modem software for reading AFSK waves without any hardware (maybe a serial 100k resistor on microphone in)File name is: SOSD_Modem.exeDownload link is: http://www.flytron.com/bootloader/xl_tools.zip
This is only software modem on the planet (or i didn't see another) :)It is decoding AFSK codes from microphone input like an oscilloscope and giving output values from TCP for 3th party softwares. You can design your loggers, goggle earth interfaces or more with this plug.It is using 20byte data pack for transmitting and software can separate themFirst 16 byte is data bytes last 3 byte is line end and CRCPack of Bytes[0-3] Latitude (4 byte = 32 bit long integer of coordinates)[4-7] Longitude (4 byte = 32 bit long integer of coordinates)[8-9] Altitude (2 byte = 16 bit long integer of altitude)[10] Heading Angle (multiply it with 1.4 for finding angle value)[11] Battery 1 voltage (divide 10 for value, 111 mean 11.1Volt)[12] Battery 1 voltage (divide 10 for value, 74 mean 7.4Volt)[13] Current Sensor 1 (multiply with 0.4 for value, 101 mean 40.4Ah[14] Current Sensor 2 (multiply with 0.4 for value, 101 mean 40.4Ah[15] RSSI (It is percentage of maximum value, 35 mean %35)[16] Speed (km/h)[17] Line End 1 (value 10)[18] Line End 2 (value 13)[19] CRC ( 8 bit totals of first 19 btye)If you uses my original data pack Software Modem giving this type output from port 1976 (my birth year)$TELE,lat,lon,alti,heading,voltag1,voltage2,curren t1,current2,rssi, speed, #13 #10Or you can use your own data pack and you can decode them yourself from modem's RAW data output.$RAWS,byte0,byte1,byte2,byte3,byte4.........,byte16, #13 #10then you can decode your data bytes(first 16 byte)This software only part of ATP i didn't share the codes because i want to share the protocol with all autopilot/OSD producers and i want to use their 3th party tools too.If I share the code, they can change only AFSK frequency and visuals for non compatible products.New FeaturesI added direct KML file based live view for Google Earth on the new version of modem software.You can click on plane_tracker.kml file and Google Earth connects your Modem Software to tracking the plane :)It is already primitive because we have some connection problem on Google Earth since few months :(
Story Of ATPIf you want to read all discussions follow this link: http://www.rcgroups.com/forums/showthread.php?t=1157558Thanks for readingMelih
Comment by NomDePlums on August 9, 2010 at 3:03am
Comment by Jhon on August 9, 2010 at 3:20am
Comment by Melih Karakelle on August 9, 2010 at 4:06am 
Comment by ionut on August 9, 2010 at 5:51am
Comment by Carlito Oliveira on August 9, 2010 at 7:20pm
Comment by Melih Karakelle on August 9, 2010 at 10:19pm
Comment by Simon Wood on August 10, 2010 at 9:28am
Season Two of the Trust Time Trial (T3) Contest has now begun. The fourth round is an accuracy round for multicopters, which requires contestants to fly a cube. The deadline is April 14th.9 members
1289 members
140 members
313 members
44 members
© 2013 Created by Chris Anderson.
Powered by

You need to be a member of DIY Drones to add comments!
Join DIY Drones