Page 4 of 4

Re: Ultrasonic Distance sensor using HC-SR04

Posted: Thu Sep 21, 2017 8:37 am
by medelec35
kalmar79 wrote:ok I did again in another file and working good
That's good, do you know what you did different to make it work?
kalmar79 wrote:I want to introduce a buzzer insted a led. do I need to modificate something?
You have two ways to go.
1) is with a 5V sounder with built-in driving circuitry.
2) A piezo type sounder which requires a driving waveform e.g. PWM.
Due to age of your microcontroller, it does not have any useful functions built-in .
E.e. PWM, analogue to digital converters, internal oscillator etc.
So with that in mind the second option is possible but is complex.
This is because of the need to be bit banged while sill allowing detection function.
So with your chip, option one would be easiest as you just put 5V DC in and it will buzz.
If the buzzer takes more than the current that a pin can supply then you will required an additional transistor for controlling power to the buzzer.
kalmar79 wrote:Why you use '320' in (Echo = 0) || (count > 320) ??
How the Proximity detector works is a pulse of 10us is sent into the trigger pulse input which causes a burst of ultrasonic sound to be generated.
Then the microcontroller waits for a signal caused by receiving sound wave that was generated by the trigger.
So its waiting in a tight loop.
What if the sound is not received back?
Then it will stay stuck in a tight loop.
The

Code: Select all

count > 320
just acts as a timeout function.
If the signal is not received within a few milliseconds then exit tight loop and resend trigger pulse.

Martin

Re: Ultrasonic Distance sensor using HC-SR04

Posted: Fri Sep 22, 2017 6:08 am
by kalmar79
my friend thanks for take the time to explain me. I only change the file or carpet were I was doing the flowchart, I do it in english and spanish but the only one word I change was count(contador in spanish). I don't know what happened.
And I put a buzzer in the output and work good.
Is possible make a PWM with the switch funtion? I made something like this for a servomotor.

thanks

Re: Ultrasonic Distance sensor using HC-SR04

Posted: Thu Mar 05, 2020 11:48 pm
by wantedmama
medelec35 wrote:This could work on 4MHz?
Sorry to bring a very old post , but needed help with connection pins/ports of LCD EB-005 and HC-SR04 to PIC16F1937 using EB-006 board . I can't seem to contact private message you via this forum, where can I contact you ?

Re: Ultrasonic Distance sensor using HC-SR04

Posted: Fri Mar 06, 2020 9:52 am
by medelec35
wantedmama wrote:but needed help with connection pins/ports of LCD EB-005 and HC-SR04 to PIC16F1937 using EB-006 board
I have attached the two original flowcharts that was created with Flowcode V5, but have converted them to V8.
Just make sure that for the V1 & V2 flowcharts, LCD is connected to port A
You can change the port if required.
If you look at the output icon, it connects to Trigger
The input icon connects to Echo
In V1 its in main & in V2 it's within Echo_Detect function macro
wantedmama wrote:I can't seem to contact private message you via this forum, where can I contact you ?
Like other forums, you can only send PM's after you have added a few posts.
It's against forum rules(2) to ask for help via personal message.
However, you can use personal message (when post count is high enough) for any flowcharts that require keeping private.

Re: Ultrasonic Distance sensor using HC-SR04

Posted: Mon Mar 09, 2020 6:45 pm
by wantedmama
medelec35 wrote:
wantedmama wrote:but needed help with connection pins/ports of LCD EB-005 and HC-SR04 to PIC16F1937 using EB-006 board
I have attached the two original flowcharts that was created with Flowcode V5, but have converted them to V8.
Just make sure that for the V1 & V2 flowcharts, LCD is connected to port A
You can change the port if required.
If you look at the output icon, it connects to Trigger
The input icon connects to Echo
In V1 its in main & in V2 it's within Echo_Detect function macro
wantedmama wrote:I can't seem to contact private message you via this forum, where can I contact you ?
Like other forums, you can only send PM's after you have added a few posts.
It's against forum rules(2) to ask for help via personal message.
However, you can use personal message (when post count is high enough) for any flowcharts that require keeping private.
Thank you , I have followed your guide however the circuit doesn't seem to be working for me .https://imgur.com/csz44SW https://imgur.com/lm1QIkc
is there anything I am missing ?
I have fixed the vcc same row as trig and connected ground

Re: Ultrasonic Distance sensor using HC-SR04

Posted: Mon Mar 09, 2020 6:59 pm
by Benj
Hello,

From your photos, the power cable seems to be in the same row as the trig signal on the breadboard.

Also you haven't connected up the ground pin.

Re: Ultrasonic Distance sensor using HC-SR04

Posted: Mon Mar 09, 2020 7:10 pm
by wantedmama
Benj wrote:Hello,

From your photos, the power cable seems to be in the same row as the trig signal on the breadboard.

Also you haven't connected up the ground pin.
I realised that later too , I fixed the same row trig and vcc , also connected ground . However it still doesn't seem to be working
Edit : the simulation in flowcode doesn't seem to be working too. I am currently using V8.

Re: Ultrasonic Distance sensor using HC-SR04

Posted: Wed Mar 11, 2020 1:22 am
by wantedmama
medelec35 wrote:
wantedmama wrote:but needed help with connection pins/ports of LCD EB-005 and HC-SR04 to PIC16F1937 using EB-006 board
I have attached the two original flowcharts that was created with Flowcode V5, but have converted them to V8.
Just make sure that for the V1 & V2 flowcharts, LCD is connected to port A
You can change the port if required.
If you look at the output icon, it connects to Trigger
The input icon connects to Echo
In V1 its in main & in V2 it's within Echo_Detect function macro
wantedmama wrote:I can't seem to contact private message you via this forum, where can I contact you ?
Like other forums, you can only send PM's after you have added a few posts.
It's against forum rules(2) to ask for help via personal message.
However, you can use personal message (when post count is high enough) for any flowcharts that require keeping private.
Hello, The simulation and circuit doesn't seem to be working for me using V8 flowcode

Re: Ultrasonic Distance sensor using HC-SR04

Posted: Wed Mar 11, 2020 8:24 am
by medelec35
Can you post the flowchart and a picture showing all the connections from programmer to sensor.
V1 should simulate but V2 won't as the c code

Code: Select all

FCV_COUNT = TMR0;
won't simulate.

Re: Ultrasonic Distance sensor using HC-SR04

Posted: Wed Jul 26, 2023 5:10 pm
by AqaFlow
Hi Martin,

I try open file Distance Sensor 16F883 V1 but cant open, I try with FC8, FC9 FC10 but cant.
Please advise
Distance Sensor 16F883 V1 (1).fcf
(11 KiB) Downloaded 166 times
Please advice.
Thanks
Amrat

Re: Ultrasonic Distance sensor using HC-SR04

Posted: Wed Jul 26, 2023 5:58 pm
by chipfryer27
Hi

Projects created prior to v7 cannot be directly opened in your versions of Flowcode. On another machine I have version v5 onwards so when I'm next at it I'll see what I can do.

However someone will probably assist before I get the chance to :)

Regards

Re: Ultrasonic Distance sensor using HC-SR04

Posted: Wed Jul 26, 2023 7:45 pm
by chipfryer27
Hi

The attached should open from v7 onwards.

You will probably have to resize components and they may be split between 2D and 3D panels.

Regards