Summary of the invention
The technical problem to be solved in the invention is: the detection method and system of a kind of steering wheel rotational angle are provided, with
Just the difficult to install, size for solving existing steering wheel angle acquisition system is big, influences to drive after installation, at high cost, accuracy rate
Low defect.
The present invention solves its technical problem, and the following technical solution is employed:
The detection system of steering wheel rotational angle provided by the invention comprising two units, in which: first unit is equipped with
First singlechip and the first gravity accelerometer being attached thereto by data line, the first bluetooth module, serial communication mould
Block, he take power supply module;The second acceleration of gravity that second unit is equipped with second singlechip and is attached thereto by data line
Sensor, third gravity accelerometer, the second bluetooth module, self powered supply module.
It is described he to take electricity be a kind of title corresponding with self-powered, mean and electricity obtained by other devices or equipment
Source.
The first unit provides electric energy by vehicle power supply on vehicle body;First gravity accelerometer is mounted in
On steering wheel hub axis at the steering wheel, establish using vehicle direction of advance as positive direction of the x-axis, with vertical vehicle body be downwards z-axis just
Direction and the y-axis rectangular coordinate system in space A that meets right-hand rule in vertical vehicle body plane orthogonal with z-axis.
On the steering wheel, by providing electric energy from the power module of charged pool, the second gravity accelerates the second unit dress
Degree sensor mounted in steering wheel do not rotate when steering wheel hub axis top, establish with steering wheel hub axis be inwardly z-axis positive direction,
With vertical direction disk axis be positive direction of the x-axis forward and y-axis is orthogonal with x-axis meets right-hand rule in steering wheel plane
Rectangular coordinate system in space B1;Third gravity accelerometer and the second gravity accelerometer are orthogonal mounted in direction
Steering wheel hub axis left part when disk does not rotate, establish with steering wheel axis be inwardly z-axis positive direction, with vertical direction disk axis just
It is upwards positive direction of the y-axis and the x-axis rectangular coordinate system in space for meeting right-hand rule in steering wheel plane orthogonal with y-axis
B2;The origin of rectangular coordinate system in space B1, B2 are overlapped with two gravity accelerometers, and as two acceleration of gravity pass
Sensor and steering wheel connect firmly rotation.
The acceleration of gravity and acceleration of motion of three gravity accelerometers detection vehicle are each in its sensor
Component values on a axis, second singlechip read and handle the detection data of second and third gravity accelerometer, the
One single-chip microcontroller is read and the reception data of the detection data of the first gravity accelerometer of processing and the first bluetooth module, calculates
Steering wheel rotational angle out, by serial communication module output data, first singlechip and the second bluetooth module carry out data and lead to
News.
The largest interval time of the gravity accelerometer detection data is 2 milliseconds, and single-chip microcontroller reads gravity and adds
The time interval of velocity sensor detection data is freely set 10 milliseconds to 200 milliseconds by user, and single-chip microcontroller presses user
The time interval of setting obtains the detection data of gravity accelerometer.
The detection method of steering wheel rotational angle provided by the invention, comprising the following steps:
Step1, system initialization establish rectangular coordinate system in space A, B1, B2, C;Second singlechip passes through the second bluetooth mould
Block sends data synchronization time, single-chip microcontroller energy after the detection data for receiving three gravity accelerometers to first singlechip
It is enough to carry out processing data by the same time;
Step2, when vehicle remains static, the first gravity accelerometer detects to obtain acceleration of gravity in sky
Between numerical value in rectangular coordinate system A on z-axis direction be a1z, decomposed by parallelogram law, obtain relationship a1z
=gcos θ, is calculated the angle theta between vehicle and level road, i.e. road gradient;
Step3, when vehicle remains static, pilot control steering wheel clockwise slowly turns around by rotation, when another mistake
Needle, which slowly revolves, to turn around, second and third gravity accelerometer detect vehicle acceleration, when the second acceleration of gravity sense
Device detects numerical value maximum point in its x-axis, when third gravity accelerometer detects numerical value maximum point in its y-axis, it is specified that
The position is the initial position S of steering wheel, second and third gravity accelerometer where point be respectively origin o, o';
Step4, when the vehicle is running, vehicle generates total accelerationFirst, second, and third acceleration of gravity sensing
Device detects the acceleration of each axis;
Step5, second singlechip obtain the data of second and the detection of third gravity accelerometer, carry out at data
Acceleration information and time data are sent to first singlechip by the second bluetooth module by reason, and first singlechip passes through first
Bluetooth module receives data, and first singlechip receives the data of the first gravity accelerometer transmission simultaneously;
Temporally data handle the detection data of synchronization for Step6, first singlechip, when steering wheel is located at just
When beginning position S, by vehicle accelerationDecompose on each axis of rectangular coordinate system in space C, set on each axis at this time numerical value as
acx、acy、acz.When one angle γ of pilot control direction disc spins, second and third gravity accelerometer can be in its x
Detect that acceleration value is a on axis2x'、a3x', detect that acceleration value is a on the y axis2y'、a3y', it is detected in z-axis
Acceleration value is a2z'、a3z', at this time second and what third gravity accelerometer detected is that vehicle entirety acceleration exists
Rectangular coordinate system in space B1, B2 each axis is decomposed after numerical value, can solve steering wheel rotation angle γ11、γ12, public
Formula are as follows:
Then wheel steering angle γ1Calculation formula are as follows:
It, can the side of solving by the data that third gravity accelerometer measures on the basis of rectangular coordinate system in space C
To disc spins angle γ21、γ22, formula are as follows:
Then wheel steering angle γ2Calculation formula are as follows:
Therefore the calculation formula of wheel steering angle γ are as follows:
After Step7, first singlechip calculate steering wheel angle, data are filtered, are turned by JC communications protocol
Pass through serial communication module output data after being melted into serial data.
In the above method, first singlechip is filtered steering wheel angle data, mode is filtered are as follows: first
Single-chip microcontroller arbitrarily obtains the steering wheel rotational angle data at continuous five moment and stores, and carries out curve fitting, by curvilinear motion
Trend prediction subsequent time steering wheel angle data, and the steering wheel angle data of the curve matching at this moment are exported.
In the above method, JC communications protocol regulation: all data are converted into ASCII transmission, and each data packet includes 25
Data/character, the 1st, 2 is data packet head " JC ";3rd to 11 for when meta position, format be "+two minutes of two hourages
+ two+three millisecond numbers of bps clock number of number ";12nd to 13 is direction position, and format is "+one number of full circle in direction of rotation position
Position ", direction of rotation position regulation are counterclockwise 0, are clockwise 1;14th to 18 is current steering wheel angle of rotation degree, and format is
" three whole degree+decimals of decimal point+one ";19th to 20 bit check position, verification rule are the data conversion of front the 1st to 18
To sum after hexadecimal, sum number is taken to remove 256 remainder;21st to 25 is estimated steering wheel angle of rotation degree, and format is " three
Whole degree+the decimal of decimal point+one in position ".
The present invention has following major advantage compared with prior art:
(1) size is smaller, and structure is simple, is easily installed, and will not produce bigger effect to the driving experience of driver;
(2) time interval that single-chip microcontroller D1 obtains data can be able to satisfy different user to acquisition number by user's sets itself
According to time requirement, universality is strong, time interval be 20ms when can meet racing wheels outer corner measurement, time interval is
Meet general user's urban road wheels outer corner measurement when 100ms~200ms, time interval can meet when being 500ms
Steering wheel angle of driving at low speed measurement;
(3) test method is clear, requires the operation of driver lower, will not generate to the driving of driver dry
It disturbs;
(4) output data is filtered, and has carried out effective fitting, reduced the error of DATA REASONING, mention
The high precision of steering wheel angle DATA REASONING, error is measured after off-line secondary processing and is missed less than 10% when On-line sampling system
Difference is less than 5.4%;
(5) when the time interval that single-chip microcontroller D1 obtains data is less than 200ms, subsequent time steering wheel angle predicts that error is small
In 12%.
(6) steering wheel angle data are exported in the form of serial data, and communications protocol is simple, are convenient for user's reading process number
According to.
Specific embodiment
The present invention relates to the detection methods and system of a kind of steering wheel rotational angle.Be designed to provide it is a kind of it is novel,
The detection method and system for the steering wheel rotational angle that size is small and accuracy is high.The step of realizing steering wheel angle Data Detection
It is: two units of installation, realization system initialization, gravity accelerometer real-time detection component of acceleration, single-chip microcontroller reading,
It is exported after processing data.The present invention can reduce the size of steering wheel angle sensor, improve the accuracy of measurement, operation letter
It is single, it can be based on user demand sets itself data collection cycle, universality is strong.
Below with reference to examples and drawings, the invention will be further described, but does not limit the present invention.
A kind of detection system of steering wheel rotational angle provided by the invention, as Figure 1-Figure 4, including first unit 4
With second unit 3.First unit is as shown in figure 5, including single-chip microcontroller D1 and the J1 (acceleration of gravity being attached thereto by data line
Sensor 6), bluetooth module L1, serial communication module, be additionally provided with him and take power supply module C1.Second unit is as shown in fig. 7, packet
Include the single-chip microcontroller D2 and J2 being attached thereto by data line (gravity accelerometer 7), J3 (gravity accelerometer 8),
Bluetooth module L2 is additionally provided with self powered supply module C2.
It is the serial TTL of TTL that the gravity accelerometer, which selects model GY-291, power supply 5v, communication mode,
The gravity accelerometer of communication protocol 3, component of the acceleration total for real-time detection vehicle on each axis.
The single-chip microcontroller selects model C 8052F580DK, power supply is 5v single-chip microcontroller 2, single-chip microcontroller D1 is for reading
The detection data of gravity accelerometer J1 and the reception data of bluetooth module L1 are taken and handled, steering wheel angle of rotation is calculated
Degree, by serial communication module output data, single-chip microcontroller D2 is for reading and handling gravity accelerometer J2, gravity acceleration
Spend the detection data of sensor J3.
The bluetooth module selects model HC-06, power supply is 5v bluetooth module 2, for sending and receiving
The processing data of single-chip microcontroller.
The serial communication module selects model TELESKY, uses CP2102 core chip, power supply for the string of 5v
Mouth communication module sends serial data for single-chip microcontroller D1.
The power module C1 directly takes electricity from vehicle power supply, and power module C2 selection model LRS-50-24, voltage are
The power module of 5v, for powering for second unit.
The physical circuit of above-mentioned first unit is as shown in fig. 6, include four parts, in which: gravity accelerometer J1
2 ends, 3 ends be connected with the port P0.4, P0.5 of single-chip microcontroller D1,1 port of gravity accelerometer J1 connects power positive end,
4 ports of gravity accelerometer J1 are grounded.The port P1.3, P1.2 phase at 2 ends of bluetooth module L1,3 ends and single-chip microcontroller D1
Even, 1 port of bluetooth module L1 connects power positive end, the 4 ports ground connection of bluetooth module L1.2 ends, 3 ends of serial communication module
It is connected with the port P1.7, P1.6 of single-chip microcontroller D1,1 port of serial communication module connects power positive end, and the 4 of serial communication module
Port ground connection.The VCC termination power positive terminal of single-chip microcontroller D1, the end GND ground connection.1,2 ports of power module C1 connect vehicle power supply,
The positive terminal port of power module C1 connects the end each sensor 5V.
The physical circuit of above-mentioned second unit is as shown in figure 8, include five parts, in which: gravity accelerometer J2
2 ends, 3 ends be connected with the port P0.4, P0.5 of single-chip microcontroller D1,1 port of gravity accelerometer J2 connects power positive end,
4 ports of gravity accelerometer J2 are grounded;2 ends of gravity accelerometer J3,3 ends and single-chip microcontroller D1 P1.3,
The port P1.2 is connected, and 1 port of gravity accelerometer J3 connects power positive end, 4 ports of gravity accelerometer J3
Ground connection.2 ends, 3 ends of bluetooth module L1 are connected with the port P1.7, P1.6 of single-chip microcontroller D1, and 1 port of bluetooth module L2 connects power supply
Positive terminal, the 4 ports ground connection of bluetooth module L2.The VCC termination power positive terminal of single-chip microcontroller D2, the end GND ground connection.Power module C2
2 ports connect anode, 1 port of power module C2 connects power cathode.
A kind of detection system of steering wheel rotational angle provided by the invention, the course of work are as follows:
(1) first unit is connected firmly the parallel vehicle body 5 near steering wheel 2 to install, second unit is fixed on direction with plastic cement
On disk 2.After installing two units, the initialization of system is carried out, realizes that the clock of two single-chip microcontrollers is synchronous, establishes corresponding sit
Mark system, pilot control steering wheel determine initial position:
(2) component of the total acceleration on each axis of gravity accelerometer detection vehicle, and by the data of acquisition
Send single-chip microcontroller D1, D2 to;
(3) single-chip microcontroller D2 reads the detection data of gravity accelerometer J2, J3, is passed after processing by blue-tooth device L2
Single-chip microcontroller D1 is given,;Single-chip microcontroller D1 reads the data of single-chip microcontroller D2 and gravity accelerometer J1, is filtered place to data
After reason, conveyed with serial port form.
A kind of detection method of steering wheel rotational angle provided by the invention, specifically:
Two units are installed first, realize the initialization of system, and establish corresponding rectangular coordinate system in space.
1., single-chip microcontroller D2 by bluetooth module L2 to single-chip microcontroller D1 send data synchronization time, single-chip microcontroller D1, D2 are being received
After the detection data of gravity accelerometer J1, J2, J3 processing data can be carried out by the same time;
2., as shown in Fig. 3-4 and Fig. 6, first unit connects firmly the parallel vehicle body near steering wheel and is mounted on vehicle body, by vehicle
It carries power supply and electric energy is provided;Gravity accelerometer J1 is mounted on steering wheel hub axis 1 at steering wheel, is established with Chinese herbaceous peony
It is positive direction of the x-axis, is downwards z-axis positive direction and y-axis meeting in vertical vehicle body plane orthogonal with z-axis with vertical vehicle body into direction
The rectangular coordinate system in space A of right-hand rule;
3., as shown in Figure 5, Figure 7, second unit with plastic cement be fixedly mounted on the steering wheel, power module C2 provide electric energy,
Gravity accelerometer J2 is mounted on steering wheel hub axis top when steering wheel does not rotate, establishes inside with steering wheel hub axis
It is forward positive direction of the x-axis and y-axis meeting in steering wheel plane orthogonal with x-axis for z-axis positive direction, with vertical direction disk axis
The rectangular coordinate system in space B1 of right-hand rule;Gravity accelerometer J3 and gravity accelerometer J2 are orthogonal
It is mounted on steering wheel hub axis left part when steering wheel does not rotate, establishing with steering wheel axis is inwardly z-axis positive direction, with Vertical Square
It is forward positive direction of the y-axis to disk axis and the x-axis space for meeting right-hand rule in steering wheel plane orthogonal with y-axis is straight
Angular coordinate system B2;The origin of rectangular coordinate system in space B1, B2 are overlapped with acceleration transducer J2, J3 and with acceleration transducers
J2, J3 and steering wheel connect firmly rotation;
4., establish with steering wheel axis be inwardly z-axis positive direction, with vertical direction disk axis forward for positive direction of the x-axis
And the y-axis rectangular coordinate system in space C that meets right-hand rule, rectangular coordinate system in space C in steering wheel plane orthogonal with x-axis
It does not rotate, the basis of reference as rectangular coordinate system in space B1, B2;Rectangular coordinate system in space C is equivalent to rectangular coordinate system in space A
Steering wheel plane and vehicle body transverse direction angle α (0 90 ° of < α <) are rotated (in terms of from positive direction of the y-axis to negative direction) counterclockwise around y-axis.
Further, when vehicle remains static, gravity accelerometer J1, which detects to obtain acceleration of gravity, to exist
Numerical value in rectangular coordinate system in space A in x, y, z axis direction is a1x、a1y、a1z, acceleration of gravityIt can be by parallelogram
It is decomposed on the x of normal direction rectangular coordinate system in space A, z-axis, obtains relationship
The angle theta between vehicle and level road, i.e. road gradient can be calculated, calculation formula is
Further, when vehicle remains static, pilot control steering wheel clockwise slowly turn around by rotation, another mistake
Hour hands, which slowly revolve, to turn around, and gravity accelerometer J2, J3 detect vehicle acceleration, when gravity accelerometer J2 is detected
Numerical value maximum point on to its x-axis, gravity accelerometer J3 is detected when numerical value maximum point in its y-axis, it is specified that the position is
The initial position S of steering wheel, the point where gravity accelerometer J2, J3 are respectively origin o, o'.
When steering wheel is located at initial position S, acceleration transducer J2, J3 detect that the numerical value on x, y, z axis is respectively
a2xAnd a3x、a2yAnd a3y、a2zAnd a3z, meet
a2z=a3z,
Since the direction of acceleration of gravity is all acceleration of gravity straight downIt can be empty by parallelogram normal direction
Between the x of rectangular coordinate system A, decomposed in z-axis, relationship can be obtained:
Then steering wheel plane and vehicle body transverse direction angle α can be byIt acquires.
Further, when the vehicle is running, vehicle generates total accelerationGravity accelerometer J1, J2, J3 inspection
The acceleration of each axis is measured, the largest interval time of gravity accelerometer J1, J2, J3 detection data is 2 milliseconds, single-chip microcontroller
The time interval that D1, D2 read gravity accelerometer J1, J2, J3 detection data can be by user at 10 milliseconds to 200 millis
It is freely set between second, single-chip microcontroller D1, D2 obtain gravity accelerometer J1, J2, J3 by time interval set by user
Detection data.
Further, single-chip microcontroller D2 obtains the data of gravity accelerometer J2, J3 detection, carries out data processing, leads to
It crosses bluetooth module L2 and acceleration information and time data is sent to single-chip microcontroller D1, single-chip microcontroller D1 receives number by bluetooth module L1
According to single-chip microcontroller D1 receives the data of gravity accelerometer J1 transmission simultaneously.
Further, temporally data handle the detection data of synchronization to single-chip microcontroller D1, when steering wheel is located at
When initial position S, by vehicle accelerationIt decomposes on each axis of rectangular coordinate system in space C, sets numerical value on each axis at this time
For acx、acy、acz, calculation formula is
When one angle γ of pilot control direction disc spins, acceleration transducer J2, J3 can be detected on its x-axis to be added
Speed values are a2x'、a3x', detect that acceleration value is a on the y axis2y'、a3y', detect that acceleration value is in z-axis
a2z'、a3z', what acceleration transducer J2, J3 was detected at this time is vehicle entirety acceleration in rectangular coordinate system in space B1, B2 couple
Each axis decomposed after numerical value, on the basis of rectangular coordinate system in space C, data that acceleration transducer J2 is measured meet
Simultaneous Equations (1) are available:
Steering wheel rotation angle γ is gone out by first equation solution of equation group (3)11, formula are as follows:
Steering wheel rotation angle γ is gone out by second equation solution of equation group (3)12, formula are as follows:
Wheel steering angle γ1Calculation formula are as follows:
On the basis of rectangular coordinate system in space C, the data that acceleration transducer J3 is measured meet:
Simultaneous Equations (1) are available:
Steering wheel rotation angle γ is gone out by first equation solution of equation group (5)21, formula are as follows:
Steering wheel rotation angle γ is gone out by second equation solution of equation group (5)22, formula are as follows:
Wheel steering angle γ1Calculation formula are as follows:
The calculation formula of wheel steering angle γ are as follows:
When single-chip microcontroller D1 is calculated | γ11-γ12|≥2°、|γ21-γ22|≥2°、|γ1-γ2| at >=2 °, single-chip microcontroller
D1 not output data packet prompts result mistake.
Further, after single-chip microcontroller D1 calculates steering wheel angle, due to vehicle shake etc., acceleration can be sawed
Dentation fluctuation, therefore data need to be filtered, mode is filtered are as follows: single-chip microcontroller D1 arbitrarily obtains continuous five moment
Steering wheel rotational angle data and store, carry out curve fitting, predict next steering wheel angle number by plots changes
According to, and export the steering wheel angle data of the curve matching at this moment;
Data are sent, steering wheel angle data are first converted to serial data, JC by JC communications protocol by single-chip microcontroller D1
Communications protocol regulation: all data are converted into ASCII transmission, and each data packet includes 25 data/characters, and the 1st, 2 is number
According to packet header " JC ";3rd to 11 for when meta position, format be "+two bps clock+three milliseconds of number of+two the number of minutes of two hourages
Number ";12nd to 13 is direction position, and format is " direction of rotation+one number of full circle position in position ", direction of rotation position regulation inverse time
Needle is 0, is clockwise 1;14th to 18 is current steering wheel angle of rotation degree, and format is " three whole degree+decimal points+one
Position decimal ";19th to 20 bit check position, verification rule be the data of front the 1st to 18 be converted into hexadecimal after sum, take and
Number removes 256 remainder;21st to 25 is estimated steering wheel angle of rotation degree, and format is " three whole degree+decimal points+one
Decimal ";Single-chip microcontroller D1 exports the data packet of the period, 8 data bit, 1 stop position, no odd even by serial communication module
Verification, baud rate scope are 9600bps~115200bps.
Although specifically showing and describing the present invention in conjunction with preferred embodiment, those skilled in the art should be bright
It is white, it is not departing from the spirit and scope of the present invention defined by the appended claims, it in the form and details can be right
The present invention makes a variety of changes, and is protection scope of the present invention.