Yesterday we made a video of our ir communication as it is at the moment.
Its basicaly the same program as found here:
http://tthheessiiss.wordpress.com/2009/08/05/dirt-cheap-wireless/
with the only difference in the sendprogram is that we don't write "TESTING TESTING TESTING" every 500ms
In our program we changed that part so the arduino will send what we tell it to trough his serial port
this is the modified sendprogram:
//dirt cheap wireless TX
//generates 38kHz carrier wave on pin 9 and 10
//sends data via TX every 500ms
char incomingByte;
void setup()
{
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
// Clear Timer on Compare Match (CTC) Mode
bitWrite(TCCR1A, WGM10, 0);
bitWrite(TCCR1A, WGM11, 0);
bitWrite(TCCR1B, WGM12, 1);
bitWrite(TCCR1B, WGM13, 0);
// Toggle OC1A and OC1B on Compare Match.
bitWrite(TCCR1A, COM1A0, 1);
bitWrite(TCCR1A, COM1A1, 0);
bitWrite(TCCR1A, COM1B0, 1);
bitWrite(TCCR1A, COM1B1, 0);
// No prescaling
bitWrite(TCCR1B, CS10, 1);
bitWrite(TCCR1B, CS11, 0);
bitWrite(TCCR1B, CS12, 0);
OCR1A = 210;
OCR1B = 210;
Serial.begin(2400);
}
void loop()
{
if (Serial.available()>0) {
incomingByte = Serial.read();
Serial.print(incomingByte);
}
}
marked red is the loop we changed.
Now we have a one way communication.
The next step would be having the arduino answer something as a response ,such as message received.
To test this out we tried to send back what we received.
Then we had the folowing problem, the message was sent back but because the sender receives the message at his RX-pin, the same pin we use to send commands from our pc to the arduino.
the message that was send back was seen as a command from the pc.. a command to send..
this way we made a loop without end.
another problem is as you will see in the video below is that we receive a certain amount of noise, we keep receiving ΓΏ in between messages.
We'll have to think about something to filter this out of the data and will probably use a startcharacter and an endcharacter in our message to do this.
Note that the noise is never inside data,its only when no data is being sent.
Link to video:
http://www.youtube.com/watch?v=PKneGq5Sy34
The schematics can be found at dirtcheapwireless,the first link.
Geen opmerkingen:
Een reactie posten