RaphoufouLeFou / Casio-message-and-connect

This code add a bluetooth message system between casio graph 90+e and FX
5 stars 0 forks source link

Support for the Casio Classpad fx-cp400? #1

Closed MichaelK-F closed 4 months ago

MichaelK-F commented 1 year ago

Would it be possible to modify the esp program and the hardware so there it just plugs into the 3-pin communication port instead of having to solder it on to the PCB? If this is possible (witch I think it is) it would allow much wider compatibility between calculators.

Also you should post the program on the casiopedia forum

RaphoufouLeFou commented 1 year ago

Yes you can, and it also was my initial plan, but you will loose the control of the exam led, and you will need an external power source, like a battery for the esp32. For the moment, I only tested the program for the Casio fx-cg50 ( I only have this one ). I will code it for others calculator in a few days.

RaphoufouLeFou commented 1 year ago

Note that the schematic of the readme is completely wrong, I will update it later in the day

RaphoufouLeFou commented 1 year ago

The esp32 program itself should work on every calculator that have a serial port ( 3-pin ), it's the calculator's code that vary between calculators. For the moment, i've complicated it only for calculators that accept .g3a files, like the fx-CG50 (graph 90+e)

MichaelK-F commented 1 year ago

I have the cp-fx400, the classpad 330, and the classpad 330 plus so I could do some testing. (When I have time because I have to start school soon)

MichaelK-F commented 1 year ago

Could you also post the plain text code (in txt format so I can read it on my computer for both the message and connect app) for the calculator so I can try and port it? Thx

RaphoufouLeFou commented 1 year ago

For the plain text code, you can have it by copy and paste the source code from GitHub no ? If you can, you can give me your email so I can send it to you. For the testing, I think I will go with an emulator, it will be easier

MichaelK-F commented 1 year ago

Yes you can, and it also was my initial plan, but you will loose the control of the exam led, and you will need an external power source, like a battery for the esp32. For the moment, I only tested the program for the Casio fx-cg50 ( I only have this one ). I will code it for others calculator in a few days.

The classpad 330 and 330 plus have no exam mode ( I think - they might not be on the latest firmware) and the cp-fx400 has software controlled exam mode with no led. ( it's disabled by sending a file to the calculator via a computer or by another non exam mode calculator, waiting for 12 hours, or by using the exam mode unlock feature on a non exam mode calculator. ))

Perhaps add a button to the esp that disables exam mode by replaying the data sent for the exam unlock function? ( the data could be captured using a bus pirate? )

Sorry for the wall of text 😅

MichaelK-F commented 1 year ago

Not sure how the power circuitry works but it could be modified to send power out through the built in usb port.

That would get rid of the requirement to have a battery and all the circuitry that it needs.

RaphoufouLeFou commented 1 year ago

Yeah I thought about that as well. I'v scanned the activity of the serial port of the calculator when it's sending the signal to remove the exam mode, but I didn't see anything, not any byte transfered. But, I just think of it, but when doing that, the calculator may not use 9600 bauts, and that the speed i've check for, so it might be possible. I will test it later

RaphoufouLeFou commented 1 year ago

After some research, I found out that you can't have non Casio add-in for the fx-cp calculators. There is not public SDK or compiler for these calculator. It's sad...

MichaelK-F commented 1 year ago

I think the default communication baud rate is 115200. Also I think that you need 2 calculators because I think it proforms a handshake between both of them. Just curious, how did you capture the data from the calculator? Using an esp?

MichaelK-F commented 1 year ago

These calculators do have a form of basic built in that can be used to communicate over the 3 pin connector, get key presses and display text

RaphoufouLeFou commented 1 year ago

Ok interesting. Yes I used an esp32 to get the signal from the calculator

MichaelK-F commented 1 year ago

Do you have the code for the esp to capture the signal so I can try it on my calculator?

RaphoufouLeFou commented 1 year ago

yes of course, it's very simple,


unsigned long previousMillis = 0; 
unsigned long interval = 20UL; // time in ms to stop the capure
bool interupt = false;
int VoltageInterupt = 2;

void setup() {
  // initialize serial communication at 1000000 bits per second:
  Serial.begin(1000000);
}

// the loop routine runs over and over again forever:
void loop() {
  // read the input on analog pin 34:
  int sensorValue = analogRead(34);
  // Convert the analog reading (which goes from 0 - 4095) to a voltage (0 - 3.3V):
  float voltage = sensorValue * (3.3 / 4095.0);
  // print out the value you read:

  if(VoltageInterupt < 2 && interupt == false){
    interupt = true;
    previousMillis = millis();

  }
  if(interupt == true &&( millis() > previousMillis + interval )){
    ;
  }else{
    Serial.println(voltage);
  }
}```
RaphoufouLeFou commented 1 year ago

it read the voltage at high speed to be sure to get the signal. This speed (1000000 bauts ) work for a serial speed of 9600, but apparently it doesn't work for speeds like 115200. maybe try sending int instead of floats and change the scale, to like 50 for 5v to keep the precision, it will be quicker, so more value can be transferred each seconds

MichaelK-F commented 1 year ago

Here is a simple program for communicating over the 3 pin connection between the calculators. (No esp just a cable)

Link to video

Unrelated but similar:

Here is a chat app I made a while ago (chat1 goes on one of the calculators and chat goes on the other)

Chat1:

ClrText Print "ChatApp 1.0" Print "by Michael K-F" Print " " OpenComPort38k print Started Print " " GetVar38k chattxt1 print chattxt1 Lbl start DelVar chattxt0 InputStr chattxt0 Unlock chattxt0 Print chattxt0 SendVar38k chattxt0 GetVar38k chattxt1 print chattxt1 Goto start

Chat:

ClrText Print "ChatApp 1.0" Print "by Michael K-F" Print " " OpenComPort38k print Started Print " " Lbl start DelVar chattxt1 InputStr chattxt1 Unlock chattxt1 Print chattxt1 SendVar38k chattxt1 GetVar38k chattxt0 print chattxt0 Goto start

RaphoufouLeFou commented 1 year ago

In what language did you code this ? It's an add-in or it's coded directly via the calculator?

MichaelK-F commented 1 year ago

It's a form of BASIC that's built into the calculator. On these calculators it's called "program" on the menu. Video

MichaelK-F commented 1 year ago

To clarify, it's not an add on its built in.

RaphoufouLeFou commented 1 year ago

Oh ok I see, I think I have the same thing on my fx-cg50, let me check

MichaelK-F commented 1 year ago

If you want to program in it without actually having the calculator use can use the free trial program for emulating the calculator from the casio website.

Link

MichaelK-F commented 1 year ago

If your calculator has the program feature then the same code should work on any other casio calculator.

RaphoufouLeFou commented 1 year ago

I tested and it doesn't work lol, sadly

MichaelK-F commented 1 year ago

I was having a look around and I found a community made sdk mod for the cp fx400 https://github.com/SnailMath/hollyhock-2 I believe someone made an emulator for it as well for testing.

MichaelK-F commented 1 year ago

There is also a discord server https://discord.gg/VutNzzSe