What kind of sensor is for fast counting application?

Digital Fiber, Photoelectric, Laser Range, Optical, Temperature, Rotary Encoder, Ultrasonic, Gas, Gyro, Accelerometer, FlexiBend, Flexiforce, Compass......

What kind of sensor is for fast counting application?

Postby shidi » Fri Jul 22, 2011 7:06 pm

Hello forumers, just wanna know which/what kind of sensor is suitable for fast count application. Currently I'm using Medium Range IR Sensor with SK40C (16F877A) and UART. Is this combination is not match for super fast counting application? Or should I replace the sensor with other type like Ultrasonic/Photoelectric sensor? I'm having trouble with the counts because it seem like it have a delay in my Visual Basic's interface. Appreciate if someone can help me here. Thanks
shidi
Freshie
 
Posts: 6
Joined: Fri Jul 22, 2011 6:59 pm

Re: What kind of sensor is for fast counting application?

Postby aurora » Sat Jul 23, 2011 3:02 am

Hi there,

Can you elaborate further? Like what is it that you are counting? Cards, objects, etc. What is your average count of the object that you are counting?
aurora
Discoverer
 
Posts: 126
Joined: Sun Jun 07, 2009 4:52 pm

Re: What kind of sensor is for fast counting application?

Postby shidi » Sat Jul 23, 2011 4:31 am

I'm currently working on a project called "goldsprint" which is an indoor bicycles race. The design is to counts the rotation of the roller using sensor (I'm using medium range sensor for now). So according to the rotation, the interface (VB) indicates the distance in meter. The complete counts is 1000 (rotation) for 250m. Here is the example of goldsprint: http://www.youtube.com/watch?v=VkIKR2xqTco
shidi
Freshie
 
Posts: 6
Joined: Fri Jul 22, 2011 6:59 pm

Re: What kind of sensor is for fast counting application?

Postby shahrul » Sat Jul 23, 2011 9:57 am

For counting pulse in PIC, better use pin interrupt. Then to send the counting to VB through UART, there is a delay exist.
User avatar
shahrul
Professional
 
Posts: 812
Joined: Sat May 16, 2009 9:54 pm
Location: Selangor

Re: What kind of sensor is for fast counting application?

Postby shidi » Sat Jul 23, 2011 11:11 am

So what should I do to solve my problem? Is there any other option faster than UART?
shidi
Freshie
 
Posts: 6
Joined: Fri Jul 22, 2011 6:59 pm

Re: What kind of sensor is for fast counting application?

Postby aurora » Sat Jul 23, 2011 11:45 am

How fast can a bicycle go? Say 250m in 10 sec maybe? That is 90km/hr already.
At that speed, it is only 100 count/sec. Say you declare your count as long integer (0-65536), that is 2-byte. At this speed, you only require to transmit 200 byte/sec.

UART with baud rate of 57600, that is about 5000 byte/sec.

You use interrupt to sense the rotation, once receive, the interrupt calls and initiate UART. If you use 10mhz crystal, you have 25000 instruction cycle between interrupt (assuming at 100 count/sec).

That is more than enough if you ask me. ;)
aurora
Discoverer
 
Posts: 126
Joined: Sun Jun 07, 2009 4:52 pm

Re: What kind of sensor is for fast counting application?

Postby shidi » Sat Jul 23, 2011 12:32 pm

You can say it 250m in 10sec.

How to set the UART's baud rate to maximum?

How to use interrupt to sense the rotation? Is it relate to the PIC or VB programming?

I declared my counts as String because sometimes there's non-numeric characteristic data. My program simply like this:

'read from microcontroller/sensors

Try
TextBox1.Text = SerialPort1.ReadLine
Catch
End Try

Dim literalA As String = TextBox1.Text
Dim substringA As String = literalA.Substring(0, 5)

Dim literalB As String = TextBox1.Text
Dim substringB As String = literalB.Substring(6, 5)

TextBox2.Text = substringA
TextBox3.Text = substringB

The data (counts) received is like "00002 00014", so sub-string it to "00002" and "00014"

I'm using the standard crystal that come with the SK40C
shidi
Freshie
 
Posts: 6
Joined: Fri Jul 22, 2011 6:59 pm

Re: What kind of sensor is for fast counting application?

Postby robosang » Sun Jul 24, 2011 9:38 pm

I think most of us is talking about programming for PIC or microcontroller.... I personally not really familiar with VB..... :D
robosang
Expert
 
Posts: 1239
Joined: Wed Jun 10, 2009 5:37 pm

Re: What kind of sensor is for fast counting application?

Postby shahrul » Sun Jul 24, 2011 9:48 pm

In VB, I use Timer_Tick to receive UART from PIC. The Timer can be every 10ms. See this serial port example.
User avatar
shahrul
Professional
 
Posts: 812
Joined: Sat May 16, 2009 9:54 pm
Location: Selangor

Re: What kind of sensor is for fast counting application?

Postby shidi » Sun Jul 24, 2011 11:59 pm

it's not about the VB programming I guess. it's the PIC 16f877a setting. can 16f877a be set more than 19200 baud rate? it say that the CPU speed is 5 MIPS. is it enough for processing high speed counting? I don't how to calculate MIPS. my friend told me to study about baud rate. it seem like i can't get much info from the net.
shidi
Freshie
 
Posts: 6
Joined: Fri Jul 22, 2011 6:59 pm

Next

Return to Sensor

Who is online

Users browsing this forum: No registered users and 15 guests

cron