CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug Reports on this forum. Send them to support@ccsinfo.com

Need help with Chinese Torque Sensor.
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
rudy



Joined: 27 Apr 2008
Posts: 147

View user's profile Send private message Send e-mail MSN Messenger

Need help with Chinese Torque Sensor.
PostPosted: Wed Dec 29, 2021 7:16 am     Reply with quote

Hi guys,

Recently I got an 1000Nm torque transducer from China. Unfortunately, the Chinese people don’t understand, or pretends not to, understand English correctly. The torque sensor was asked with RS485 output, but it came with frequency dependent output, meaning that, with zero torque at the axle, a 10Khz square wave is displayed.

So, any torque applied to the axles, makes small deviations on this frequency, in other to send the torque applied on the axles to a display.

I had already made all my development expecting an RS485 output, but now, the only thing I can do is rebuild the development to read frequency.

My question is a TIP, of what will be better!

1 – Drive the 10Khz output to TIMER 1 input clock, and using another timer I can make TIMER 1 reader at each period of time, or:

2 – Use external interruption on RB0, driving a counter, and use TIMER 1 or another timer interruption, to read this counter on each period of time.

Hope to have some valuable suggestion from the experts. The processor, now that I've been forced to move for frequency deviation, is intended to be 18F26K22, running at 64Mhz.

Thank all of you!

Regards!
temtronic



Joined: 01 Jul 2010
Posts: 8525
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed Dec 29, 2021 7:49 am     Reply with quote

You should post a link to the device, there may be a simple HW or SW option to get 'RS-485' communications.

OK, i've looked after Mr. T's post ,and I can't find ANY sensors that are reasonably priced, so we really,really need the manufacturer,part number, info to begin to help you.
The ones I saw(premade units) offer SEVERAL forms of communication..up to you to choose.


Last edited by temtronic on Wed Dec 29, 2021 11:05 am; edited 1 time in total
Ttelmah



Joined: 11 Mar 2010
Posts: 18072

View user's profile Send private message

PostPosted: Wed Dec 29, 2021 7:55 am     Reply with quote

You need to give us at least a hope of finding some data. A part number or
supplier?,
By 'rs485', do you genuinely mean differential RS485?. If so your board
will need redesigning, since this is not compatible with a single pulse
output. It sounds as if the earlier design was actually something like TTL
serial, which then could be adapted.
My guess would be that the output is actually PWM, not frequency. Most
transducers of this sort use this type of output. So you would need to have
a pin available to detect the active edge, and then use a timer to measure
the pulse width.
rudy



Joined: 27 Apr 2008
Posts: 147

View user's profile Send private message Send e-mail MSN Messenger

PostPosted: Wed Dec 29, 2021 11:58 am     Reply with quote

OK.

Response by mobile! Please forgive some errors!

Datasheet? There is nothing! Chinese people don't use it!
PWN, no! It it for sure frequency response! 10KHz at null input, drift for any torque at the axles! Proven by my oscilloscope!

The question is if it is better to use external interruption or Timer1 clock driven by 10Khz clock output from torque transducer? That is my doubt!

My guess is to use the output clock to drive Timer1, and create a routine to check Timer1 3 or 4 times per second!

Regards!
temtronic



Joined: 01 Jul 2010
Posts: 8525
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed Dec 29, 2021 2:04 pm     Reply with quote

If there are NO markings, ID, tag, some kind of model number on this device, toss it into the garbage. Have to wonder how you know it's 1000NM device.
There is ZERO chance anyone can help as no one KNOWS what 'format' the device might be outputting.
I've had the 'pleasure' to reverse engineer some interesting, proprietary devices but back then then wasn't a microcomputer lurking inside the device.
As a last resort, take a picture of it, I heard there's a Google app that will find similar items to the picture.
Since you have 'something' on your scope, you could apply 20-100 known torque values and then create a spreadsheet of 'force vs output', that may show you a possible solution ?
rudy



Joined: 27 Apr 2008
Posts: 147

View user's profile Send private message Send e-mail MSN Messenger

PostPosted: Wed Dec 29, 2021 2:26 pm     Reply with quote

Sr.

This is not what I am asking. I will put a big magnifier and try to see if I get any part number, but I think it is wiped out.

And yes, it is a 9Kg stell part, design for 1000Nm torque sensor, and yes It is frequency dependent output, it is written in the front label as " 5 to 15khz output, detected and measured very well on my oscilloscope.

I don't see any relationship with my question! Thank you!

Regards
temtronic



Joined: 01 Jul 2010
Posts: 8525
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed Dec 29, 2021 3:54 pm     Reply with quote

In your original post you 'got a 1000Nm sensor from China', zero info on it, say suppoased to be RS485, then say 10KHz..so not a lot of good, solid information to go on. BTW, it's actually a sensor 'module' not just the raw sensor.
Now you give us some info, ' it is a 9Kg stell part', ' front label as " 5 to 15khz output'.
If I assume 'stell' is really 'steel' (easy typo), then the device weighs 9Kg(20#)..though you could also think it is model # 9KG, made by the Stell mfg company.
'5-15Khz' may mean zero torque outputs a 5KHz waveform, and 1000Nm sends a 15KHz waveform.
There's a lot of unknowns.
Is the waveform a sinewave or a square wave ?
What is the amplitude ? 3V, 5V, 12V, 48V ?
How did you power the device and how did you choose that voltage ?
Is it a linear response to force, or log, semilog, custom ??

If it does actually sends a 5V square wave, from 5 - 15KHz, then I'd use a timer configuration that will detect from 0 to 15KHz, maybe a bit more. For test purposes I'd have a 2nd PIC 'simulate' the sensor and have it generate 4 or 8 known frequencies(maybe...0,1,2,4,8,16KHz). That way you have a KNOWN reference to create your 'sensor code'.
Depending on the PIC, clock source(best to use xtal/2caps), you'll need to 'do the math' to see what configuration gives you the best 16 best resolution.There are online 'aps' that you can use to decide what combination of settings work for whatever PIC you choose.
It's always faster to decode width of pulse rather than actual frequency.
The more info you can supply, the better we can reply.
rudy



Joined: 27 Apr 2008
Posts: 147

View user's profile Send private message Send e-mail MSN Messenger

PostPosted: Wed Dec 29, 2021 4:13 pm     Reply with quote

Well, lets go with I do know about the device!
Quote:

Is the waveform a sinewave or a square wave ?
Square!

Quote:

What is the amplitude ? 3V, 5V, 12V, 48V ?
18V , the funny thing is that the output is differential! two wires comes out, with symmetrical output. Seems that, somehow, it can be configures as RS485, if I could get the part number and check the datasheet, but there is no information on the chip, it was wipe out completely.

Quote:

How did you power the device and how did you choose that voltage ?
I received a digital reader with it (as a gift), and just follows the instruction on it. It is powered by +24VCC (100% sure about that)

Quote:

Is it a linear response to force ,or log, semilog, custom ??
By what I can see on the tests they had made, it is linear.

Quote:

If it does actually sends a 5V square wave, from 5 - 15KHz, then I'd use a timer configuration that will detect from 0 to 15KHz, maybe a bit more. For test purposes I'd have a 2nd PIC 'simulate' the sensor and have it generate 4 or 8 known frequencies(maybe...0,1,2,4,8,16KHz). That way you have a KNOWN reference to create your 'sensor code'.
Depending on the PIC, clock source(best to use xtal/2caps), you'll need to 'do the math' to see what configuration gives you the best 16 best resolution.There are online 'aps' that you can use to decide what combination of settings work for whatever PIC you choose.
It's always faster to decode width of pulse rather than actual frequency.
The more info you can supply, the better we can reply.
It is exactly what I am thinking, and I will move to a TCXO, once that this equipment will be use on temperatures that can easily reach 50 degrees Celsius

Now that I could think about it, it will be easier than i thought! But for sure I would turn it to an RS485 output! I will put a big magnifier on the chip next week, and try my best to have the part number.

Thank you all guys!
temtronic



Joined: 01 Jul 2010
Posts: 8525
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed Dec 29, 2021 7:54 pm     Reply with quote

Differential output would be common in 'industrial' enviroments. Great for long distance, high noise immunity
Aare both signals zero to 18v swing, or one, zero to +9, the other zero to -9 ?

My energy control system uses +-60 volt communication..can easily go 15 miles or so.
rudy



Joined: 27 Apr 2008
Posts: 147

View user's profile Send private message Send e-mail MSN Messenger

PostPosted: Wed Dec 29, 2021 10:16 pm     Reply with quote

Yes, I think that's it.

+18 and -18V output. But this is not my case, I will only use one output to drive TIMER1.

Regards!
Ttelmah



Joined: 11 Mar 2010
Posts: 18072

View user's profile Send private message

PostPosted: Thu Dec 30, 2021 2:12 am     Reply with quote

If you have ordered this thing, you must have had a web page that you
ordered it from, with some form of description/number. Where?.

Now, if it's output is +/-18v, this is not RS485.
You should really keep the signal at the high voltage till it reaches your
board and have a differential converter at this point to generate the logic
signal to the PIC.
If you expected it to be RS485, you must have had some 'expectation'
about the data stream you expected to see. Where did this come from?.
Honestly, the fastest and simplest thing to do will be to make a small
board that receives this differential signal, generates a TTL signal from this,
uses a PIC to time this, and generates the RS485 you expected to see
from this. Now if it says that it should be 5KHz to 15KHz, then the very
simplest way will be to time the pulse between two successive edges.

It sounds suspiciously to me as if this may be a bi-directional sensor,
so it can measure torque in both directions. So it gives 10KHz, with no
load, and goes to 5KHz for max torque in one direction, and 15KHz for
the same force in the opposite direction. Hence the 10KHz signal.
Now, using a 26K22, use a CCP module. Just capture the timer value
on each successive rising edge. Feed the timer used off Fosc, and at
your 64MHz, you will have a count of 12800 between successive edges
for 5KHz, and 4266 at 15KHz. 6400 at the no load state. Have this
being done in an interrupt from the CCP, so that the main code can just
read the count number and do the maths. The maths should be:
f=64000000/count
fdelta=f-10000
torque(nm)=fdelta/5

Big lesson here is to only use parts where good data is available. You
are now involved in the expense and time of having to decode this
signal. For a commercial product this will cost more than buying a
properly documented part. Sad
temtronic



Joined: 01 Jul 2010
Posts: 8525
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Dec 30, 2021 6:07 am     Reply with quote

hmm, Mr. T has done it again ! I never thought about the sensor being bidirectional, measuring torque CW and CCW, though it makes 100% senes when he posted it !!! Depending on application, you could have a 'forward'
torque and a 'reverse' torque. Silly use would be to see how many ft-lbs needd to loosen a nut as well as tighten.
As he shows, the basic 'math' nicley works with the 16 bit timer, so it'll give good results.

Now I'm thinking it'd be nice to build a proper +- Ammeter for my tractor.The 'module' ones I bought years ago only measure current in one direction,another project I 'shelved'. Might have to get that out again.
rudy



Joined: 27 Apr 2008
Posts: 147

View user's profile Send private message Send e-mail MSN Messenger

PostPosted: Thu Dec 30, 2021 6:42 am     Reply with quote

He is right! as usual....

I think the two outputs COULD be used as differential, in case that this ghost chip be configured as RS485, I very suspicious that it is able to do so. Anyway, I will not try to discover that, because there were a really fight with the chinese guys, I really doubt if them will help me.

For sure, I ordered it! is costs me around 1400 U$ on Alibaba.

It is a pity that I cannot upload pictures here, otherwise I could show the output on my oscilloscope. But there is no doubt about the 10KHz no load. For sure, it has different frequencies drifts for clock and counterclockwise directions, but it is easy for me to calculate it, because I don't need to deal with it rotations direction, just torque.

So, I really appreciate your CCP TIP, I will use it for sure!

Thank you so much!
Ttelmah



Joined: 11 Mar 2010
Posts: 18072

View user's profile Send private message

PostPosted: Thu Dec 30, 2021 6:53 am     Reply with quote

The reason it can't be RS485, is the differential voltage is too high.
RS485, supports a maximum _differential_ voltage of -7 to +12v.
rudy



Joined: 27 Apr 2008
Posts: 147

View user's profile Send private message Send e-mail MSN Messenger

PostPosted: Thu Dec 30, 2021 7:02 am     Reply with quote

I "PULITELY" asked the part number to them, lets see what they will answer!

Thank you!
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group