Putting robotics at your service™

Free shipping on orders over $75

p2 controlled Jeep 1/8 scale

Print view Share :
Previous topicNext topic

Page 1 of 3 [ 37 posts ]

1, 2, 3
Rookie ( offline )
Posts: 25
Posted: 2018-02-15 14:58 
first id like to thank robotshop the the product an having a forum for help

I'm using a lynxmotion ps2 wireless controller, to controller a old monster truck jeep
i scrapped the circuit board an replaced it with a arduino uno. & at the moment I'm using a L289P shield
as the motor driver. 1 motor for forward an backwards, & a Servo for the steering
everything seems to run fine on its own idk if the ps2 analogs are the problem but ill show the serial print for it.
but when i try an talk to the servo i get nothing from the controllers analog when i shift it left to right.
i used a couple different sketches but idk if its something I'm doing wrong while modifying them ill post 1 example

note; that the orang green an brown are the servo wires hooked up on the L289P shield
servo output: an the ps2 controller wires are the 2 yellow brown an blue wire witch
are hooked up on the Lp298P shield pins

Code:
#include <PS2X_lib.h>  //for v1.6
#include <Servo.h>
PS2X ps2x;
int PS2 = 0;

Servo myservo;
int pos = 0;

int offset = 0; // put this with the other global variables (above the void setup() function).
int steer = 127; // put this with the other global variables (above the void setup() function).

void setup() {

PS2 = ps2x.config_gamepad(13, 11, 10, 12, true, false); //Настройка выводов: (clock, command, attention, data, true, true)
myservo.attach(9);  // attaches the servo on pin 9 to the servo objec   //ESC on sigital pin 3
}
void loop()
{
steer = ps2x.Analog(PSS_RX); // read right joystick

if (ps2x.Analog(PSS_RX)) { // trim right
offset += 1;
}
if (ps2x.Analog(PSS_RX)) { // trim left
offset -= 1;
}

steer = steer + offset; // incorporate trim into steer command
if (steer > 180) steer = 180; // enforce upper limit
if (steer < 30) steer = 30; // enforce lower limit

myservo.write(map(steer, 0, 255, 30, 180)); // write steer command
}

Code:
1:FF 43:73 0:5A 1:FF 0:FF
OUT:IN Configure
1:FF 44:F3 0:5A 1:0 3:0 0:0 0:0 0:0 0:0
OUT:IN Configure
1:FF 43:F3 0:5A 0:0 5A:0 5A:0 5A:0 5A:0 5A:0
OUT:IN
1:FF 42:73 0:5A 0:FF 0:FF 0:80 0:7F 0:80 0:7F 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0
OUT:IN
1:FF 42:73 0:5A 0:FF 0:FF 0:80 0:7F 0:80 0:7F 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0
OUT:IN Configure
1:FF 43:73 0:5A 1:FF 0:FF
OUT:IN Configure
1:FF 44:F3 0:5A 1:0 3:0 0:0 0:0 0:0 0:0
OUT:IN Configure
1:FF 43:F3 0:5A 0:0 5A:0 5A:0 5A:0 5A:0 5A:0
OUT:IN
1:FF 42:73 0:5A 0:FF 0:FF 0:80 0:7F 0:80 0:7F 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0
Found Controller, configured successful pressures = false
rumble = false
Try out all the buttons, X will vibrate the controller, faster as you press harder;
holding L1 or R1 will print out the analog stick values.
Note: Go to http://www.billporter.info for updates and to report bugs.
DualShock Controller found OUT:IN

3 pressed
OUT:IN
1:FF 42:73 0:5A 0:FB 0:FF 0:80 0:7F 0:80 0:7F 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0
OUT:IN
1:FF 42:73 0:5A 0:FF 0:FF 0:80 0:FF 0:FF 0:FF 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0
OUT:IN
1:FF 42:73 0:5A 0:FF 0:FF 0:80 0:7F 0:80 0:7F 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0
OUT:IN
1:FF 42:73 0:5A 0:FF 0:FF 0:80 0:7F 0:80 0:7F 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0
OUT:IN
1:FF 42:73 0:5A 0:FB 0:FF 0:80 0:7F 0:80 0:7F 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0
R3 pressed
OUT:IN
1:FF 42:73 0:5A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FF 0:FF 0:FF 0:FF 0:FF
OUT:IN Configure
1:FF 43:FF 0:FF 0:FF 5A:FF 5A:FF 5A:FF 5A:FF 5A:FF
OUT:IN Configure
1:FF 43:41 0:5A 1:FF 0:FF
OUT:IN Configure
1:FF 44:F3 0:5A 1:0 3:0 0:0 0:0 0:0 0:0
OUT:IN Configure
1:FF 43:F3 0:5A 0:0 5A:0 5A:0 5A:0 5A:0 5A:0
OUT:IN
1:FF 42:73 0:5A 0:FF 0:FF 0:80 0:80 0:80 0:80 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0 0:0
OUT:IN
1:FF 42:73 0:5A 0:FF 0:FF 0:80 0:80


Attachment:
Photo on 2-15-18 at 1.41 PM.jpg
Photo on 2-15-18 at 1.41 PM.jpg [ 168.48 KiB | Viewed 231 times ]
Attachment:
Photo on 2-15-18 at 1.40 PM #2.jpg
Photo on 2-15-18 at 1.40 PM #2.jpg [ 261.63 KiB | Viewed 231 times ]
Attachment:
Photo on 2-15-18 at 1.38 PM.jpg
Photo on 2-15-18 at 1.38 PM.jpg [ 248.12 KiB | Viewed 231 times ]
User avatar
Admin ( offline )
Posts: 1607
Posted: 2018-02-19 16:27 
Hi,

The best things to do is to break your issue down into small problems that can be verified independently to ensure all modules are working.

Here are a few points to consider:
1) Test the PS2 independently. To do so, perform the following:
  • Remove anything from the Arduino Uno (including the L298 shield). Only have the PS2 adapter connected to it.
  • Remove any PS2X library version you have currently in your Arduino > libraries folder.
  • Import (in the Arduino IDE) the following library from the Lynxmotion GitHub (download as .zip).
  • Modify the library's .h file to uncomment the two debug #defines (here and here).
  • Compile and upload the example code to your Arduino Uno.
  • Open the serial monitor and see if pressing buttons changes the values displayed on screen.
2) Test the L298 shield on your Arduino Uno independently (remove the PS2 connections and anything else from it). As far as we know, most shields for the L298 expose the interface directly, which is not a servo-type pulse input. Therefore, using the Servo library seems a bit weird, to be honest.

You may want to perform a test using only a digital high / low (maybe alternate every second?) and see if the motor moves properly during those times.

Once those two components work properly individually, then you can integrate and see what else shows up.

Let us know if both #1 and #2 works or if you face any issues. If you do, please post as many details as possible and pictures of the test setup.

Sincerely,

_________________
Sébastien Parent-Charette
Robotics Software Specialist

RobotShop inc.
Putting Robotics at your service!™
www.robotshop.com

Lynxmotion
Imagine it. Build it. Control it.™
http://www.Lynxmotion.com


Rookie ( offline )
Posts: 25
Posted: 2018-02-20 06:33 
Thank u for the feedback an I did happen to get them working I do have pics an vids, an I did run into a little problem, forward an backwards are not accurate not powerful enough to moves the car while it’s on the ground


Rookie ( offline )
Posts: 25
Posted: 2018-02-20 13:28 
Left an right works fine with the controller, but sometimes the controller will loose signal with the receiver when I’m close, further more if I push forward the motor will hesitate an jidder left an right before moving forward, it also acts up when I push the analog the opposite way I have videos but for some reason the messenger won’t let me upload them


Rookie ( offline )
Posts: 25
Posted: 2018-02-20 13:41 
An for the record I got it working right after I made the first post, I would’ve loved it if the forum would have helped me. U have been a help by replying the the feed back Gave recently were great feedbacks unfortunately I got rid of the shield an brought a “H BRIDGE L298N”......... the post I just made is the problem I’m having,


User avatar
Admin ( offline )
Posts: 1607
Posted: 2018-02-20 14:35 
Hi,

Unfortunately, there is no simply way to directly solve such issues (integration issues) without ensuring first that all the components are working directly.

Let us know how that goes!

Sincerely,

_________________
Sébastien Parent-Charette
Robotics Software Specialist

RobotShop inc.
Putting Robotics at your service!™
www.robotshop.com

Lynxmotion
Imagine it. Build it. Control it.™
http://www.Lynxmotion.com


Rookie ( offline )
Posts: 25
Posted: 2018-02-20 15:47 
Everything works fine independently


User avatar
Admin ( offline )
Posts: 1607
Posted: 2018-02-20 15:49 
Then the issue lies in the integration (which is often the case).

The first step would be to make a detailed list of all changes (electrical, connections, code, etc.) that are done to integrate the two setups together.

The key is in one of those changes causing interference with the two parts working properly.

Sincerely,

_________________
Sébastien Parent-Charette
Robotics Software Specialist

RobotShop inc.
Putting Robotics at your service!™
www.robotshop.com

Lynxmotion
Imagine it. Build it. Control it.™
http://www.Lynxmotion.com


Rookie ( offline )
Posts: 25
Posted: 2018-02-20 19:09 
I’ll definitely try what your proposing & again I appreciate the feedback
You’ve been a great help from the beginning. An still are I am thankful for that


User avatar
Admin ( offline )
Posts: 1607
Posted: 2018-02-21 08:32 
Very good. We await more details to help you with this process.

Sincerely,

_________________
Sébastien Parent-Charette
Robotics Software Specialist

RobotShop inc.
Putting Robotics at your service!™
www.robotshop.com

Lynxmotion
Imagine it. Build it. Control it.™
http://www.Lynxmotion.com


Rookie ( offline )
Posts: 25
Posted: 2018-02-22 00:16 
if u could give some advice on a safety command...as far as if the controller disconnects the motors will stop right now i don't have that in place
but my code did change from the first one i posted


here it is


User avatar
Admin ( offline )
Posts: 1607
Posted: 2018-02-22 09:38 
Hey,

Well, that is a very good point! :)

First of all, before you can check the PS2X object, you have to update it (typically at the start of your loop), using something like this.
If you do not run this command, the object is not updated.

Following this, you can then read the buttons and analog values from the object, as seen in the example code.

You use read_gamepad(), you can call the version with two parameters (boolean, byte), which returns a value (boolean) concerning the process. If the read worked, you can tell from the return value. This way, you can detect disconnection/lack of data and instead of reading the object state (buttons, sticks, etc.), you can instead send a stop moving signal (or other things, like "keep as-is") until you get a proper read again.

Sincerely,


P.-S.: You mention "here it is" in your post but nothing is there afterwards and no attachments. Please see the attached image about how to add one to your post (which you can edit).


Attachment:
Forums - Attachments.png
Forums - Attachments.png [ 39.59 KiB | Viewed 177 times ]

_________________
Sébastien Parent-Charette
Robotics Software Specialist

RobotShop inc.
Putting Robotics at your service!™
www.robotshop.com

Lynxmotion
Imagine it. Build it. Control it.™
http://www.Lynxmotion.com
Rookie ( offline )
Posts: 25
Posted: 2018-02-22 15:33 
I'll post pictures,should be consistent with my post


If there way anyway to be more grateful for your feed back I would, seeing that I'm only limited to thank u through the internet. I'll try again to upload the recent progress I've made but I'll give u a run on we're I'm at. The project is not so much about me trying to have a rc car to play with but to have the know how, to utilize these things in many different ways. An can be beneficial seeing that no one around me personally is not in this type of field. So again I appreciate your feedback.



Right now I have a regular rc motor that originally came with the car
I'm going to upgrade that with a 1/10 scale brushless rc motor an 60 amp esc
An a 2cell lipo battery.........with that being said
Right now I'm using a

1:H bridge
2:servo for steering
3:brushed motor for back and forth
4:arduino uno
5: ps2 lynxmotion
6: breadboard for grounding
7: I have a 7.4v 6cell that came originally with the truck but I need a new charger
So I'm forced to use a 6v in witch idk if that's A problem.
Witch powers the h bride
8: I use a portable phone charger to power the arduino an
Controller, I'll also power the servo off of the arduino if need be
Witch is then powered by the portable 5v battery
Everything runs smooth independently.
Once integrated I run into these minor problems.
1: ps2 lynxmotion controller disconnects for a few seconds with
The movement of the joysticks sometimes.
2:motor runs but stalls, an jidders left an right before executing its commands.
3: doesn't look like much power is being fed to the motor nor servo once it's put on the ground or carpet the wheels an motor have a hard time moving , there go it messing up communication.

The motor wires are the bulgy red an black ones that go into the H bridge....
The H bridge itself has a purple ish an blue wire for power witch goes into a breadboard.......the breadboard is powered by the 6v at the moment witch are the brown an white wires on the opposite side of the breadboard......there's a ground connection from the arduino to the breadboard witch is "orange"
I also grounded the servo to the breadboard......
servo connected to the 5v on the servo
An the ps2 is connected to the
3.3v....... ps2 is grounded on the arduino
An using pins 10-13......
The H bride is using pins 2-4

Many things come up.. 1:it could be wires not being connected thoroughly.
2:Code not being perfect. 3:Battery supply. I've indulged so much I can't catch the lil problems an errors,so much circulating in my head.


Rookie ( offline )
Posts: 25
Posted: 2018-02-22 15:35 
Pictures


Attachment:
File comment: Original battery not in use yet
IMG_1939.JPG
IMG_1939.JPG [ 1.28 MiB | Viewed 168 times ]
Attachment:
File comment: Batteries
IMG_1926.JPG
IMG_1926.JPG [ 1.26 MiB | Viewed 168 times ]
Attachment:
File comment: Motor
IMG_3800.PNG
IMG_3800.PNG [ 1.19 MiB | Viewed 168 times ]
Rookie ( offline )
Posts: 25
Posted: 2018-02-22 15:37 
Pictures


Attachment:
File comment: Car sze
IMG_1927.JPG
IMG_1927.JPG [ 978.03 KiB | Viewed 168 times ]
Attachment:
File comment: Car size
IMG_1923.JPG
IMG_1923.JPG [ 1.19 MiB | Viewed 168 times ]
Attachment:
File comment: Arduino Uno
IMG_1933.JPG
IMG_1933.JPG [ 1018.88 KiB | Viewed 168 times ]
Attachment:
File comment: H bridge
IMG_1932.JPG
IMG_1932.JPG [ 1.02 MiB | Viewed 168 times ]
1, 2, 3

All times are UTC - 5 hours [ DST ]. It is currently 2018-04-22 15:49