Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
BlueLink is my arduino-based serial to TI linkprotocol module. BlueLink allows you to use the onboard USB serial on the Arduino or an external powered serial bluetooth module (I used the HC-06).

My code is based on the linking routines by KermMartian.

Code:
/*
 * Copyright Karel Dhondt aka biohax.
 * Thanks to KermMartian for the TI linking routines.
 */

#define TIring 8
#define TItip 9
#define ERR_READ_TIMEOUT 1000
#define ERR_WRITE_TIMEOUT 1000
#define TIMEOUT 2000
#define GET_ENTER_TIMEOUT 500

char temp;
boolean linkAvailable;

void setup()
{
  Serial.begin(9600);
  resetLines();
}

void loop()
{

  while (Serial.available()){
      writeByte(Serial.read());
  }
 
  temp = readByte();
  while (linkAvailable){
      Serial.write(temp);
      temp = readByte();
  }
 
  //delay(50);

}

void resetLines() {
   pinMode(TIring, INPUT);           // set pin to input
   digitalWrite(TIring, HIGH);       // turn on pullup resistors
   pinMode(TItip, INPUT);            // set pin to input
   digitalWrite(TItip, HIGH);        // turn on pullup resistors
}

byte writeByte(uint8_t byte) {
   long previousMillis = 0;

   // Send all of the bits in this byte
   for(int bit = 0; bit < 8; bit++) {
      
      // Wait for both lines to be high before sending the bit
      previousMillis = 0;
      while (digitalRead(TIring) == LOW || digitalRead(TItip) == LOW) {
         if (previousMillis++ > TIMEOUT) {
            resetLines();
            return ERR_WRITE_TIMEOUT;
         }
      }
      
      // Pull one line low to indicate a new bit is going out
      bool bitval = (byte & 1);
      int line = (bitval)?TIring:TItip;
      pinMode(line, OUTPUT);
      digitalWrite(line, LOW);
      
      // Wait for peer to acknowledge by pulling opposite line low
      line = (bitval)?TItip:TIring;
      previousMillis = 0;
      while (digitalRead(line) == HIGH) {
         if (previousMillis++ > TIMEOUT) {
            resetLines();
            return ERR_WRITE_TIMEOUT;
         }
      }

      // Wait for peer to indicate readiness by releasing that line
      resetLines();
      previousMillis = 0;
      while (digitalRead(line) == LOW) {
         if (previousMillis++ > TIMEOUT) {
            resetLines();
            return ERR_WRITE_TIMEOUT;
         }
      }
      
      // Rotate the next bit to send into the low bit of the byte
      byte >>= 1;
   }
   
   return 0;
}

byte readByte() {
     long previousMillis = 0;
     uint8_t b = 0;
   
   // Pull down each bit and store it
   for (int bit = 0; bit < 8; bit++) {
      int linevals;

      previousMillis = 0;
      while ((linevals = ((digitalRead(TIring) << 1) | digitalRead(TItip))) == 0x03) {
         if (previousMillis++ > GET_ENTER_TIMEOUT) {
            resetLines();
                                linkAvailable = false;
            return ERR_READ_TIMEOUT;
         }
      }
      
      // Store the bit, then acknowledge it
      b = (b >> 1) | ((linevals == 0x01)?0x80:0x00);
      int line = (linevals == 0x01)?TItip:TIring;
      pinMode(line, OUTPUT);
      digitalWrite(line, LOW);
      
      // Wait for the peer to indicate readiness
      line = (linevals == 0x01)?TIring:TItip;      
      previousMillis = 0;
      while (digitalRead(line) == LOW) {            //wait for the other one to go low
         if (previousMillis++ > TIMEOUT) {
            resetLines();
                                linkAvailable = false;
            return ERR_READ_TIMEOUT;
         }
      }

      // Now set them both high and to input
      resetLines();
   }
        linkAvailable = true;
   return b;
}


When you use an arduino Mini Pro or a Micro it isn't hard to insert the module in the calculator. I soldered the power supply of the batteries of the calc to the arduino and bluetooth module separetely with a bipolar swich in between. Pictures can be found here: http://imgur.com/a/iLO7L


My module is seen as a GrayLink and works with both TiLP and TI Connect.

The main goal was to connect my TI84+ with any smartphone. This means that our smartphone could be used as a wifi and sms shield for our beloved TI84+. I've already made a server-side app (beta quality) for android which allows to send & receive text messages on the calc. If anybody is intressed i'll share my sources of the android app.
A really nice idea!

EDIT: Nevermind, I saw you changed it.
Are you using the old linking routines that KermM posted a while ago, or his updated ArTICL (https://github.com/KermMartian/ArTICL)?
Ivoah wrote:
Are you using the old linking routines that KermM posted a while ago, or his updated ArTICL (https://github.com/KermMartian/ArTICL)?
I strongly recommend you use ArTICL. It's more stable and reliable, and for the programmer, has a much cleaner API.
Oh wow, this is great work! Smile It has very many potential uses; can't wait to see where it goes! I'm a little curious as to how fast transmission is; is it relatively instantaneous? Keep up the great work!
KermMartian wrote:
Ivoah wrote:
Are you using the old linking routines that KermM posted a while ago, or his updated ArTICL (https://github.com/KermMartian/ArTICL)?
I strongly recommend you use ArTICL. It's more stable and reliable, and for the programmer, has a much cleaner API.


I edited your ArTICL getByte method to show he was available when i received actual data.
MateoConLechuga wrote:
Oh wow, this is great work! Smile It has very many potential uses; can't wait to see where it goes! I'm a little curious as to how fast transmission is; is it relatively instantaneous? Keep up the great work!

Transfer rate is +/- 1kByte/s according TiLP.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are GMT - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement