
JeysonZG1426460013
-
Content Count
2 -
Joined
-
Last visited
Reputation Activity
-
JeysonZG1426460013 reacted to bluehash in [Energia Library] Ping4Pins: For 4-pins and 3-pins PING sensor
@@JeysonZG Welcome to Stellarisiti and thank you for sharing your code!
Your English is good.
-
JeysonZG1426460013 reacted to energia in [Energia Library] Ping4Pins: For 4-pins and 3-pins PING sensor
Thanks for sharing @@JeysonZG this awesome library! I will definitely be using this in my Rover project!
Robert
-
JeysonZG1426460013 got a reaction from reaper7 in [Energia Library] Ping4Pins: For 4-pins and 3-pins PING sensor
- INTRODUCTION
Hi everybody, I want to share a library for controlling a 4-pins PING sensor (HC-SR04 ICStation) basically, although you can also control the 3-pins PING))) sensor conventional of Parallax (URL).
This library is a modification of the Caleb Zulawski's library for PING))) sensors. I made basic improvements in calculations, I added a function to calculate the distance in millimeters and added the option to change the "input trigger signal" [10uS for HC-SR04 and 5uS for PING)))]
- CHANGE LOG
v2.1 (26/08/2014)
* Fixed calculations of distance in inches.
v2.0 (25/08/2014)
* Fixed problems with measurements adjustments.
* New function for modification of a single unit.
v1.0 (24/08/2014)
* Basic modification of Caleb Zulawski's library.
* Added the calculation of distace in millimeters.
* Identified problems with measurements adjustments.
- TESTING
Tested on: Tiva C (TM4C123GXL) & Arduino UNO R3
- COMPARISON SECTION
A small comparison between the 2 sensors is:
* HC-SR04 sensor:
1. Working Voltage: 5V (DC)
2. Output signal: Electric frequency signal, high level 5V, 0V low level.
3. Sensor angle: Not more than 15 degrees.
4. Detection distance: 2cm-450cm.
5. High precision: Up to 0.3cm
6. Input trigger signal: TTL impulse 10uS
7. Mode of connection:
1. VCC
2. TRIG ( T )
3. ECHO ( R )
4. GND
* PING))) sensor:
1. Working Voltage: 5V (DC)
2. Output signal: Electric frequency signal, high level 5V, 0V low level.
3. Sensor angle: Not more than 15 degrees.
4. Detection distance: 2cm-300cm.
5. High precision: Up to 0.3cm
6. Input trigger signal: TTL impulse 5us
7. Mode of connection:
1. GND
2. VCC
3. SG
- DOWNLOAD SECTION
v2.1: Ping4Pins v2.1.zip
v2.0 (Not recommended): Ping4Pins v2.0.zip
v1.0 (Not recommended): Ping4Pins v1.0.zip
- INSTRUCTIONS OF INSTALLATION
1. Download the latest version of the library
2. Unzip the zip-folder.
3. Copy the "Ping4Pins" folder in the location of the libraries depending of your trainer:
* For Arduino: <Arduino IDE directory>\hardware\libraries\
* For Tiva C: <Energia IDE directory>\hardware\lm4f\libraries\
Note: If you used an older version of the library, I recommend deleting the folder and copy the new folder "Ping4Pins".
- EXAMPLES SECTION
In the "examples" folder are 5 examples for Arduino and 5 examples for Tiva. I'll post the example # 1:
/* Example # 1 for TivaC / Arduino Created by Jeyson Zuñiga Gomez (https://fb.me/jeysonzg) E-mail: ingjeysonzg@hotmail.com English: In this example, we will use the basic form of the Ping4Pins library. Español: En este ejemplo, vamos a utilizar la forma básica de la libreria Ping4Pins */ // English: We include the library that we will use, in this case Ping4Pins // Español: Incluimos la librería que vamos a usar, en este caso Ping4Pins #include <Ping4Pins.h> // English: Define Trigger and Echo pins // Español: Definimos los pines "Trigger" y "Echo" #define TriggerPin PF_4 #define EchoPin PD_7 // English: For Arduino use: // Español: Para Arduino usa: #define TriggerPin 8 #define EchoPin 7 // English: Create the ping variable with the builder Ping4Pins class and call the function Ping4Pins // Function: Ping4Pins(int Pin_Trigger, int Pin_Echo) // Español: Creamos la variable ping con el constructor de la clase Ping4Pins y llamamos a la funcion Ping4Pins // Funcion: Ping4Pins(int Pin_Trigger, int Pin_Echo) Ping4Pins ping = Ping4Pins(TriggerPin, EchoPin); void setup(){ // English: We start the serial monitor at a speed of 9600 baud // Español: Iniciamos el monitor serial a una velocidad de 9600 baudios Serial.begin(9600); } void loop(){ // English: We call the function "play", without parameters, of our Ping4Pins class. // Here the input trigger signal is 10us default. // Español: Llamamos a la funcion "play", sin parametros, de nuestra clase Ping4Pins. // Aqui la señal de entrada del disparo es de 10us por defecto. ping.play(); // English: We show in the IDE serial monitor the measurement in // microseconds, inches, centimeters and millimeters, respectively. // Español: Mostramos en el monitor serial del IDE la medicion en // microsegundos, pulgadas, centimetros y milimetros, respectivamente. Serial.print("Microseconds: "); Serial.print(ping.microseconds()); Serial.println(" uS"); Serial.print("Inches: "); Serial.print(ping.inches()); Serial.println(" in"); Serial.print("Centimeters: "); Serial.print(ping.centimeters()); Serial.println(" cms"); Serial.print("Milimeters: "); Serial.print(ping.milimeters()); Serial.println(" mm"); Serial.println(); delay(500); } - IMAGES SECTION
Image 1.
Image 2.
Image 3.
Image 4.
NOTE 1: In Tiva we use digital pin PF_4 for TRIGGER and digital pin PD_7 for ECHO.
In Arduino we use the digital pin # 8 for TRIGGER y digital pin # 7 for ECHO.
NOTE 2: For use 3-pins PING))) Sensor with this library, declare TRIGGER and ECHO as same PIN DIGITAL.
NOTE 3: Please excuse my English, I'm Colombian and my English is not very good
-
JeysonZG1426460013 got a reaction from bluehash in [Energia Library] Ping4Pins: For 4-pins and 3-pins PING sensor
- INTRODUCTION
Hi everybody, I want to share a library for controlling a 4-pins PING sensor (HC-SR04 ICStation) basically, although you can also control the 3-pins PING))) sensor conventional of Parallax (URL).
This library is a modification of the Caleb Zulawski's library for PING))) sensors. I made basic improvements in calculations, I added a function to calculate the distance in millimeters and added the option to change the "input trigger signal" [10uS for HC-SR04 and 5uS for PING)))]
- CHANGE LOG
v2.1 (26/08/2014)
* Fixed calculations of distance in inches.
v2.0 (25/08/2014)
* Fixed problems with measurements adjustments.
* New function for modification of a single unit.
v1.0 (24/08/2014)
* Basic modification of Caleb Zulawski's library.
* Added the calculation of distace in millimeters.
* Identified problems with measurements adjustments.
- TESTING
Tested on: Tiva C (TM4C123GXL) & Arduino UNO R3
- COMPARISON SECTION
A small comparison between the 2 sensors is:
* HC-SR04 sensor:
1. Working Voltage: 5V (DC)
2. Output signal: Electric frequency signal, high level 5V, 0V low level.
3. Sensor angle: Not more than 15 degrees.
4. Detection distance: 2cm-450cm.
5. High precision: Up to 0.3cm
6. Input trigger signal: TTL impulse 10uS
7. Mode of connection:
1. VCC
2. TRIG ( T )
3. ECHO ( R )
4. GND
* PING))) sensor:
1. Working Voltage: 5V (DC)
2. Output signal: Electric frequency signal, high level 5V, 0V low level.
3. Sensor angle: Not more than 15 degrees.
4. Detection distance: 2cm-300cm.
5. High precision: Up to 0.3cm
6. Input trigger signal: TTL impulse 5us
7. Mode of connection:
1. GND
2. VCC
3. SG
- DOWNLOAD SECTION
v2.1: Ping4Pins v2.1.zip
v2.0 (Not recommended): Ping4Pins v2.0.zip
v1.0 (Not recommended): Ping4Pins v1.0.zip
- INSTRUCTIONS OF INSTALLATION
1. Download the latest version of the library
2. Unzip the zip-folder.
3. Copy the "Ping4Pins" folder in the location of the libraries depending of your trainer:
* For Arduino: <Arduino IDE directory>\hardware\libraries\
* For Tiva C: <Energia IDE directory>\hardware\lm4f\libraries\
Note: If you used an older version of the library, I recommend deleting the folder and copy the new folder "Ping4Pins".
- EXAMPLES SECTION
In the "examples" folder are 5 examples for Arduino and 5 examples for Tiva. I'll post the example # 1:
/* Example # 1 for TivaC / Arduino Created by Jeyson Zuñiga Gomez (https://fb.me/jeysonzg) E-mail: ingjeysonzg@hotmail.com English: In this example, we will use the basic form of the Ping4Pins library. Español: En este ejemplo, vamos a utilizar la forma básica de la libreria Ping4Pins */ // English: We include the library that we will use, in this case Ping4Pins // Español: Incluimos la librería que vamos a usar, en este caso Ping4Pins #include <Ping4Pins.h> // English: Define Trigger and Echo pins // Español: Definimos los pines "Trigger" y "Echo" #define TriggerPin PF_4 #define EchoPin PD_7 // English: For Arduino use: // Español: Para Arduino usa: #define TriggerPin 8 #define EchoPin 7 // English: Create the ping variable with the builder Ping4Pins class and call the function Ping4Pins // Function: Ping4Pins(int Pin_Trigger, int Pin_Echo) // Español: Creamos la variable ping con el constructor de la clase Ping4Pins y llamamos a la funcion Ping4Pins // Funcion: Ping4Pins(int Pin_Trigger, int Pin_Echo) Ping4Pins ping = Ping4Pins(TriggerPin, EchoPin); void setup(){ // English: We start the serial monitor at a speed of 9600 baud // Español: Iniciamos el monitor serial a una velocidad de 9600 baudios Serial.begin(9600); } void loop(){ // English: We call the function "play", without parameters, of our Ping4Pins class. // Here the input trigger signal is 10us default. // Español: Llamamos a la funcion "play", sin parametros, de nuestra clase Ping4Pins. // Aqui la señal de entrada del disparo es de 10us por defecto. ping.play(); // English: We show in the IDE serial monitor the measurement in // microseconds, inches, centimeters and millimeters, respectively. // Español: Mostramos en el monitor serial del IDE la medicion en // microsegundos, pulgadas, centimetros y milimetros, respectivamente. Serial.print("Microseconds: "); Serial.print(ping.microseconds()); Serial.println(" uS"); Serial.print("Inches: "); Serial.print(ping.inches()); Serial.println(" in"); Serial.print("Centimeters: "); Serial.print(ping.centimeters()); Serial.println(" cms"); Serial.print("Milimeters: "); Serial.print(ping.milimeters()); Serial.println(" mm"); Serial.println(); delay(500); } - IMAGES SECTION
Image 1.
Image 2.
Image 3.
Image 4.
NOTE 1: In Tiva we use digital pin PF_4 for TRIGGER and digital pin PD_7 for ECHO.
In Arduino we use the digital pin # 8 for TRIGGER y digital pin # 7 for ECHO.
NOTE 2: For use 3-pins PING))) Sensor with this library, declare TRIGGER and ECHO as same PIN DIGITAL.
NOTE 3: Please excuse my English, I'm Colombian and my English is not very good
-
JeysonZG1426460013 reacted to JeysonZG1426460013 in [Energia Library] Ping4Pins: For 4-pins and 3-pins PING sensor
- INTRODUCTION
Hi everybody, I want to share a library for controlling a 4-pins PING sensor (HC-SR04 ICStation) basically, although you can also control the 3-pins PING))) sensor conventional of Parallax (URL).
This library is a modification of the Caleb Zulawski's library for PING))) sensors. I made basic improvements in calculations, I added a function to calculate the distance in millimeters and added the option to change the "input trigger signal" [10uS for HC-SR04 and 5uS for PING)))]
- CHANGE LOG
v2.1 (26/08/2014)
* Fixed calculations of distance in inches.
v2.0 (25/08/2014)
* Fixed problems with measurements adjustments.
* New function for modification of a single unit.
v1.0 (24/08/2014)
* Basic modification of Caleb Zulawski's library.
* Added the calculation of distace in millimeters.
* Identified problems with measurements adjustments.
- TESTING
Tested on: Tiva C (TM4C123GXL) & Arduino UNO R3
- COMPARISON SECTION
A small comparison between the 2 sensors is:
* HC-SR04 sensor:
1. Working Voltage: 5V (DC)
2. Output signal: Electric frequency signal, high level 5V, 0V low level.
3. Sensor angle: Not more than 15 degrees.
4. Detection distance: 2cm-450cm.
5. High precision: Up to 0.3cm
6. Input trigger signal: TTL impulse 10uS
7. Mode of connection:
1. VCC
2. TRIG ( T )
3. ECHO ( R )
4. GND
* PING))) sensor:
1. Working Voltage: 5V (DC)
2. Output signal: Electric frequency signal, high level 5V, 0V low level.
3. Sensor angle: Not more than 15 degrees.
4. Detection distance: 2cm-300cm.
5. High precision: Up to 0.3cm
6. Input trigger signal: TTL impulse 5us
7. Mode of connection:
1. GND
2. VCC
3. SG
- DOWNLOAD SECTION
v2.1: Ping4Pins v2.1.zip
v2.0 (Not recommended): Ping4Pins v2.0.zip
v1.0 (Not recommended): Ping4Pins v1.0.zip
- INSTRUCTIONS OF INSTALLATION
1. Download the latest version of the library
2. Unzip the zip-folder.
3. Copy the "Ping4Pins" folder in the location of the libraries depending of your trainer:
* For Arduino: <Arduino IDE directory>\hardware\libraries\
* For Tiva C: <Energia IDE directory>\hardware\lm4f\libraries\
Note: If you used an older version of the library, I recommend deleting the folder and copy the new folder "Ping4Pins".
- EXAMPLES SECTION
In the "examples" folder are 5 examples for Arduino and 5 examples for Tiva. I'll post the example # 1:
/* Example # 1 for TivaC / Arduino Created by Jeyson Zuñiga Gomez (https://fb.me/jeysonzg) E-mail: ingjeysonzg@hotmail.com English: In this example, we will use the basic form of the Ping4Pins library. Español: En este ejemplo, vamos a utilizar la forma básica de la libreria Ping4Pins */ // English: We include the library that we will use, in this case Ping4Pins // Español: Incluimos la librería que vamos a usar, en este caso Ping4Pins #include <Ping4Pins.h> // English: Define Trigger and Echo pins // Español: Definimos los pines "Trigger" y "Echo" #define TriggerPin PF_4 #define EchoPin PD_7 // English: For Arduino use: // Español: Para Arduino usa: #define TriggerPin 8 #define EchoPin 7 // English: Create the ping variable with the builder Ping4Pins class and call the function Ping4Pins // Function: Ping4Pins(int Pin_Trigger, int Pin_Echo) // Español: Creamos la variable ping con el constructor de la clase Ping4Pins y llamamos a la funcion Ping4Pins // Funcion: Ping4Pins(int Pin_Trigger, int Pin_Echo) Ping4Pins ping = Ping4Pins(TriggerPin, EchoPin); void setup(){ // English: We start the serial monitor at a speed of 9600 baud // Español: Iniciamos el monitor serial a una velocidad de 9600 baudios Serial.begin(9600); } void loop(){ // English: We call the function "play", without parameters, of our Ping4Pins class. // Here the input trigger signal is 10us default. // Español: Llamamos a la funcion "play", sin parametros, de nuestra clase Ping4Pins. // Aqui la señal de entrada del disparo es de 10us por defecto. ping.play(); // English: We show in the IDE serial monitor the measurement in // microseconds, inches, centimeters and millimeters, respectively. // Español: Mostramos en el monitor serial del IDE la medicion en // microsegundos, pulgadas, centimetros y milimetros, respectivamente. Serial.print("Microseconds: "); Serial.print(ping.microseconds()); Serial.println(" uS"); Serial.print("Inches: "); Serial.print(ping.inches()); Serial.println(" in"); Serial.print("Centimeters: "); Serial.print(ping.centimeters()); Serial.println(" cms"); Serial.print("Milimeters: "); Serial.print(ping.milimeters()); Serial.println(" mm"); Serial.println(); delay(500); } - IMAGES SECTION
Image 1.
Image 2.
Image 3.
Image 4.
NOTE 1: In Tiva we use digital pin PF_4 for TRIGGER and digital pin PD_7 for ECHO.
In Arduino we use the digital pin # 8 for TRIGGER y digital pin # 7 for ECHO.
NOTE 2: For use 3-pins PING))) Sensor with this library, declare TRIGGER and ECHO as same PIN DIGITAL.
NOTE 3: Please excuse my English, I'm Colombian and my English is not very good