Please a little help for programming

Anything to do with programing the Arduino Platform.
asesorplaza1
Posts: 187
Joined: Mar 4th, 2018, 6:11 pm
Location: Valverde de Júcar, Cuenca, España

Re: Please a little help for programming

Post by asesorplaza1 »

Contestando a Phila,

Por lo que he podido ver en su código, en la parte del Maestro, solo ha puesto que se reciben los datos del sensor DHT11, no ha incluido las librerías del sensor, entonces yo no lo entiendo, no digo que este mal, digo que yo no lo entiendo, ¿Como reconoce Arduino Maestro, quien (que sensor), le manda los datos, y que tipo de datos o señal, son los datos que le llegan?
Luego usted manda, en el void loop, que en la pantalla LCD se lean los datos de temperatura y humedad del sensor, esto si lo entiendo, pero no se por que se hace(si no hay sensor definido).

Después usted en la parte del Arduino esclavo, si pone la librería del sensor DHT, si define el pin correspondiente, y define el tipo de sensor, por lo tanto esto responde a mis preguntas anteriores, es el Arduino esclavo, quien se encarga de controlar los sensores, y al Maestro solo le manda los datos que el Esclavo ya sabe interpretar.

Por lo que mis sospechas son ciertas, no se programa igual en un sketch sencillo (directo al Arduino), que cuando intervienen un Arduino Maestro y un esclavo, ahora si lo entiendo.

No se lo va a creer, pero llevo mas de seis meses buscando en Internet cual puede ser el problema, sin encontrar solución, e incluso he tenido abiertos los dos sketch juntos para compararlos, y no veía donde podía estar el problema.

Ahora voy a ver si la compilación es correcta, y el problema se ha solucionado.

Muchas gracias por su tiempo



Answering Phila,

As far as I could see in your code, in the Master's part, you only said that the DHT11 sensor data is received, it has not included the sensor libraries, so I do not understand it, I do not say that this is wrong, I say that I do not understand, how does Arduino Maestro, who (what sensor), sends the data, and what kind of data or signal, are the data that comes to him?
Then you send, in the void loop, on the LCD screen to read the temperature and humidity data of the sensor, this if I understand it, but I do not know why it is done (if there is no sensor defined).

Then you in the part of the slave Arduino, if you put the library of the DHT sensor, if you define the corresponding pin, and define the type of sensor, therefore this answers my previous questions, is the Arduino slave, who is responsible for controlling the sensors, and the Master only sends him the data that the Slave already knows how to interpret.

As far as my suspicions are true, it is not programmed the same in a simple sketch (direct to the Arduino), that when an Arduino Maestro and a slave intervene, now I understand it.

He is not going to believe it, but I have been searching the Internet for more than six months to find out what the problem might be, without finding a solution, and I have even had the two skits open together to compare them, and I did not see where the problem could be.

Now I will see if the compilation is correct, and the problem has been solved.

Thank you very much for your time
asesorplaza1
Posts: 187
Joined: Mar 4th, 2018, 6:11 pm
Location: Valverde de Júcar, Cuenca, España

Re: Please a little help for programming

Post by asesorplaza1 »

Un saludo a todo el mundo
Bueno pues como no, me he vuelto a atascar, con la programación de Arduino, os cuento mis problemas
Hasta ahora, he ido incorporando sensor a sensor, de uno en uno, primero haciendo la conexión solo del sensor nuevo en una placa y en un programa nuevo.
Después lo he conectado en un Arduino, y mediante la Comunicación Serie, por los pines RX y TX, a otro Arduino, para comprobar que el montaje funciona, y que puedo ver los datos a través del Monitor Serie.
Y luego incorporándolo al programa donde están el resto de instrucciones, tanto en el Arduino Maestro, como en el Esclavo, y conectándolo en su sitio, para comprobar que funciona.

Esto me ha ido funcionando bien, hasta que de repente ha dejado de funcionar, sin que pueda encontrar una explicación coherente al porque del fallo.
De pronto ha dejado de reaccionar a las órdenes del mando de la PS2, y no es porque las baterías del mando estén gastadas, como alguno me puede indicar, ha sido al incorporar el giroscopio, y creo que hay alguna orden que está interfiriendo en el programa, y no encuentro cual es, en principio no hay ningún pin de Arduino que en el programa haga dos funciones, he comprobado la instalación eléctrica del circuito varias veces y creo poder asegurar que no hay ningún fallo de conexión, me inclino mas a un problema de programación.
Con el programa del Esclavo, si puedo ver los datos en el Monitor Serie, y son bastante coherentes, me da la temperatura de los 4 sensores, la humedad de los tres DHT22, me marca el voltaje de la batería.
Pero el sensor de infrarrojos no marca bien, aleatoriamente marca la proximidad de un objeto o no, sin que se corte la luz del sensor.
Y los datos del giroscopio no varían según la inclinación, están fijos en un número.
Y el monitor Serie del Maestro, va a su aire, o no marca nada, o solo imprime las líneas de texto sin ningún valor, o muestra datos aleatorios de los sensores y el fallo de alguno de ellos.
Ya he probado a cambiar los dos Arduinos, y a cambiar el mando, por si fuese algún fallo de estos, pero nada no consigo arreglarlo.
También he probado a separar los datos por bloques y que los datos que se mandan al Monitor Serie, se manden por el canal del USB, y los datos que tiene que recibir el otro Arduino se manden por el canal 3, con las órdenes siguentes

Serial.begin(57600); // comienza Serial para hablar con el Arduino esclavo a 9600 Baudios
Serial3.begin(57600); // Comienza la comunicación Serie en el puerto 1, pines 14 y 15 ***
ETin.begin(details(rxdata), &Serial3); // Comienza la recepción de datos a través de Serial, en los pines 14 y 15 ***
ETout.begin(details(txdata), &Serial3); // Comienza el envió de datos a través de Serial, en los pines 14 y 15 ***

Adjunto los dos programas, todas las librerías utilizadas, el boceto de Frizting de las conexiones, y un pdf, de cómo se verá en un futuro espero que no muy lejano, el diseño de la pantalla Nextion, y por supuesto me ofrezco a aclarar cualquier duda que tengáis sobre el proyecto y que no haya explicado bien en este comentario.


Greetings to everyone
Well, of course, I've gotten stuck again, with Arduino programming, I'm telling you my problems
So far, I've been incorporating sensor to sensor, one at a time, first connecting only the new sensor on a board and in a new program.
Then I connected it in an Arduino, and through Serial Communication, by the RX and TX pins, to another Arduino, to check that the assembly works, and that I can see the data through the Serial Monitor.
And then incorporating it into the program where the rest of the instructions are, both in the Arduino Maestro, and in the Slave, and connecting it in place, to check that it works.

This has worked well for me, until it has suddenly stopped working, without being able to find a coherent explanation why the fault.
Suddenly he has stopped reacting to the commands of the PS2, and it is not because the batteries of the controller are worn out, as some can indicate, it has been by incorporating the gyroscope, and I think that there is some order that is interfering in the program, and I do not find what it is, in principle there is no Arduino pin that in the program does two functions, I have checked the electrical installation of the circuit several times and I think I can ensure that there is no connection failure, I lean more to a programming problem.
With the Slave program, if I can see the data on the Serial Monitor, and they are quite consistent, it gives me the temperature of the 4 sensors, the humidity of the three DHT22, marks the battery voltage.
But the infrared sensor does not mark well, it randomly marks the proximity of an object or not, without cutting off the sensor light.
And the gyroscope data doesn't vary depending on the tilt, it's fixed in a number.
And the Master Series monitor, goes to your air, or marks nothing, or just prints the lines of text without any value, or displays random sensor data and the failure of any of them.
I've already tried to change the two Arduinos, and change the controller, in case it was any failure of these, but nothing I can fix it.
I have also tried to separate the data by blocks and that the data that is sent to the Serial Monitor, is sent over the USB channel, and the data that the other Arduino has to receive is sent by channel 3, with the following commands

Serial.begin(57600); Serial starts to talk to the slave Arduino at 9600 Baudios
Serial3.begin(57600); Serial communication begins on port 1, pins 14 and 15 ***
ETin.begin(details(rxdata), &Serial3); Start receiving data via Serial, at pins 14 and 15 ***
ETout.begin(details(txdata), &Serial3); Start sending data via Serial, on pins 14 and 15 ***

I attach the two programs, all the libraries used, Frizting's sketch of the connections, and a pdf, of what it will look like in the future I hope not too far away, the design of the Nextion screen, and of course I offer to clarify any doubts you have about the project and that he hasn't explained well in this comment
Attachments
02_Esclavo_28_03_2020_arreglando_Mando_PS2.rar
Este es el programa del Arduino que esta dentro del ROV

This is the Arduino program that is inside the ROV
(6.58 KiB) Downloaded 407 times
01_Maestro_28_03_2020_arreglando_Mando_PS2.rar
Este es el programa del Arduino que esta en la superficie

This is the Arduino program that is on the surface
(5.95 KiB) Downloaded 405 times
asesorplaza1
Posts: 187
Joined: Mar 4th, 2018, 6:11 pm
Location: Valverde de Júcar, Cuenca, España

Re: Please a little help for programming

Post by asesorplaza1 »

En la publicación anterior no me ha dejado adjuntar mas archivos, los adjunto ahora.

In the previous post you didn't let me attach any more files, the attachments now.
Attachments
Librerias.rar
Este es el archivo con todas las librerías utilizadas en el proyecto

This is the file with all the libraries used in the project
(263.6 KiB) Downloaded 413 times
01 Prueba Pantalla.pdf
Este es el archivo de la presentación de como quiero que quede la pantalla Nextion

This is the presentation file of how I want the Nextion screen to look
(388.93 KiB) Downloaded 414 times
Post Reply