All About Circuits Forum  

Go Back   All About Circuits Forum > Electronics Forums > The Projects Forum

Notices

The Projects Forum Working on an electronics project and would like some suggestions, help or critiques? If you would like to comment or assist others with their projects, this is the place to do it.

Reply   Post New Thread
 
Thread Tools Display Modes
  #1  
Old 07-25-2010, 05:50 PM
frankpc frankpc is offline
Junior Member
 
Join Date: Jul 2010
Posts: 24
Default Pulse counter to PC file

I plan to attach a slotted opto coupler to the motor of my treadmill to generate pulses. The motor has a slotted wheel designed for this purpose. I will then divide and count the pulses using perhaps 74LS90's. Then interface that using rs232 to a desktop pc and somehow access the data, save it to a file and periodically, ftp it to a server. I know the count needs to encoded somehow along the way. And I am hoping this doesn't tie up a significant portion of the computer's processing power.

A big assumption is that this is the proper way to gain access and process the data. I've read on this forum that MScomm would be a candidate to acquire the data. I'm wondering whether I am on the right track or completely derailed. I've done a little work with PIC's, but don't know whether their use is really necessary for this. And I haven't had to interface them to a computer.

Also, I wouldn't be surprised to learn that something is already available to purchase from one of the hobby online stores that would do a major portion of what I'm trying to do. I would like to keep this project as simple as possible. We have a new baby with us now and my wife will shoot me if I spend an inordinate amount of time on this.

I'm just looking to find out whether anyone knows of a straight-forward way to accomplish this without spending a major portion of the child's college funds.

Thank You for your time,
Frank
Reply With Quote
  #2  
Old 07-25-2010, 07:26 PM
BMorse's Avatar
BMorse BMorse is offline
Senior Member
 
Join Date: Sep 2009
Location: Vermontville, Michigan (GMT -5)
Posts: 2,657
Blog Entries: 15
Default

You can use a circuit directly coupled to the Serial port of the PC to accumulate the counts and have the PC process the "data" accordingly....

If you are familiar with Visual Basic and the use of the MSComm Control object this would be fairly easy and straight forward....

Here is a simple circuit that can be used to interface to a 5 volt TTL circuit to a serial port of a computer.... every time there is a positive pulse on the optocoupler, the serial port ring indicator will go high... this can be tracked with the MSComm controls OnComm Event....

Make sure to enable DTR in the MSComm controls property to power the output side of the optocoupler...

Serial Port TTL interface.png

B. Morse
__________________
There is no spoon -Neo-
Disclaimer: The example programs,circuits, projects and information I provide or post on this web site are for educational purposes only. By copying anything from this site posted by me, you agree to the "as is" nature of the programs, circuits, information and to the statements listed in this disclaimer.No warranty or liability is expressed or implied. Working with AC /DC voltages can be dangerous and even deadly. Proceed at your own risk!
Reply With Quote
  #3  
Old 07-25-2010, 07:33 PM
frankpc frankpc is offline
Junior Member
 
Join Date: Jul 2010
Posts: 24
Default

Thank You B Morse,

Couldn't get much simpler than that!

I have programmed with VB in connection with Excel macros but that is it. Never had to use it to communicate with anything outside of Excel. Also I have not worked with MScomm.

Are than any examples of those types of things here on the Forum?

I was also thinking about using a "1-wire" counter with the DS2423, but again, I have never used 1-wire devices. And if I did do that, I don't know how difficult it would be to gain access to the USB or serial 1-wire port.

Thanks! This gets me going!

Again, thank you for your time.

Frank
Reply With Quote
  #4  
Old 07-25-2010, 07:44 PM
BMorse's Avatar
BMorse BMorse is offline
Senior Member
 
Join Date: Sep 2009
Location: Vermontville, Michigan (GMT -5)
Posts: 2,657
Blog Entries: 15
Default

You would have to use Visual Basic to actually work with the MsComm control object...

here is some Visual Basic 6 code to get you started if you have access to VB6.... if not let me know and I could possibly work with you in creating an application to log the pulses in a comma delimited text file you could import into excel or something....

Serial port test.zip

The sample code above will count pulses coming from the serial ports ring indicator line and display them in a textbox on the screen.....
just have to set the MSComm controls port number to the one being used before opening the port...

B. Morse
__________________
There is no spoon -Neo-
Disclaimer: The example programs,circuits, projects and information I provide or post on this web site are for educational purposes only. By copying anything from this site posted by me, you agree to the "as is" nature of the programs, circuits, information and to the statements listed in this disclaimer.No warranty or liability is expressed or implied. Working with AC /DC voltages can be dangerous and even deadly. Proceed at your own risk!
Reply With Quote
  #5  
Old 07-25-2010, 07:51 PM
BMorse's Avatar
BMorse BMorse is offline
Senior Member
 
Join Date: Sep 2009
Location: Vermontville, Michigan (GMT -5)
Posts: 2,657
Blog Entries: 15
Default

Quote:
Originally Posted by frankpc View Post
<snip>

I was also thinking about using a "1-wire" counter with the DS2423, but again, I have never used 1-wire devices. And if I did do that, I don't know how difficult it would be to gain access to the USB or serial 1-wire port.

<snip>
Frank

Well, if you are already using a PC to accumulate the pulses coming from the slotted wheel, I think it would be overkill to add any other external circuitry to do any counting, considering the PC can accept the pulses, accumulate the counts and also process them... so there really is not a need for any other external circuitry..... unless you want to do something else besides just count revolutions??? The PC app can even do all the math work for you to figure out miles traveled, speed, time, etc... and the PC should be able to do all this without you even noticing...

B. Morse
__________________
There is no spoon -Neo-
Disclaimer: The example programs,circuits, projects and information I provide or post on this web site are for educational purposes only. By copying anything from this site posted by me, you agree to the "as is" nature of the programs, circuits, information and to the statements listed in this disclaimer.No warranty or liability is expressed or implied. Working with AC /DC voltages can be dangerous and even deadly. Proceed at your own risk!
Reply With Quote
  #6  
Old 07-25-2010, 09:40 PM
windoze killa windoze killa is offline
Senior Member
 
Join Date: Feb 2006
Location: Melbourne Australia
Posts: 605
Default

I tried to do this once. Spent hundreds on a treadmill. Hooked it al up and it failed miserably. I spent ages trying to workout what was wrong.....

Then BINGO.....

You actually have to hop on the tread mill and do some exercise.

Bugger... another failed project.
__________________
Eddy Current is a little dizzy over Milli Volt.
Reply With Quote
  #7  
Old 07-26-2010, 02:06 AM
frankpc frankpc is offline
Junior Member
 
Join Date: Jul 2010
Posts: 24
Default

W. K. I understand your frustration. What I've learned is that the more time you spend messing with the circuitry and process to measure the distance traveled and the speed and the other things that B Morse has listed, the less time you have to spend actually running.

Electronics to the rescue again!

Last edited by frankpc; 07-26-2010 at 03:03 AM.
Reply With Quote
  #8  
Old 07-26-2010, 03:02 AM
frankpc frankpc is offline
Junior Member
 
Join Date: Jul 2010
Posts: 24
Default

Quote:
Originally Posted by BMorse View Post
You would have to use Visual Basic to actually work with the MsComm control object...
B. Morse
Thanks so much for the help B. I am encouraged. I have ordered the slotted opto couplers and I plan to epoxy one to the motor when it arrives. The motor already has "fins" on it for that purpose and it already has a slotted opto coupler for the treadmill's own use. I just didn't want to tie into that one since I have no schematics and there is no warranty on a treadmill that would be very costly to repair if I were to mess it up.

I do have a PC that runs 24/7 and it is used for my other Home Automation stuff. I am hoping to save the raw counts (and times?) to a file on that PC. I also have an ftp program that can periodically upload the text file to a server.... Then, a second computer will download the text file and process it with an app written in PHP and save the results to a mySQL database.

The HUGE difference with this project is that it will pull data in from the serial port and create a file using a DIY application. I haven't written applications that run on their own.

I do have VB 6.0. I will digest what you have provided me. I will have to learn how VB can use MScomm to pull data in and save it to a file. Right now, I don't really understand how VB is told when a pulse is available to be grabbed. The "24/7" PC is also a video server. Do you think the processing required for VB to grab the pulses will take much processing power?

Thanks for your help in leading me to the trough B Morse. I will try not to fall in and drown.

Frank
Reply With Quote
  #9  
Old 07-26-2010, 03:50 AM
windoze killa windoze killa is offline
Senior Member
 
Join Date: Feb 2006
Location: Melbourne Australia
Posts: 605
Default

Quote:
Originally Posted by frankpc View Post
W. K. I understand your frustration. What I've learned is that the more time you spend messing with the circuitry and process to measure the distance traveled and the speed and the other things that B Morse has listed, the less time you have to spend actually running.

Electronics to the rescue again!
Frank, my post was for pure humour value. hence the big cheesy
__________________
Eddy Current is a little dizzy over Milli Volt.
Reply With Quote
  #10  
Old 07-26-2010, 01:04 PM
BMorse's Avatar
BMorse BMorse is offline
Senior Member
 
Join Date: Sep 2009
Location: Vermontville, Michigan (GMT -5)
Posts: 2,657
Blog Entries: 15
Default

Quote:
Originally Posted by frankpc View Post
Thanks so much for the help B. I am encouraged. I have ordered the slotted opto couplers and I plan to epoxy one to the motor when it arrives. The motor already has "fins" on it for that purpose and it already has a slotted opto coupler for the treadmill's own use. I just didn't want to tie into that one since I have no schematics and there is no warranty on a treadmill that would be very costly to repair if I were to mess it up.

I do have a PC that runs 24/7 and it is used for my other Home Automation stuff. I am hoping to save the raw counts (and times?) to a file on that PC. I also have an ftp program that can periodically upload the text file to a server.... Then, a second computer will download the text file and process it with an app written in PHP and save the results to a mySQL database.

The HUGE difference with this project is that it will pull data in from the serial port and create a file using a DIY application. I haven't written applications that run on their own.

I do have VB 6.0. I will digest what you have provided me. I will have to learn how VB can use MScomm to pull data in and save it to a file. Right now, I don't really understand how VB is told when a pulse is available to be grabbed. The "24/7" PC is also a video server. Do you think the processing required for VB to grab the pulses will take much processing power?

Thanks for your help in leading me to the trough B Morse. I will try not to fall in and drown.

Frank

The VB code should be pretty straight forward.... and the way the MSComm handles the inputs is through what they refer to as an Event Driven method, if an event occurs such as a Ring input, the MSComm's OnComm event will be triggered.....

After thinking about this a bit last night, I think using the CTS line for an input would be better, since this line can actually be polled to see if it's High or Low, so you will be able to "time" the transitions between pulses to get the pulse width time and possibly use that to calculate RPM's and Speed...

And, No, the Pulse "metering" should not tax the PC's speed too much... You probably won't even notice it running....

B. Morse
__________________
There is no spoon -Neo-
Disclaimer: The example programs,circuits, projects and information I provide or post on this web site are for educational purposes only. By copying anything from this site posted by me, you agree to the "as is" nature of the programs, circuits, information and to the statements listed in this disclaimer.No warranty or liability is expressed or implied. Working with AC /DC voltages can be dangerous and even deadly. Proceed at your own risk!

Last edited by BMorse; 07-26-2010 at 01:21 PM.
Reply With Quote
Reply   Post New Thread

Tags
, ,


Related Site Pages
Section Title
Worksheet Digital communication
Worksheet Digital codes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with Pulse Counter that outputs one pulse per n-pulses tuscarora The Projects Forum 18 03-09-2010 07:20 PM
Simple pulse counter and display using PIC 16F627 woodysgreen Embedded Systems and Microcontrollers 5 11-08-2009 03:06 PM
Old mouse in a pulse counter project PIC18F2620 blackrid3r Embedded Systems and Microcontrollers 0 04-03-2009 05:34 PM
Pulse without a 555 and a Counter issue. haxxx The Projects Forum 4 02-28-2009 07:12 PM
pulse counter using 555 and Decade counter ieda The Projects Forum 12 02-27-2009 04:21 AM

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:54 AM.


User-posted content, unless source quoted, is licensed under a Creative Commons Public Domain License.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.