Satellite Transmitter, help me make it!

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Re: Satellite Transmitter, help me make it!

Postby kevin286 » Thu Dec 11, 2008 4:24 pm

mzapatasilva wrote:I am working with a Compass that communicates via AF_softserial with the Arduino, and a PC (usb laptop) that talks to Arduino too, and I am running into some timings problems too.

My suggestion is to check if an external UART bufferd, will make your code more simple, and your circuit more robust. This way you don´t have to take care of timings.

MZS


mzapatasilva, could you post up some sample code please. Does your compass use RTS CTS lines as well or not?

What is a "UART buffered"?

Thanks
kevin286
 
Posts: 13
Joined: Tue Nov 11, 2008 10:46 pm

Re: Satellite Transmitter, help me make it!

Postby mzapatasilva » Wed Dec 17, 2008 8:55 am

kevin286 wrote:
mzapatasilva wrote:I am working with a Compass that communicates via AF_softserial with the Arduino, and a PC (usb laptop) that talks to Arduino too, and I am running into some timings problems too.

My suggestion is to check if an external UART bufferd, will make your code more simple, and your circuit more robust. This way you don´t have to take care of timings.

MZS


mzapatasilva, could you post up some sample code please. Does your compass use RTS CTS lines as well or not?

What is a "UART buffered"?

Thanks



//rutine related to the server , I use 10, because of the baudrate that I am using
void ReturnPC(byte valor)
{
digitalWrite(pinEnable,HIGH);
Serial.print(valor,BYTE);

delay(10);
digitalWrite(pinEnable,LOW);
}




I use this code along my programm to send data form the Arduino to the laptop through a MAxim485 that requieres a RTS line that I have attached to pinEnable.
UART o USART could be an internal or stand alone IC that takes care of serial asynchronous comunications, leting the Microcontroler do other tasks meanwhile.
Pins 0 and 1 are using a UART internal on the Arduino, ut all other pins are using Microcontroler time or resources.


The Arduino Diecimila has a number of facilities for communicating with a computer, another Arduino, or other microcontrollers. The ATmega168 provides UART TTL (5V) serial communication, which is available on digital pins 0 (RX) and 1 (TX) REFERENCE:http://www.arduino.cc/en/Main/ArduinoBoardDiecimila
mzapatasilva
 
Posts: 8
Joined: Fri Oct 31, 2008 11:23 am

Re: Satellite Transmitter, help me make it!

Postby mzapatasilva » Wed Dec 17, 2008 9:10 am

Here you have a very good article about comunications using the Arduino. Take a look at it.

When a new character arrives the UART system generates an interrupt. The microcontroller stops running the main code (your application) and jumps to an Interrupt Service Routine (ISR) for the specific interrupt. In this case, a received character interrupt. This ISR grabs the new character from the UART, places it into a buffer, then clears the interrupt and returns. When the ISR returns the microcontroller goes back to your main code and continues where it left off. This all happens in the background and your main application code is not directly effected.

If you have lots of interrupts firing or fast timer interrupts your main code will execute slower because the microcontroller is spreading it’s processing time between your main code and all the ISR functions.
http://www.uchobby.com/index.php/2007/11/24/arduino-interrupts/
mzapatasilva
 
Posts: 8
Joined: Fri Oct 31, 2008 11:23 am

Re: Satellite Transmitter, help me make it!

Postby mzapatasilva » Wed Dec 17, 2008 9:50 am

have you tried to communicate first the Laptop with the Modem with a very simple program?

#include <AFSoftSerial.h>
#define COMPASSRATE 19200
#define BAUDRATE 9600
#define pinTX 2
#define pinRX 3
#define pinEnable 4

AFSoftSerial mySerial = AFSoftSerial(3, 2);

void setup() {

pinMode(13, OUTPUT);
Serial.begin(BAUDRATE);
mySerial.begin(COMPASSRATE);
}

void loop() // run over and over again
{
if (mySerial.available()) {
Serial.print((char)mySerial.read()); //puts on computer1 what gets form computer2
}
if (Serial.available()) {
digitalWrite(pinEnable,HIGH);
mySerial.print((char)Serial.read());//puts on compu2 what gets from computer1
delay(10);
digitalWrite(pinEnable,LOW);
}
}
mzapatasilva
 
Posts: 8
Joined: Fri Oct 31, 2008 11:23 am

Re: Satellite Transmitter, help me make it!

Postby kevin286 » Wed Dec 17, 2008 12:30 pm

Thanks for all the good information. I had not thought of using and interrupt before. I'll have to read the links you provided.
Admittedly I have been slacking a little bit as we just moved our lab and my access to equipment has been limited.
I'll get in gear again here.

:?
kevin286
 
Posts: 13
Joined: Tue Nov 11, 2008 10:46 pm

Re: Satellite Transmitter, help me make it!

Postby mzapatasilva » Mon Mar 23, 2009 4:32 pm

I am using 3 lines, since I am using RS 485.
Lines are
Rx
Tx
and Enable... this line must be high before sending data

Do you need the code that I wrote? or you allready solved your communication problem?
mzapatasilva
 
Posts: 8
Joined: Fri Oct 31, 2008 11:23 am

Re: Satellite Transmitter, help me make it!

Postby sponger_nz » Mon Nov 02, 2009 3:15 am

Hi Kevin. Any luck getting some code to run the STX2? I have a similar project and have got the hardware running and the GPS programmed. I now need to program the STX2 to send the GPS data. I'm programming a micro to run all this in C and am a little out of my league...
sponger_nz
 
Posts: 2
Joined: Mon Nov 02, 2009 3:11 am

Re: Satellite Transmitter, help me make it!

Postby kevin286 » Mon Nov 02, 2009 1:00 pm

if you're running directly c (not with arduino) there's some pretty straight forward sample code for the crc in the stx2 manual iirc. I think that's the only difficult part.

I havent been able to impliment communication to the stx with arduino yet. That's above my level currently. I'm doing good to read/convert & print from an analog sensor :/

if you get it working, i'd like to see your code if you don't mind.
cheers,


Code: Select all
* COMPONENT NAME:
* crc16
*
* DESCRIPTION:
* This function computes a 16 bit CRC value for an array of bytes. The value that is returned by this
* function needs to be inverted before it gets placed into the packet. The CRC
* goes at the end of the packet, low byte first. For example:
*
* crc = ~crc16(0xFFFF, msgbuf, length);
*
* msgbuf[length] = (uint8_t)(crc & 0xFF);
* msgbuf[length + 1] = (uint8_t)(crc >> 8);
*
* When calling this function to check the validity of a packet received from
* the STX2, the caller should expect the value 0xF0B8 (#defined as CRC_OK) to
* be returned if the packet is valid.
*
* INPUTS:
* crc - the value to start computing the CRC with. This allows for chaining
* together of CRC values computed for multiple arrays of data. The
* initial value should be FFFFh (#defined as CRC_INIT).
* ptr - the pointer to the array of bytes to compute the CRC for
* length - the length of the data array
*
* OUTPUTS:
* returns - the computed 16 bit crc value
*******************************************************************************/
uint16_t crc16(uint16_t crc, uint8_t *ptr, int length)
{
auto uint16_t i;
while(length--)
{
crc = crc ^ (uint16_t) *ptr++;
for(i=0;i<8;i++)
{
if(crc & 0x0001)
crc = (crc >> 1) ^ 0x8408;
else
crc >>= 1;
}
}
return crc;
}


and sample usage

Code: Select all
The following code was compiled using Visual C++ 6.0
/*
Sample results:
0xAA 0x05 0x05 CRC : 0x74 0x93
0xAA 0x05 0x01 CRC : 0x50 0xD5
*/
#include "stdafx.h"
#define uint16_t unsigned short
#define uint8_t unsigned char
int main()
{
unsigned char Input[5];
uint16_t CrcValue=0;
for(;;)
{
Input[0]=0xAA;
Input[1]=0x05;
Input[2]=0x01;
Input[3]=0x00;
Input[4]=0x00;
CrcValue=~crc16(0xFFFF,Input,3);
Input[3]=(uint8_t) (CrcValue&0xFF);
Input[4]=(uint8_t) (CrcValue>>8);
}
printf("That’s done!\n");
return 0;
}
kevin286
 
Posts: 13
Joined: Tue Nov 11, 2008 10:46 pm

Re: Satellite Transmitter, help me make it!

Postby tytower » Wed Nov 04, 2009 6:41 am

I looked at the dates here and wondered if there was any progress on the satellite communication ? If I can help I would like too. Most over my head but you never know. Just finished a Fridge/Freezer monitored by RF modules sending data to PC

viewtopic.php?f=25&t=13122&p=63817#p63817

Know some about satellite , radio, some light programming ,just learning C++.
tytower
 
Posts: 61
Joined: Thu Sep 17, 2009 11:47 pm

Re: Satellite Transmitter, help me make it!

Postby sponger_nz » Fri Nov 06, 2009 2:21 am

Hi Kevin.The CRC is the least of my problems at present. I hope to be sending a test message in about a week, and be sending GPS data by the end of the month. I will happily post my code here once it is done.

I presume you put your "data" through the CRC algorithm, then tag the resulting 2 bytes onto the end of the message and pump it out to the STX2?

I have noticed some errors both in the hardware and software parts of the STX2 spec sheet and once my project is up and running will be sending a list of suggested ammendments through. If you would like to know what I have picked up sofar, let me know.

Glen.
sponger_nz
 
Posts: 2
Joined: Mon Nov 02, 2009 3:11 am

Re: Satellite Transmitter, help me make it!

Postby tytower » Sat Oct 22, 2011 3:52 pm

He appears to have moved on
Sent a PM
His links don't work but I think this is the device http://www.sensservice.com/pdfs/stx2.pdf
tytower
 
Posts: 61
Joined: Thu Sep 17, 2009 11:47 pm

Previous

Return to Arduino

Who is online

Users browsing this forum: No registered users and 4 guests

Stuff to buy from the Adafruit store and links to product documentation!


New Products [103]

Raspberry Pi[80]
 
FLORA[23]
 
Bunnie Studios[9]
 
FPGA[1]
 
mbed[11]
Arduino[60]
 
NETduino[14]
 
BeagleBone[24]
 
Android[6]
 
XBee[10]
More Dev Boards[30]


 
BoArduino[8]
 
SpokePOV[4]
 
TV-B-Gone[4]
 
MiniPOV[3]
 
SIM reader[3]
 
Microtouch[5]
 
Clocks & Watches[18]
 
Drawdio[4]
 
Brain Machine[1]
 
Game of Life[2]
 
MintyBoost[2]
More DIY Kits[16]


 
MaKey MaKey[3]
 
Tweet-a-Watt[5]
 
Young Engineers[33]
 
Discover Electronics[2]
 
Snap Circuits[4]
 
littleBits[3]
 
Project packs[8]


 
Breakout Boards[33]
LCDs & Displays[48]
Components & Parts[69]
Batteries & Power[49]
EL Wire/Tape/Panel[52]
LEDs[109]
 
Wireless[14]
Cables[61]
 
Lasers[6]
Sensors/Parts[145]
 
Enclosures/Cases[11]
 
Solar[11]
 
RFID / NFC[13]
Prototyping[70]
 
iDevices[13]
Tools[71]
 
Wearables[39]
 
CNC[37]
 
Robotics[29]
 
3D printing[1]
 
Materials[24]


 
Stickers[41]
 
Skill badges[55]
 
Books[25]
 
Circuit Playground[7]
 
Gift Certificates[4]