74 130 135 129 128 143 180 165 128 153 15
Ri5ux wrote:Additionally my startup packet ended up being different. On the DK-PMA01 the startup packet I used is as follows:
- Code: Select all
74 130 135 129 128 143 180 165 128 153 15
To clarify, I did not try the startup packet you guys used, so both may actually work. Looks like different joysticks have different startup packets.
Type 04 SR power-up information
The minimum allowable length for this packet is 6 data bytes. If the SPM receives this packet with a length less than 8 data
bytes, it shall assume that the SR does not support actuator or lighting control.
Byte 0: Remote type: Types recorded elsewhere ( see )
Byte 1: Year of manufacture, minus 2000 - for example, 01 is 2001, 127 is 2127.
Byte 2: bits 3-0: Month of manufacture ( 1 is January, 12 is December).
Byte 3: Serial number bits 20-14
Byte 4: Serial number bits 13-7
Byte 5: Serial number bits 6-0
Byte 6: Software version number
Byte 7: Capabilities:
bits 6-3: currently unused
bit 2: If 0, has a virtual speed pot. If 1, has an analog speed pot. This flag is only honoured where the software version
is 2.5 or greater (whether prerelease or not)
bit 1: Supports 2 actuator control
bit 0: Supports lighting control
Notes:
The serial number format is chosen for compatibility with Dynamic Controls' standard serial number format (YYMXXXXX).
Allowance has been made such that the maximum serial number for any month can go up to 1,048,576. (they start at 10,000)
The values for the Software version number are:
0x00Versions before 1.0 release. This version has a 7-byte power-up packet, it omits the build version number.
0x01Release version 1.0. This version has a 7-byte power-up packet, it omits the build version number.
0x02Version 1.1 up to release candidate 1. No released product uses this value.
Where the upper nibble of the version number is greater than zero, the format of the version number is:
Bits 6-4: Software major version
Bit 3: "Pre-release flag": when set, this software is pre-release and is not suitable for production.
Bits 2-0: Software minor version.
For example, software version 1.1release candidate 2 will have a software version number of 0011001b or 0x19. Version 3.2
release will have a software version number of 0110010 or 0x32.
The format is chosen to enable easy reading of a hex dump such as that produced by the ^ terminal command on the Shark
Power Module (see SPM SRS section 26.14 for details).
The maximum version number that can be indicated using this scheme is 7.7.
I did also notice a post mentioning that you had to use a MAXIM branded DG419 IC, but found this to not necessarily be true. I am using the Vishay variant of the same part in mine with the initial pulse being the full battery voltage and have had no issues. I initially purchased this part before I had noticed that post, but figured I would try it anyways. After viewing the datasheet I hadn't seen any data showing it may be damaged due to the voltage or perhaps overlooked something you may have seen.
gcebiker wrote:Seed Studio is coming out with really cheap Lidar at the moment - here is just one of them
https://www.seeedstudio.com/RPLiDAR-A1M ... -4785.html
And if you used an Arduio Pilot from the quad copter world its already got all the software and hard ware stuff setup.
I started then found the resolution on the GPS to be to low/slow with non military grade access to the GPS satellites and at the time the LIDAR's were prohibitively expensive.
Here is a link to the Ardupilot Rover, the land based version of the platform https://ardupilot.org/rover/index.html
bhuja wrote:Hi,
I am working to replace my DK-REMD01 joystick with an Arduino nano and have read a lot of the forum trying to fix up my initial attempts.
I constructed the following circuit: https://www.wheelchairdriver.com/board/download/file.php?id=14818&mode=view
I am currently utilising the code at https://www.wheelchairdriver.com/board/viewtopic.php?f=2&t=6503&p=93844&hilit=working_deadband#p93844; "SR_Joystick_input_working_deadband.zip" but I'm not sure if this is the latest version as it does not exactly match the pinouts from the circuit above.
I have moved the Arduino wire pins to match the code. I am unsure what the onOffPin is used for, I am assuming it would be a physical switch?
I looked at the Shark Bus communications PDF and I am confused at the different power-up packet structures, how can I tell if I have a SACU in my system?
Additionally, is there any way to read the SPM responses?
I am wondering what is the best way to try and debug and find what sort of problem I am facing. I have a cheap logic analyser which I could try utilise.
Thanks for any help!
// byte 0 1 2 3 4 5 6 7 checksum
// OTHER 0 pulse 116 130 133 130 128 136 205 160 128 141 15
// MINE 0 pulse 116 130 140 132 128 130 165 160 128 178 15
// Micheal 0 pulse 116 129 143 133 128 143 249 167 128 199 15 .... later shark type pod
data[0] = 116;//Start Byte ..... Packets shall consist of a start byte, which includes the type of the packet and its length; followed by the data; followed by a checksum
data[1] = 130;//Byte 0: Remote type:
data[2] = 140;//Byte 1: Year of manufacture
data[3] = 132;//Byte 2: bits 3-0: Month of manufacture
data[4] = 128;//Byte 3: Serial number bits 20-14
data[5] = 130;//Byte 4: Serial number bits 13-7
data[6] = 165;//Byte 5: Serial number bits 6-0
data[7] = 160;//Byte 6: Software version number
data[8] = 128;//Byte 7: Capabilities:
#include <SoftwareSerial.h>
SoftwareSerial sharkSerial (roPin, diPin, false); // 'true' sets this to invert software serial output.
void setup() {
sharkSerial.begin(38400);
const int dePin = 7; // D7 .... to DE and RE of Max485
const int roPin = 0; // D0 .......RX of Arduino to RO of Max485 .... ( Not currently required as there is as yet NO receive coded )
const int diPin = 1; // D1 = TX of Nano
I would also suggest using the Nano's pin D1 = TX for the diPin and remove the SoftwareSerial from the sketch.
void sharkStartup () {
speed = 512;
direction = 512;
{
digitalWrite(dataSwitch, HIGH); // Flip DG419 switch, HIGH = 24v connected to emulator bus
delay(298); // Allow 24v pulse for 300ms +/- 20ms
digitalWrite(dataSwitch, LOW); // Flip DG419 switch, LOW = MAX485 connected to emulator bus
delay(10);
}
// byte 0 1 2 3 4 5 6 7 checksum
// MINE 0 pulse 116 130 140 132 128 130 165 160 128 178 15
data[0] = 116;//Start Byte ..... Packets shall consist of a start byte, which includes the type of the packet and its length; followed by the data; followed by a checksum
data[1] = 130;//Byte 0: Remote type:
data[2] = 140;//Byte 1: Year of manufacture
data[3] = 132;//Byte 2: bits 3-0: Month of manufacture
data[4] = 128;//Byte 3: Serial number bits 20-14
data[5] = 130;//Byte 4: Serial number bits 13-7
data[6] = 165;//Byte 5: Serial number bits 6-0
data[7] = 160;//Byte 6: Software version number
data[8] = 128;//Byte 7: Capabilities:
// byte sum = 0;
// for (int i = 0; i < 9; i++)
// sum += data[i] & 0x7f;
//data[9] = 0x7f - sum; //Checksum = 0x7F - (least-significant 7 bits of ( sum of all data bytes and start byte ) ).
data[9] = 178;//Checksum
data[10] = 15; // all packets end with this identifier
for (unsigned char x = 0; x < 4; x++)
{
for (unsigned char i = 0; i < 11; i++)
Serial.write(data[i]);
}
delay (12);
{
data[0] = 96;//(0x60); // Packet type identifier
data[1] = 0x80 | ((speed >> 3) & 0x7f); // Joystick speed reading (7 MSbs)
data[2] = 0x80 | ((direction >> 3) & 0x7f); // Joystick direction reading (7 MSbs)
data[3] = 0x80 | ((maxSpeedVal >> 1 ) & 0x7f); // SpeedVal pot reading (7 MSbs)
data[4] = 0x80 | ((maxSpeedVal & 0x1) << 6) | ((speed & 0x7) << 3) | (direction & 0x7);
data[5] = 128; // Power ON 128 , Power OFF 132
data[6] = 132; // Start up
data[7] = 128; // chair mode/ drive 128, tilt/aux output 129
// Checksum calculations - thanks to Irving,Jim and Tony
byte sum = 0;
for (int i = 0; i < 8; i++)
sum += data[i] & 0x7f;
data[8] = (255 - (sum & 127));
data[9] = 15; // all packets end with this identifier
for (unsigned char x = 0; x < 4; x++)
{
for (unsigned char i = 0; i < 10; i++)
Serial.write(data[i]);
}
On_Off_State = HIGH;
digitalWrite(led , HIGH);
delay (12);
}
}
bhuja wrote:Is there a PCB schematic of the latest PCB design?
I could try etch a blank PCBI would also suggest using the Nano's pin D1 = TX for the diPin and remove the SoftwareSerial from the sketch.
^Yep I have noted that change.
Thanks for your help.
If your joystick is not centered on power up, it will power on but remain stationary till the values are '0' (192)
The checksum for the coded startup maybe incorrect ....try capturing the ACTUAL startup packet being sent and use that in its entirety.
This is MY captured startup code.
0 pulse 116 130 140 132 128 130 165 160 128 178 15
bhuja wrote:This may be helpful as I did hard code some values as I have no connected it to an external remote controller yet. So I probably need to let to be 0 for a period of time before changing to the hard-coded values.
bhuja wrote:Yep I was able to read my own code to be (in hex)
0x74, 0x82, 0x8C, 0x88, 0x80, 0xB1, 0x85, 0xA7, 0x80, 0x98,0x0F
However, when I send this packet via the Arduino it seems to be having framing errors on the initial startup packet. The next packet detailing the direction and speed is presumed to be sent fine as there are no framing errors and the packet ends with "15" which is expected.
Return to Everything Powerchair