comenzando desde cero (Starting from scratch)

What are you working on .... Show off your Rov's Projects here.
User avatar
bigbadbob
Posts: 272
Joined: Nov 28th, 2011, 10:24 am

Re: comenzando desde cero (Starting from scratch)

Post by bigbadbob »

ok... try a resistor (10k) between pin 6 of the controller and vcc.

When my code is running my ANALOG LED comes on and stays on, I cannot turn it off.

at the start of master void loop()

change this-

if (error == 0)
{
txdata.HLraw = 180;
ETout.sendData();
delay (200);
return;
}

to this-

if (error > 0)
{
txdata.HLraw = 180;// this will make the left motor run if controller fails but txdata is being passed, just for debug.
ETout.sendData();
delay (200);
return;
}
else if (error == 0)
{
ps2x.read_gamepad();

in slave-
void loop_DHT22()
you say... int auxMillis = 0;
anything using "millis" must be an "unsigned long" not an "int", or you get arithmetic errors.
so you need-
unsigned long auxMillis =0;
asesorplaza1
Posts: 187
Joined: Mar 4th, 2018, 6:11 pm
Location: Valverde de Júcar, Cuenca, España

Re: comenzando desde cero (Starting from scratch)

Post by asesorplaza1 »

Buenos días.

Muchas gracias por su tiempo, y su paciencia.

Ya he realizado los cambios en el programa, y he puesto la resistencia DE 10K, en el cable amarillo, ATTENTION.

Ya tenia puesta la resistencia de 10k, en el cable marrón, DATA.

Ahora tengo puestas las dos resistencias.

Lamento tener que decirte que seguimos igual.

En el Monitor Serie del Maestro me dice que no encuentra el mando, que revise los cables, y se para el Monitor Serie, no veo la lista de sensores con sus datos.

En el mando ahora, si aprieto el botón de ANALOG, no pasa nada, antes se encendía, o se apagaba la luz del mando, ahora no.

Estoy observando que las luces de la placa de TX y RX del Maestro, no parpadean, como si parpadea la luz de RX del Esclavo.

El Esclavo sigue sin reaccionar a las órdenes del mando, no hace nada. Y en el Monitor Serie del Esclavo, no veo la lista de sensores, ni sus valores.

Un saludo.



Good morning.

Thank you very much for your time, and your patience.

I have already made the changes to the program, and I have put the 10K resistance, on the yellow cable, ATTENTION.

I had already 10k resistance on the brown cable, DATA.

Now I've got both resistors on.

I'm sorry to have to tell you that we're still the same.

In the Master Series Monitor he tells me that he can't find the controller, to check the cables, and to stop the Serial Monitor, I don't see the list of sensors with his data.

On the controller now, if I press the ANALOG button, nothing happens, it used to turn on, or the controller light would turn off, now it doesn't.

I'm observing that the LIGHTS on the TX and RX Master board do not flash, as if the Slave RX light flashes.

The Slave still doesn't react to command command, does nothing. And in the Slave Series Monitor, I don't see the sensor list, or their values.

Greetings.
Attachments
38_30_04_2020.rar
(15.91 KiB) Downloaded 757 times
User avatar
bigbadbob
Posts: 272
Joined: Nov 28th, 2011, 10:24 am

Re: comenzando desde cero (Starting from scratch)

Post by bigbadbob »

So because the controller is not working, the start of the void loop says error>0 therefore ignore the controller fault and send a left motor run command and "return" to the start without printing serial monitor. so don't worry about the list of sensors not being displayed. this was just for fault finding.
But master txdata is not working either so the left motor run command is not getting to the ROV either.
I want to get this working first and worry about the controller later.

where do you get your 3.3v for the controller from? I use the arduino to supply it.

try defining all your txdata and rxdata declarations as 0 for ints and false for booleans.

like so-
struct RECEIVE_DATA_STRUCTURE { // estructura de mensaje de datos recibidos de los sensores
int BattVolt = 0; // Recibe mensaje de voltaje de batería

etc,etc,etc for master and slave txdata and rxdata.

ooh hang on... I see a big difference between my code and yours. all my button states are boolean.
this is because the ps2 library returns boolean states for the button presses (either true or false) but you use integers 0-1024.
I think you should try changing yours. it is a lot of work but worth it I think.
Just be careful not to change the wrong things.
Analog values must be "int"
Only change the button states in master txdata and slave rxdata not the other values.
then you will need to change the corresponding variable declarations too.
so
master lines- 151-164 and 218-231
slave lines- 204-217 and 234-247
need to be "boolean" and =false
like this-
boolean PSB_PAD_UPstate = false;
etc etc etc...

Then... you will need to change all your "if" and "else" statements for the button states in slave.
if (rxdata.PSB_PAD_UPstate > 0) changes to if (rxdata.PSB_PAD_UPstate)
etc etc etc.....
User avatar
bigbadbob
Posts: 272
Joined: Nov 28th, 2011, 10:24 am

Re: comenzando desde cero (Starting from scratch)

Post by bigbadbob »

bingo!!!!
try-
master line 241: error = ps2x.config_gamepad(13, 11, 10, 12, false, false);
(you have true,true)
asesorplaza1
Posts: 187
Joined: Mar 4th, 2018, 6:11 pm
Location: Valverde de Júcar, Cuenca, España

Re: comenzando desde cero (Starting from scratch)

Post by asesorplaza1 »

Buenos días. El mando lo alimento, como todos los sensores, desde la fuente de alimentación de PC, a 3.5 V.

Ya he realizado los cambios que me dijo, tampoco son tantos.

Lamento tener que decirle otra vez, que estamos igual.

La luz del mando no se enciende, cuando aprieto el botón ANALOG.

Y el resto tampoco funciona.

Un saludo.


Good morning.

The controller feeds it, like all sensors, from the PC power supply to 3.5 V.

I've already made the changes you told me, there aren't that many.

I'm sorry to have to tell you again, that we're the same.

The controller light does not turn on when I press the ANALOG button.

And the rest doesn't work either.

Greetings.
Attachments
39_30_04_2020.rar
(15.91 KiB) Downloaded 750 times
asesorplaza1
Posts: 187
Joined: Mar 4th, 2018, 6:11 pm
Location: Valverde de Júcar, Cuenca, España

Re: comenzando desde cero (Starting from scratch)

Post by asesorplaza1 »

Acabo de ver su ultimo mensaje, en el que me dice de cambiar los true, por false, ya están cambiados.

Lamento tener que decirle otra vez, que estamos igual.

La luz del mando no se enciende, cuando aprieto el botón ANALOG.

Y el resto tampoco funciona.

Un saludo.



I just saw your last message, in which you tell me to change the true, to false, they are already changed.

I'm sorry to have to tell you again, that we're the same.

The controller light does not turn on when I press the ANALOG button.

And the rest doesn't work either.

Greetings.
Attachments
40_30_04_2020.rar
(15.92 KiB) Downloaded 807 times
User avatar
bigbadbob
Posts: 272
Joined: Nov 28th, 2011, 10:24 am

Re: comenzando desde cero (Starting from scratch)

Post by bigbadbob »

Good morning. I just spent 2 hours de-bouncing a switch on my controller. hahaha... going to bed now..
but you could try-

in master, struct SEND_DATA_STRUCTURE and slave, struct RECEIVE_DATA_STRUCTURE
Make the int's =0
and the Booleans = false

try connecting the ps2 red wire to arduino 3.3V and the black wire directly to arduino gnd.
this might be a noisy ground problem.
asesorplaza1
Posts: 187
Joined: Mar 4th, 2018, 6:11 pm
Location: Valverde de Júcar, Cuenca, España

Re: comenzando desde cero (Starting from scratch)

Post by asesorplaza1 »

Buenos días.

Ya he realizado los cambios que me ha dicho tanto en el programa, como en la alimentación del mando.

Vuelvo a tener que lamentar comunicarle que seguimos igual.

La luz del botón ANALOG, no se enciende, y lo demás tampoco funciona.

Un saludo.


Good morning.

I have already made the changes you have told me both in the program and in the power supply of the controller.

I have to regret telling you again that we're still the same.

The ANALOG button light does not turn on, and the rest does not work either.

Greetings.
Attachments
41_01_05_2020.rar
(15.91 KiB) Downloaded 793 times
User avatar
bigbadbob
Posts: 272
Joined: Nov 28th, 2011, 10:24 am

Re: comenzando desde cero (Starting from scratch)

Post by bigbadbob »

Ok... back to basics...
1st-Do you have a spare arduino?
if so, flash it with Bill porters psx2.lib example.
wire up the controller to it and see if it works.

2nd- are you using the ESC BEC to power the arduino? if so don't!!
Disconnect the BEC 5v red wire and wrap tape around it. hahahaha....
I'm like a drowning man clutching at straws now.
That code SHOULD WORK!! :cry:
asesorplaza1
Posts: 187
Joined: Mar 4th, 2018, 6:11 pm
Location: Valverde de Júcar, Cuenca, España

Re: comenzando desde cero (Starting from scratch)

Post by asesorplaza1 »

Buenas tardes.

Voy a adjuntar un bonito archivo Fritzing, que parece un plato de espaguetis, no sé si servirá para aclarar algo, o para terminar de confundirnos a todos.

Es el primer Fritzing que hago, así que no se admiten carcajadas de risa.

No me deja adjuntar la foto de Frizting con mejor resolución, vais a tener que abrirlo en el programa.

El BEC, o ESC, tiene desconectado el cable rojo de la punta que parece el control de un servo, desde el principio, ya sé que el BEC alimenta al receptor, y eso no nos interesa con Arduino.

Solo tengo conectados el cable negro de GND, y el cable blanco en este caso que es el de Datos.

He probado con otros mandos y con otros Arduinos mega 2560, y el sombrero MotorDriveBoard V5.0, y el sombrero PS2X & Motor Shield V1.1, y no consigo que funcione nada.

He probado con un Arduino Uno, y el sombrero PS2X & Motor Shield V1.1 y el sombrero MotorDriveBoard V5.0, y tampoco funciona ningún mando.

Lo único que me queda, es preparar un mando con los cables y conectarlo directamente al Arduino, puesto que con los sombreros, no soy capaz de hacerlo funcionar, aunque debería, porque tengo programas específicos para los sombreros y el mando de PS2.

¿Puede ser, como ya me ha pasado con otros sensores, que la distribución de los pines del mando, no sea igual para el Arduino Mega 2560, que para otro tipo de Arduino, me explico, que por cualquier circunstancia que se nos escapa, en vez de conectar el cable de DATA al pin 12, haya que conectarlo a otro pin?, he puesto Data por nombrar uno, puede ser cualquiera de ellos (Data, Comand, Attention, Clock), o incluso que haya que pincharlos a todos en otros pines.

Un saludo.




Good afternoon.

I'm going to attach a nice Fritzing file, which looks like a plate of spaghetti, I don't know if it'll help clarify something, or to finish confusing us all.

It's the first Fritzing I do, so there's no laughing laugh.

You won't let me attach the frizting photo with better resolution, you're going to have to open it in the program.

The BEC, or ESC, has disconnected the red cable of the tip that looks like the control of a servo, from the beginning, I know that the BEC feeds the receiver, and that does not interest us with Arduino.

I only have connected the black GND cable, and the white cable in this case which is the Data one.

I tried with other controllers and with other Arduinos mega 2560, and the MotorDriveBoard V5.0 hat, and the PS2X hat & Motor Shield V1.1, and I can't get it to work at all.

I tested with an Arduino One, and the PS2X hat & Motor Shield V1.1 and the MotorDriveBoard V5.0 hat, and no controller works either.

All I have left is to prepare a controller with the cables and connect it directly to the Arduino, since with the hats, I am not able to make it work, although I should, because I have specific programs for hats and PS2 command.

Can it be, as has already happened to me with other sensors, that the distribution of the pins of the controller, is not the same for the Arduino Mega 2560, that for another type of Arduino, I explain, that by any circumstance that escapes us, instead of connecting the DATA cable to pin 12, you have to connect it to another pin?, I have put Data to name one , it can be any of them (Data, Comand, Attention, Clock), or even you have to prick them all on other pins.

Greetings.
Attachments
Mi_Circuito_del_ROV_bb reducido.jpg
Mi_Circuito_del_ROV_bb reducido.jpg (78.93 KiB) Viewed 4163 times
Mi_Circuito_del_ROV_esq.rar
(21.32 KiB) Downloaded 674 times
Mi_Circuito_del_ROV.rar
(31.89 KiB) Downloaded 772 times
Post Reply