The pin A9 is connected to the Trig but in the main you define the A8 as Trig pin, I think it was a little confusion. Great video!!
@jackdonchew73014 жыл бұрын
I wonder how it work...
@noweare14 жыл бұрын
Excellent as always. I like the way you converted decimal to ascii. Thank you.
@mateusz8098 ай бұрын
Hello! I have STM32 Nucleo L476RG. If you have problem like me that sensor doesn't measure anything or LCD is bombarded by random numbers here is solution, which worked for me. 1. Change these lines in your code to this: #define TRIG_PIN GPIO_PIN_9 #define TRIG_PORT GPIOA According to this video, TRIG should be connected do PA9 and ECHO to PA8. Remember that TRIG should be as GPIO_Output. On pin PA8 (to which is connected ECHO) you should make TIMER and enable option Input Capture mode. 2. Make sure that sensor is connected to 5 V DC. 3. Add this function to properly display values on your LCD: void lcd_display_distance(uint8_t distance) { char buffer[16]; sprintf(buffer, "Distance: %d cm", distance); lcd_clear(); lcd_put_cur(0, 0); lcd_send_string(buffer); } 4. Make sure you add these lines in main: MX_TIM1_Init(); MX_I2C1_Init(); /* USER CODE BEGIN 2 */ lcd_init(); HAL_TIM_IC_Start_IT(&htim1, TIM_CHANNEL_1); lcd_send_string ("Dist= "); 5. In while make sure you have: HCSR04_Read(); HAL_Delay(200); And add this line too: lcd_display_distance(Distance); That's all worked for me. I hope that this comment will help you. Greetings!
@shreyakaria87612 жыл бұрын
Excellent video!! I tried this with my STM, the data is captured once and can only be updated when reset button is pressed, what to do?
@NamNguyen-ti8ku Жыл бұрын
the same
@Pushpam19954 жыл бұрын
Keep making these kind of videos
@satishm46354 жыл бұрын
Thanks man! Great video
@ervanurcicek8256Ай бұрын
hi What is the code that you copied to the src and inc files at 8:15? i couldn't find it anywhere, could you help?
@ControllersTechАй бұрын
Its i2c lcd library. It should be present in src and inc folders.
@eduardodelarosaferrer22054 жыл бұрын
Perfect again !!
@nguyennguyenvu82124 жыл бұрын
thank you! I did it with stm32f4
@haziqizzat35583 жыл бұрын
hi there, can i know how you do it with stm32f4?
@MamidipalliBujji5 ай бұрын
For me we did not get the output can you please tell me the problem once
@tupoy_ytub_uberi_psevdonim2 жыл бұрын
Hello! I like this video, to easy for learn. I make universal lib for any STM microcontroller. Big thanks!
@misterjacqwelll3 жыл бұрын
if i want to set a random number of the lcd, like push a button and save that value to calculate other values... You have a video to do that thing? PD: Great video :3
@hanilam33893 жыл бұрын
where is PA9 used in the code?
@minhcongho36394 жыл бұрын
how to multiple input capture channels
@self-studyelectronicengine72944 жыл бұрын
hi, thanks for this code But I think this code has problem you define PA8 as trig pin but put it on wrong way to use I try this code on my micro and change PA8 to PA9 as trig and coxe work it as well
@ControllersTech4 жыл бұрын
I'll see it. Maybe i have used the pin name directly somewhere..
@self-studyelectronicengine72944 жыл бұрын
@@ControllersTech thanks for mention
@siurpussiurpuliukas5984 жыл бұрын
If the distance if greater than 127 it Distance variable becomes negative number. How should I fix this?
@ControllersTech4 жыл бұрын
Try changing the data type of distance
@siurpussiurpuliukas5984 жыл бұрын
@@ControllersTech Thanks, it worked. However, I have one more question. What is the maximum speed of reading the sensor? It seems that if I reduce HAL Delay to less than 15 miliseconds, callback does not return correct values.
@siurpussiurpuliukas5984 жыл бұрын
@@ControllersTech Also, when I'm using the other timer for PWM signal, it somehow interferes with sensor and the results fluctuate depending on pwm signal
@dorstern245 Жыл бұрын
hey, there are two problems: 1. When the LCD reaches number more than 9 it shows A, how can I fix it? 2. The ultrasonic sensor fakes the distance measurement by 3 or 4 centimeters, do you have a solution for this?
@DuyNguyen-ty4uk3 жыл бұрын
I dont use lcd, how can i show distance on watch1
@nsanandkumarak3 жыл бұрын
Hi Sir, Can you please make video on Timer Tigger source and usage of it
@Levi.65707 ай бұрын
I have a question, if we apply to real life, what is the purpose of this project/
@ControllersTech7 ай бұрын
That is up to you to decide.
@EmbeddedProfile6 ай бұрын
How to add a second ultrasonic sensor to this work please ?
@ControllersTech6 ай бұрын
Use another timer for it. In the Input capture callback function, perform the check which timer called the interrupt. If (htim->Instance == TIM1) { write the entire code here} else if (htim->Instance == TIM2) {Write entire code here again} Also define new set of variables( IC_VAL, difference etc..) for second sensor.
@EmbeddedProfile6 ай бұрын
@@ControllersTechI did this but one sensor works fine but the second one give juste one correct value and stop working
@minayakarimova3 жыл бұрын
Huge thanks
@ThànhVinh643 жыл бұрын
why can't I display the distance value on lcd16x2.
@aniketsubudhi22602 жыл бұрын
WHERE should i use the file lcd_userConf?
@davidbalog10144 жыл бұрын
Distance is jumping rarely. I take an object 2 m away from the sensor, but it shows rarely bad value. What is the mistake?
@ControllersTech4 жыл бұрын
Try changing the data type of distance
@akshadawaghmode65508 ай бұрын
Can you send i2c-lcd .h and .c files?
@truongho27712 жыл бұрын
TIMX global interrupt consists of TIM capture compare interrupts ?
@ControllersTech2 жыл бұрын
If its not given separately, then yes.
@monsieurovni57403 жыл бұрын
Great job! But why would it not be possible to use HAL_delay() instead of delay() in HCSR04_Read() ?
@ControllersTech3 жыл бұрын
01:40
@பொத்தகம்3 жыл бұрын
is the header file of i2c is same for STM32F466RE? and i can't find your i2c header file. please help me...
@北科大-王裕誠 Жыл бұрын
hello may i ask what will be the distance value,i mean if the actual distance was 100cm ,the distacne variable value will be (int)100 or something else?
@ControllersTech Жыл бұрын
It should be 100.
@lorenefields28383 жыл бұрын
Good video. I have a question. If I have a signal coming at 65 Hz, at what speed should I set the timer2 to read that signal in input capture mode. Thanks.
@ControllersTech3 жыл бұрын
Somewhat in kilohertz would work
@jay16myv.3 жыл бұрын
Hello, is there a tutorial for LCD communication? I don't know how to connect the LCD to STM32. Thank you.
@ControllersTech3 жыл бұрын
Look in the stm32 playlist
@jennyshaio4633 жыл бұрын
Hi, I followed your instruction but got this error message"CM4 Failed to read all registers FAILED to REGISTER Values from the target Debugger connection lost. Shutting down..." Do you know any way to solve this? I've tried every method I could come up with...
@ControllersTech3 жыл бұрын
What does this have to do with the instructions ? This is your hardware issue...
@theraja0114 жыл бұрын
Hi, Grt. Pls share tutorial on EEPROM Emulation on STM32F103C8T6 flash memory (Ref cd00165693) HAL Lib is there. thx
@thophamngoc71783 жыл бұрын
can you explain for me ? else if (IC_Val2
@ControllersTech3 жыл бұрын
It's to compensate the overflow. Ic val2 can only be less than icval1, only if there is overflow
@viethuynhquoc40494 жыл бұрын
Hello, i have some problem with TCS3200, can you make a project about it. Thanks very much. I'm from Vietnam
@vikneswaranrajandaran65884 жыл бұрын
how to edit the coding by not using lcd monitor? i'm using teamspeak to display the distance
@ControllersTech4 жыл бұрын
just remove the LCD part
@vikneswaranrajandaran65884 жыл бұрын
@@ControllersTech ok done...I had integrated your data logger video and had build it with 0 error but when debug, failed to start GDB server...reason (4) no device found on target appeared
@farhanamin40752 жыл бұрын
where is the i2c-lcd libraries come from
@aniketsubudhi22602 жыл бұрын
same question sir, please can you reply
@ControllersTech2 жыл бұрын
Check out this, you will understand kzbin.info/www/bejne/jXKqfYSFfq14n9E
@therubrat Жыл бұрын
What is the input frequency ??? Plz reply
@ControllersTech Жыл бұрын
Input frequency of what ?
@therubrat Жыл бұрын
Input frequency of Ultrasonic sensor
@therubrat Жыл бұрын
And btw can u tell me how much frequency we need to give to produce 25khz ultrasonic sound??
@ControllersTech Жыл бұрын
Here ultrasound module produces the output pulse, which we read using the mcu and calculate the distance. We are not producing the ultrasound here. Ultrasound is being used by the sensor to calculate the distance of the object in front of it.
@therubrat Жыл бұрын
@@ControllersTech yeah but if u don't mind can u tell me about what frequency i can give to generate 25khz ultrasonic sound in transducer?
@sekoutounkara2434 жыл бұрын
im not getting any value at all ...
@Fabio-211 Жыл бұрын
me too...
@EmbeddedProfile6 ай бұрын
Try to check the alimentation pin
@anhtaio41284 жыл бұрын
Error in initializing ST-LINK device. Reason: ST-LINK: Could not verify ST device! Abort connection. Help me pro?
@ControllersTech4 жыл бұрын
You might have a fake mcu. Check the video below and see @johan comment kzbin.info/www/bejne/m5CxhKSwarVrh80