View previous topic :: View next topic |
Author |
Message |
ertansuluagac
Joined: 13 Jul 2017 Posts: 135 Location: IZMIR
|
wiper motor control with encoder |
Posted: Fri Apr 19, 2019 3:13 am |
|
|
Hello To Everyone;
I want to check the silgec engine with encoder. Is there any document and circuit diagram on this topic? How can I control the silgec motor. And I'm going to check it with a PC. (RS-232 OR RS-485)
ertansuluagac@windowslive.com _________________ Es |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19378
|
|
Posted: Fri Apr 19, 2019 6:09 am |
|
|
You need to tell us a lot more:
Model of the Silecek motor?.
What encoder?.
What do you actually want to 'do' (move to a position?. speed control?).
What PIC do you intend to use?.
I'm guessing motor like this?.
<https://www.robotshop.com/uk/12v-dc-motor-251rpm-encoder.html>
As a minimum, you'll need an H-Bridge power drive, with perhaps a
10A rating. |
|
![](templates/subSilver/images/spacer.gif) |
ertansuluagac
Joined: 13 Jul 2017 Posts: 135 Location: IZMIR
|
|
Posted: Fri Apr 19, 2019 6:30 am |
|
|
http://www.tepas.com
Planetary Geared Direct Current Motor (Type 4225 PL100).
Processor does not matter. If he tells me how many mm to I go from computer to X, I'll go that far.
for example;
x = 500mm
I'il take the engine 500 steps. _________________ Es |
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9177 Location: Greensville,Ontario
|
|
Posted: Fri Apr 19, 2019 7:09 am |
|
|
I went to the site, encoder is simple 100 PPR (100 steps per revolution), I think.
That's a very low count sensor, so easy for ANY PIC to work with.
Use an ISR to detect encoder rotation and direction, there should be basic code either in the CCS supplied examples, this forum or the code library.
As for the actual motor drive, you'll need some form of 'power' interface. If bidirectional (fwd-rev) is needed, an H-bridge is best solution. One way only ? Use a simple FET, in low side. As for actual components, you'll have to read the datasheets and do some bench testing.
As for communicating with PC, use a PIC with a hardware UART. That gives you ISR ability, needed for realtime control.
Jay |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19378
|
|
Posted: Fri Apr 19, 2019 7:11 am |
|
|
You do understand this is a forum for questions about _PIC_ processors
using CCS C?.
If this is a normal DC motor, you can't move it in 'steps'. You have to
accelerate the motor in the direction you want it to move, then decelerate as
you approach the distance you want to go. Ramping the power down till
you get to the desired point. This needs a processor....
There are 'off the shelf' DC motor control processor modules to do this
like:
<https://www.robotshop.com/uk/sdc2160s-60v-1x40a-brushed-dc-motor-controller.html?gclid=Cj0KCQjw4-XlBRDuARIsAK96p3ChMxTGpm2_19CBy2xMGgH7IewULCmGIO6H9pl4joVIuNDARQO5p9caAlJAEALw_wcB>
But if you want to design your own, you are going to have to start talking
a processor to do this. |
|
![](templates/subSilver/images/spacer.gif) |
ertansuluagac
Joined: 13 Jul 2017 Posts: 135 Location: IZMIR
|
|
Posted: Fri Apr 19, 2019 7:33 am |
|
|
Of course I will do it myself. I'm just asking if there's an example of how I should do it. I'm not telling you to do this project. I know how to code a little bit. I'm just asking how to proceed. That's all. Please do not pull my question in the wrong place. _________________ Es |
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9177 Location: Greensville,Ontario
|
|
Posted: Fri Apr 19, 2019 9:06 am |
|
|
breakdown the project into logical functions
I see
0) basic PIC operation
1) encoder
2) display
3) motor control
4) PC interface
0) simple 1Hz LED program, 'Hello World" tests
1) encoder . simple code to read and display encoder bits
2) display ( usually an LCD module, 2by16 or 4 by 20).
3) motor control. set speed(PWM?) and direction(if needed)
4) PC interface. Usually done with a TTL<>USB module, send text to/from a 'terminal program'.
You'll have to decide which of the 1,000s of PICs to use though ! I'd select one with at LEAST 1 HW UART and PWM/H-bridge peripherals.
Jay |
|
![](templates/subSilver/images/spacer.gif) |
ertansuluagac
Joined: 13 Jul 2017 Posts: 135 Location: IZMIR
|
|
Posted: Sat Apr 20, 2019 4:19 am |
|
|
This, I will use the model of the engine:
Permanent Magnet DC Motor with reduction box and encoder (Type 4225 PL100)
Reduction: 1/27
Encoder: 2 Channel - 100 Pulse
Voltage (Vdc): 24
Power (W): 70
Current (A): 4
Speed (rpm): 120
Duty Cycle (%): S3-30
The information is writing from datasheet . As I understand it, when I give the voltage, the motor is turning. And I can only get position information from this engine. How can I do it ? _________________ Es |
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9177 Location: Greensville,Ontario
|
|
Posted: Sat Apr 20, 2019 5:12 am |
|
|
CCS supplies a basic encoder program, in the 'examples' folder, ex_encod.c.
It will allow you to see how your encoder works.
I obviously don't have your motor/encoder so I can't test though.
You should be able to run your motor with a variable (0-24) power supply and see results!
Jay |
|
![](templates/subSilver/images/spacer.gif) |
elcrcp
Joined: 11 Mar 2016 Posts: 62 Location: izmir / Turkey
|
|
Posted: Sat Apr 20, 2019 11:40 am |
|
|
Hi Ertan,
Unfortunately your question lacks information.
There might be sample codes in code library section but there are multiple parts of the job you ask. First you need a motor driver to run that motor, controlling that driver is a part of the code and might be found in code library, reading encoder and calculating distance and direction is another part. PC interface is also another. Combining these together is again another job.
Now you know what motor you gonna use, so you should choose or build your driver model, if reading encoder needs extra electronic parts (might be, due to voltage differance or signal shape) you need to pick them, then you decide PC interface, and lastly you should pick a PIC model which can support your choices.
But if you are looking for an experimented circuit design and code which does what you ask for then you should google it more. _________________ There is nothing you can't do if you try |
|
![](templates/subSilver/images/spacer.gif) |
ertansuluagac
Joined: 13 Jul 2017 Posts: 135 Location: IZMIR
|
|
Posted: Sat Apr 20, 2019 2:22 pm |
|
|
No, I don't think so. So the only difficult thing here is to determine the direction.The motor starts to rotate when voltage is applied. Direction from pins A and B will be determined. But how? That's what I want to know. I will also use the processor PIC16f88. and RS-232 is the easiest job. Another thing that makes me think is that the data page says this. 2 outlets - 100 pulse writing. What does it mean. That's all. _________________ Es |
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9177 Location: Greensville,Ontario
|
|
Posted: Sat Apr 20, 2019 3:04 pm |
|
|
re:
2 outlets - 100 pulse writing.
2 outlets, means "A" and "B", the 2 phases of an encoder. You determine which is forward and reverse. There are 4 'phases' to a quadrature encoder pulse train. It's up to you to decide which sequence is 'forward'. There is a LOT of information about encoders on the internet. MFRs like US Digital have great spec sheets and application notes. Also several an early PC 'mouse' was based on a PIC with 2 encoders as inputs, outputting the data to the PC via RS232. There should be a Microchip application note online. I know 'Parallax STAMPS' have an article about using 'optical encoders', it's probably 20 years old.
100 pulse writing
probably means that there are 100 pulses per 360* rotation of the shaft. In the World of encoders that's very few per rotation. The ones I used were 1024/4096 per rotation. |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19378
|
|
Posted: Sun Apr 21, 2019 7:33 am |
|
|
Basic quadrature.
Two square waves, 90 degrees out of phase of one another.
For a 100PPR encoder, there are 400 detectable 'positions'. Corresponding
to the rising and falling edges of each waveform.
Direction is detected according to which waveform leads the other. So:
Code: |
Forwards
A B Phase
0 0 0
0 1 1
1 1 2
1 0 3
0 0 0
Backwards
0 0 0
1 0 3
1 1 2
0 1 1
0 0 0
|
So when moving 'backwards', you find the edges moving through the
phase patterns in the reverse order to when you are moving forwards.
Basic quadrature decoder code (or hardware), will automatically do this.
The compiler has a basic quadrature code supplied in the examples, or
versions optimised for more speed have been posted here in the past.
Some chips have hardware decoders. These allow much higher speed,
but in your case (100PPR), these are unlikely to be needed (they become
essential when dealing with things like 10000PPR encoders....).
As others have said you need to treat this as a multi-step process.
First get an H-Bridge driver working (remember you will need to ensure
that RF noise from the motors is not coupled into the PIC, and ensure
that the driver correctly traps the energy when the motor overruns).
Then look at decoding the quadrature signals.
Then combine to form a 'servo' code.
Microchip has a number of servo application notes. These are well worth
looking at. |
|
![](templates/subSilver/images/spacer.gif) |
ertansuluagac
Joined: 13 Jul 2017 Posts: 135 Location: IZMIR
|
|
Posted: Sun Apr 21, 2019 1:43 pm |
|
|
What is the name of your compiler's sample file. How to access the applications for Microchip's servo. If you know the link address, can you share it? How do I use the table you write for A, B, and phase? Can you write me a simple, clear code? I don't know how to use this. _________________ Es |
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9177 Location: Greensville,Ontario
|
|
Posted: Sun Apr 21, 2019 1:49 pm |
|
|
CCS supplies an example of encoder with PIC. it's called EX_ENCODE.C (I just checked..),it's located in the examples folder.
Obviously you'll have to change PIC type, some 'fuses', maybe the I/O pins, but it IS simple, basic working code.
Jay |
|
![](templates/subSilver/images/spacer.gif) |
|