Go Down

Topic: rsapi.dll with Excel VB, replace with arduino?? (Read 1 time) previous topic - next topic

Hiddenvision

#30
Jul 11, 2019, 01:32 pm Last Edit: Jul 18, 2019, 08:45 pm by Hiddenvision
Oh there you go,
I read a bit more and figure the addressing offset.
Now the Write function actually works.

SEE LATER POSTS FOR LATEST FILES

pissten

Thanks again for the great job done.

I tried to hook up another arduino as PCU emulator on the softserial pins, put I don't seem to get this properly working. I get unknown in response on the serial number request.

And for your last post, what write functions were you referencing?

I've been a little busy the last couple of days, using my boat in a local fjordrace etc.. So haven't been able to hook the PCU up to the arduino yet. just tried like you suggested, to use another arduino to emulate.

Just to clearify the end goal with this "project", it's my wish/dream to poll live RPM and Battery voltage from the PCU and use it with my Android Gauge app. It will be a nice comlpement to the existing gauges already implemented.

As for the fuel curve data, I'm now also very eager to visualize it in the app as well :D

Thanks for all your great work so far, I'm so incredably thankfull!

Hiddenvision

Hi C,
No worries on being busy "playing" with the boat.
That is after all what they are for, No?
Guessing Norway, TVEDESTRAND



The Write function was in the Excel prog.

The Emulator code now reads and writes the data from the EE so that you can edit the curves, program, and the changes are saved and should verify. Not claiming it is perfect, but it seems to work for the experiment.

I have not tried the softserial at all myself, not even programmed up another Arduino to test.
Sort of threw it in last moment but it felt working ish.!!
I shall program one later and see what happens.


Right so the end idea is to spit the displayable data out to something else.
Pretty easy on face value, just plain old serial, Bluetooth or WiFi.??

I would be tempted to make all this using a wifi module.(esp8266 for example)
Not strictly Arduino, but it seems fully supported in the IDE and would handle doing this task on it's head giving you an accessible interface that you can view/edit on a browser or extract data into existing gauge apps perhaps.



A positive stepping stone will be getting the Adruino to talk to the PCU.
I still wonder if it is going to need that line driver stuff on the comms or if it will be comfortable resting at 5v and not the reported 8 ish V.

Remember you have several options on how you connect the Arduino to the PCU.
1: Using a level shifter board on the two data lines.
2: Fitting a Max232 chip on the Arduino soft serial port and driving the original PCU Max board from that.
3: Direct connection perhaps with some resistors and other trickery to tolerate the voltage differences.

But just be cautious of hooking those 8v data lines direct to Arduino pins.

pissten

#33
Jul 17, 2019, 08:37 pm Last Edit: Jul 28, 2019, 03:28 pm by pissten
Hi H,

That's correct. I'll have to use the boat also, not just interact with it over serial ;)

You're correct about the location of the Fjordrace, I live here and for me it's like the biggest event of the year..hehe
How have you heard of this "little" local event?



I can verify that the write function now works flawlessly:D That's awseome!!

I've been trying to set up a second arduino to try to spit out the serial number on request from the PCU emulator. But haven't had any luck so far..

Would this be the proper code for it?:

<code>
#include <SoftwareSerial.h>


SoftwareSerial mySerial(2, 3); // RX, TX
byte serial_number[]  {'1','2','3','4','5',' '};


void setup() {
 // initialize both serial ports:
 Serial.begin(38400);
 mySerial.begin(38400);

}

void loop() {
 // read from port 1, send to port 0:
 if (mySerial.available()) {
   int inByte = mySerial.read();
   //Serial.write(serial_number, 7);
 }
 
 // read from port 0, send to port 1:
 if (Serial.available()) {
   int inByte = Serial.read();
   mySerial.write(serial_number, 7);
  }
 }
</code>

best regards
Chris

Hiddenvision

Hey C,

Umm,
I've been chasing my tail a little trying to get a second Arduino to respond.
Ahh, I see I was sending 144 not 114 for serial number request in the ino file.
I guess that was the next stepping stone hey !

Silly me,
Meanwhile I added some bits to set the line levels.
I think setting the softRX line with the INPUT_PULLUP helped when I disconnect the line.

You can use the same project to program the second Arduino.
Just uncomment the SWAPCOM define.

As before, on any serial number requests it will try to communicate with the actual PCU via the softserial pins. If it gets a positive response then the first 6 bytes are saved to EE and will be displayed in the Excel sheets. If it fails to get a response (due to timeout) it will write the number 6 to the first byte.

Seems a simple way to verify a connection while keeping everything else working as it was.


Just four wires between the two Arduinos.

Vin - Vin, (5v)
Gnd - Gnd,
10 - 11,
11 - 10.

I see you were selecting 2 and 3 for the softserial.
Not 100% sure but the notes mentioned that the RX had to be on one of the mentioned pins.


Anyway, just side tracked so will tidy things and paste an update later.


I found your 'little' boat event with the help of google magic.
I used to live on the Bridge to Bridge course in Australia.
Crazy people in super fast boats quite often dragging a water skier behind them.
I forget the distance now, Ahh 112kms.
https://www.bridge2bridge.com.au/

Hiddenvision

#35
Jul 18, 2019, 08:44 pm Last Edit: Jul 28, 2019, 05:10 pm by Hiddenvision
Try these for size.

Connect your spare Arduino to be used as the boat simulator
Just uncomment the SWAPCOM and newarduino defines and program the boat simulator.
Then re-comment newarduino and program the same device again.
All done that unit should now respond to serial on pins 10 & 11

Connect the original Arduino you were playing with,
Now comment out SWAPCOM and program.
If you needed to default the EE to something known then uncomment the newarduino as before, program, let it run and then comment and program again.


If you read thru you will see that when the PC requests the serial number then the running code will send the request byte 114 out the softserial. If the second Arduino or the actual PCU responds then the received number is saved in EE, if not response then the first digit is replaced with a "-".


I have added a little extra code to the Macros to WRITE the serial number on the connected ARDUINO.
I have NO IDEA what this will do to a normal PCU so please do not use the edited macro on any real equipment or comment out the section of excel code in the WRITE_ECU function.

Also remember that if the Arduino gets a valid response from the softserial then the serial number will be replaced. Disconnect a softseral wire to witness the SerialNumber change.

SEE LATER POSTS FOR LATEST FILES
This file is kept as a milestone pre multiple edits.

Hiddenvision

#36
Jul 22, 2019, 03:52 pm Last Edit: Jul 23, 2019, 11:27 pm by Hiddenvision
Just some edits.
REMEMBER TO KEEP YOUR ORIGINAL Excel file.
I cannot confirm if the edits made to the Macros will be transparent to what your PCU is expecting.

Hiddenvision

#37
Jul 23, 2019, 11:26 pm Last Edit: Jul 28, 2019, 08:17 pm by Hiddenvision
Ahh some extra edits required.
A few variables not declared in the serial Number writing function.

REMEMBER TO KEEP YOUR ORIGINAL Excel file.
I cannot confirm if the edits made to the Macros will be transparent to what your PCU is expecting.

Excel Macros deleted by request.

Go Up