Finished 2DOF 12V DC wiper arduino playseat

Running simulator build projects.
Please use the image gallery for your pictures, a short tutorial can be found here.
The first image in the first post will be shown in the project gallery.

Re: Finished 2DOF 12V DC wiper arduino playseat

Postby tastelife » Tue 26. Apr 2016, 19:53

Hi. You have a great job. I really like it.

But I would like to ask, why did you use seperate computers? Is it possible to use this simulator with 1 computer rather than 2 different pcs?
Any disadvantages?

Thank you.
tastelife
 
Posts: 1
Joined: Tue 26. Apr 2016, 19:47
Has thanked: 0 time
Been thanked: 0 time

Re: Finished 2DOF 12V DC wiper arduino playseat

Postby damar » Sat 30. Apr 2016, 17:27

appreciated your share and experence!
The playseat is very good inspired me.
Burn the sky!
damar
 
Posts: 4
Joined: Sun 10. Apr 2016, 12:12
Has thanked: 1 time
Been thanked: 0 time

Re: Finished 2DOF 12V DC wiper arduino playseat

Postby RacingMat » Tue 7. Jun 2016, 17:04

guirrou wrote:Greetings

I start following your path to build a 2 dof simulator, i'm wondering if i can use only one laptop for the game and x-sim.
I will appreciate if you can send me some help or tutorial more than what i find in internet.

Best Regards
Guirrou Hamza

Hello!

Yes, one computer is enough.
What help do you need? How advanced is your project?
Mat
2 DOF playseat : arduino, motomonster, 12V truck wiper motors
http://www.x-sim.de/forum/viewtopic.php?f=37&t=943
User avatar
RacingMat
X-Sim Stage 2 edition
 
Posts: 453
Images: 147
Joined: Wed 20. Feb 2013, 21:30
Location: Marseille - FRANCE
Has thanked: 4 times
Been thanked: 122 times

Re: Finished 2DOF 12V DC wiper arduino playseat

Postby Chetan » Wed 20. Jul 2016, 23:26

Hello Guys...

I am Chetan, and right now I am building a 2 DOF racing motion seat simulator. And I am using X-sim software, JRK 12 v 12 Pololu microcontrollers and potentiometer for the feedback.
And I did all the necessary connections and configurations according to the links on the website...
Pololu and X-sim quick guide...

But now I am facing few problems...
1) Even though I am getting the input values in the X-sim converter, the motors are not moving according to these virtual values.
The motors move only if I slightly rotate the potentiometer, and stop as soon as I stop rotating the potentiometer.
2) And sometimes they keep vibrating at the target value (given in Jrk configuration utility), and after 20 to 25 seconds, the motor stops because of the error "Motor drive error". Intially I thought this might be because of over heating, so I used a fan. But still the error exists.
I am stuck and don't know what to do ahead, So guys please help me out.
I will even upload a pic so that you guys get an idea...

Note: Everything is running on the same computer..(Extractor, Converter...Jrk configuration utility and the game) will this be a problem..?
Attachments
Chetan
 
Posts: 1
Joined: Wed 20. Jul 2016, 23:22
Has thanked: 0 time
Been thanked: 0 time

Re: Finished 2DOF 12V DC wiper arduino playseat

Postby zgseat » Wed 27. Jul 2016, 07:50

Thanks a lots.

I also started to build a play seat using wiper motor and Arduino. Your post will help me, thanks.
zgseat
 
Posts: 6
Joined: Wed 27. Jul 2016, 07:35
Has thanked: 2 times
Been thanked: 0 time

Re: Finished 2DOF 12V DC wiper arduino playseat

Postby RacingMat » Thu 11. Aug 2016, 18:15

@Chetan : sorry I don't know JRK...

@gzseat : that's cool! eager to see your work :)
2 DOF playseat : arduino, motomonster, 12V truck wiper motors
http://www.x-sim.de/forum/viewtopic.php?f=37&t=943
User avatar
RacingMat
X-Sim Stage 2 edition
 
Posts: 453
Images: 147
Joined: Wed 20. Feb 2013, 21:30
Location: Marseille - FRANCE
Has thanked: 4 times
Been thanked: 122 times

Re: Finished 2DOF 12V DC wiper arduino playseat

Postby saad » Wed 17. Aug 2016, 23:32

You can help me image
Then in Xsim Profiler / Output / port com

serial Port configuration :
select the right arduino's COM Port
saad
 
Posts: 3
Joined: Sat 17. Jan 2015, 00:40
Has thanked: 0 time
Been thanked: 0 time

Re: Finished 2DOF 12V DC wiper arduino playseat

Postby barakeychetan » Fri 19. Aug 2016, 20:33

Hello Guys,

I am Chetan, and I am doing 2 DOF using x sim, arduino and Pololu simple motor controller 18v25. I did all the connections and everything, and there is no error in the program but still the motors are not running...:( so can you guys please help me out with this program. Is there anybody who did this on Pololu motor controller....?

Its the same program by racingmat...but changed accordingly to pololu motor controllers....

#include <SoftwareSerial.h>
#define BRAKEVCC 0
#define STOP 0
#define BRAKEGND 3

////////////////////////////////////////////////////////////////////////////////
#define pwmMax 255 // or less, if you want to lower the maximum motor's speed

// defining the range of potentiometer's rotation
const int potMini=20;
const int potMaxi=620;

////////////////////////////////////////////////////////////////////////////////
#define motLeft 0
#define motRight 1
#define potL A0
#define potR A5


int DataValueL=512; //middle position 0-1024
int DataValueR=512; //middle position 0-1024



#define rxPin1 3 // pin 3 connects to smcSerial TX (not used in this example)
#define txPin1 4 // pin 4 connects to smcSerial RX
SoftwareSerial smcSerial1(rxPin1, txPin1);
#define rxPin2 7 // pin 3 connects to smcSerial TX (not used in this example)
#define txPin2 8 // pin 4 connects to smcSerial RX
SoftwareSerial smcSerial2(rxPin2, txPin2);


////////////////////////////////////////////////////////////////////////////////
// INITIALIZATION
////////////////////////////////////////////////////////////////////////////////

// required to allow motors to move
// must be called when controller restarts and after any error
void exitSafeStart()
{
smcSerial1.write(0x83);
smcSerial2.write(0x83);
}

void setup()
{
// initialize software serial object with baud rate of 19.2 kbps
smcSerial1.begin(19200);
smcSerial2.begin(19200);

// the Simple Motor Controller must be running for at least 1 ms
// before we try to send serial data, so we delay here for 5 ms
delay(5);

// if the Simple Motor Controller has automatic baud detection
// enabled, we first need to send it the byte 0xAA (170 in decimal)
// so that it can learn the baud rate
smcSerial1.write(0xAA); // send baud-indicator byte
smcSerial2.write(0xAA);
// next we need to send the Exit Safe Start command, which
// clears the safe-start violation and lets the motor run
exitSafeStart(); // clear the safe-start violation and let the motor run
}


////////////////////////////////////////////////////////////////////////////////
///////////////////////////////// Main Loop ////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
void loop()
{
int sensorL,sensorR;

readSerialData(); // DataValueR & L contain the last order received (if there is no newer received, the last is kept)
// the previous order will still be used by the PID regulation MotorMotion Function

sensorR = analogRead(potR); // range 0-1024
sensorL = analogRead(potL); // range 0-1024

motorMotion(motRight,sensorR,DataValueR);
motorMotion(motLeft,sensorL,DataValueL);
}
////////////////////////////////////////////////////////////////////////////////
// Procedure: wait for complete trame
////////////////////////////////////////////////////////////////////////////////
void readSerialData()
{
byte Data[3]={
'0','0','0' };
// keep this function short, because the loop has to be short to keep the control over the motors

if (Serial.available()>2){
//parse the buffer : test if the byte is the first of the order "R"
Data[0]=Serial.read();
if (Data[0]=='L'){
Data[1]=Serial.read();
Data[2]=Serial.read();
// call the function that converts the hexa in decimal and that maps the range
DataValueR=NormalizeData(Data);
}
if (Data[0]=='R'){
Data[1]=Serial.read();
Data[2]=Serial.read();
// call the function that converts the hexa in decimal and maps the range
DataValueL=NormalizeData(Data);

}
}
if (Serial.available()>16) Serial.flush();
}
////////////////////////////////////////////////////////
void motorMotion(int numMot,int actualPos,int targetPos)
////////////////////////////////////////////////////////
{
int Tol=20; // no order to move will be sent to the motor if the target is close to the actual position
// this prevents short jittering moves
//could be a parameter read from a pot on an analogic pin
// the highest value, the calmest the simulator would be (less moves)

int gap;
int pwm;
int brakingDistance=30;

// security concern : targetPos has to be within the mechanically authorized range
targetPos=constrain(targetPos,potMini+brakingDistance,potMaxi-brakingDistance);

gap=abs(targetPos-actualPos);

if (gap<= Tol) {
motorOff(numMot); //too near to move
}
else {
// PID : calculates speed according to distance
pwm=195;
if (gap>50) pwm=215;
if (gap>75) pwm=235;
if (gap>100) pwm=255;
pwm=map(pwm, 0, 255, 0, 3200); //adjust the value according to pwmMax for mechanical debugging purpose !

// if motor is outside from the range, send motor back to the limit !
// go forward (up)
if ((actualPos<potMini) || (actualPos<targetPos)) motorGo(numMot, pwm);
// go reverse (down)
if ((actualPos>potMaxi) || (actualPos>targetPos)) motorRev(numMot, pwm);

}
}


////////////////////////////////////////////////////////////////////////////////
void motorOff(int motor){ //Brake Ground : free wheel actually
////////////////////////////////////////////////////////////////////////////////
smcSerial1.write(0xE0);
smcSerial2.write(0xE0);
//analogWrite(pwmpin[motor], 0);
}

void motorGo(uint8_t motor, int speed)

{
if (motor == 0)
{ smcSerial2.write(0x85); // full-speed forward
smcSerial2.write(speed & 0x1F);
smcSerial2.write(speed >> 5);
}
else
{ smcSerial1.write(0x85); // full-speed forward
smcSerial1.write(speed & 0x1F);
smcSerial1.write(speed >> 5);
}
}


void motorRev(uint8_t motor, int speed)

{
if (motor == 0)
{ smcSerial2.write(0x86); // full-speed forward
smcSerial2.write(speed & 0x1F);
smcSerial2.write(speed >> 5);
}
else
{ smcSerial1.write(0x86); // full-speed forward
smcSerial1.write(speed & 0x1F);
smcSerial1.write(speed >> 5);
}

}



////////////////////////////////////////////////////////////////////////////////
// Function: convert Hex to Dec
////////////////////////////////////////////////////////////////////////////////
int NormalizeData(byte x[3])
////////////////////////////////////////////////////////////////////////////////
{
int result;

if ((x[2]==13) || (x[2]=='R') || (x[2]=='L')) //only a LSB and Carrier Return or 'L' or 'R' in case of value below 16 (ie one CHAR and not 2)
{
x[2]=x[1]; //move MSB to LSB
x[1]='0'; //clear MSB
}
for (int i=1; i<3; i++)
{
if (x[i]>47 && x[i]<58 ){//for x0 to x9
x[i]=x[i]-48;
}
if (x[i]>64 && x[i]<71 ){//for xA to xF
x[i]=(x[i]-65)+10;
}
}
// map the range from Xsim (0 <-> 255) to the mechanically authorized range (potMini <-> potMaxi)
result=map((x[1]*16+x[2]),0,255,potMini,potMaxi);
return result;
}
barakeychetan
 
Posts: 3
Joined: Fri 19. Aug 2016, 20:08
Has thanked: 1 time
Been thanked: 0 time

Re: Finished 2DOF 12V DC wiper arduino playseat

Postby barakeychetan » Fri 19. Aug 2016, 20:39

And I have one more doubt....

I have attached the motor specifications (I am using 2 motors, Current 23A)...if at all I decide to use motomonster, will I need only 1 motomonster or 2...?
Attachments
barakeychetan
 
Posts: 3
Joined: Fri 19. Aug 2016, 20:08
Has thanked: 1 time
Been thanked: 0 time

Re: Finished 2DOF 12V DC wiper arduino playseat

Postby RacingMat » Sat 20. Aug 2016, 13:13

2 motomonster for your 2 motors because of high current: wire in parallel the 2 chips of the board

Use a fuse to protect your Hbridge ;)
2 DOF playseat : arduino, motomonster, 12V truck wiper motors
http://www.x-sim.de/forum/viewtopic.php?f=37&t=943
User avatar
RacingMat
X-Sim Stage 2 edition
 
Posts: 453
Images: 147
Joined: Wed 20. Feb 2013, 21:30
Location: Marseille - FRANCE
Has thanked: 4 times
Been thanked: 122 times

PreviousNext

Return to Motion simulator Projects in progress

Who is online

Users browsing this forum: No registered users and 2 guests