2011년 12월 27일 화요일

엔코더(ENCODER) - 월간 FA 저널 게제 기사 - 제 1 회

http://cafe.naver.com/circuitsmanual.cafe?iframe_url=/ArticleRead.nhn%3Farticleid=20311&

- 엔코더는 물리 적인 직선상의 위치 또는 원운동의 회전각과 운동 방향 정보를 전기적인 신호로 외부에 보내는 센서이다. 기계적인 이동량, 이동속도 그리고 가속도 정보을 알아내기 위하여 FA 시스템의 중요한 요소이다. CNC 공작기계, ROBOT, 금형 측정기에 엔코더가 사용된다. -

Add an industrial NEMA17 Stepper Motor to your CUBLOC or CuTOUCH

http://zedomax.com/blog/zedomax-diy-hack-add-an-industrial-nema17-stepper-motor-to-your-cubloc-or-cutouch/

Add an industrial NEMA17 Stepper Motor to your CUBLOC or CuTOUCH.
(CublocStudio v1.5.A & Above)
[gv data="PJHhXAL6iVY"][/gv]
Do u want to add a NEMA17 stepper motor to your CUBLOC or CuTOUCH?
Here’s how to do it w/ the new CublocStudio v.1.5.A.
Today we will use a R208 Microstep Driver from RMS Technologies and a NEMA-17 Stepper Motorfrom AutomationDirect.com.
I was thinking today
that I needed to make use of the some stepper motors for industrial apps.
With the 3 new commands w/ CublocStudio v.1.5.A upgrade,
I think I can control a stepper motor very precisely and accurately.
Anyways, my plan is to eventually make some robots with this stepper motor, here we go.

Required Parts:
1 R208 Microstep Driver
order from www.linengineering.com

1 NEMA-17 Stepper Motor
(any NEMA17 Stepper Motor would work)
Part #
STP-MTR-17048
order from www.automationdirect.com
1 CB280

1 Study Board
Motor Driver & Motor Connections
All right, first, I decided to have a look at the R208 Microstep Driver manual.
If you skim through, you will find the pin assignments and a diagram like this:
As you can see here, you want to connect as shown.
Connecting the motor should be pretty easy to do.
You can ground Pin 2,3 for now to set at FULL step mode,
which will turn the motor a FULL step per pulse sent from CUBLOC.
Here’s the pin2 and 3 specs:
I decided to connect direction Pin 5 to 5V for now,
but I can hook it up to one of the CUBLOC I/O pins to control direction later.
Connect Pin 9(Yellow) to any of the I/O pins on the CUBLOC.
I’ve connected mine to P5, port 5.
Let’s take a brief look at the motor specs too:
and:
The chart here shows that the motor will have a different characteristics depending on the stepping method used.
We are using Full step, so we should have lots of torque,
but shouldn’t expect too much RPMs…
After putting everything together, you should get something like below:
There are 3 new commands for stepper motor w/ the new CublocStudio.
Command
Syntax
Features
STEPPULSE
STEPPULSE [channel], [Port Number], [Frequency], [# of pulses]
Output set number of pulses @ set frequency to set port.
- Maximum Frequency: 15KHz
- Channel must equal 0
- When using channel 0, PWM 3,4,5 may not be used
STEPSTOP
STEPSTOP channel
Stop outputting pulses
STEPSTAT( )
variable = STEPSTAT(channel)
Return # of pulses left to output
The channel is referred to as Steppulse channels.
But as of now, you can only have 1 channel for CB220, CB280, CB290, CT1720, and CT1721.
(Classified: Future modules CB4XX, will have 2 channels.)
Anyways, you can set the any Port to output your step pulses.
This command will accurately output desired # of pulses @ desired frequency up to 15kHz,
which is what you need for Step motor control.
Now, let’s make a simple BASIC code that will output to my NEMA17 motor @ 1kHZ.
Source Code
[steppermotor001.cul]Const Device = CB280
#define PORTNUMBER 5
Dim ct As Long
Dim steps As Integer
Dim Frequency As Long
Output PORTNUMBER
ct=0
Frequency=100
steps=Stepstat(0)
Debug Dec steps,Cr
Do
Steppulse 0,PORTNUMBER,Frequency,1000
‘Stepstat() function returns current # of steps
steps=Stepstat(0)
Do While steps>0
steps=Stepstat(0)
Debug Dec steps,Cr
Loop
Debug “Frequency: “, Dec Frequency,Cr
If Frequency<1200 Then
Frequency = Frequency + 400
End If
Delay 300
Loop
As you can see in the above, Steppulse 0,PORTNUMBER,Frequency,1000
command will output 1000 pulses to the step motor starting @ frequency of 100Hz.
This motor is rated at 1.8 degrees per step which equals 200 steps per revolution.
By outputting 1000 pulses, the motor should turn 5 times since 1000/200 = 5.
We will use Stepstat() to wait until all the pulses have been outputted
before increasing the Frequency by 400Hz and outputting pulses again.
You should see the motor slowly increasing in speed and topping out at 1.2kHz.
You can do higher frequencies by adjusting the motor driver’s pin 2 and pin 3,
which will allow you to get higher resolution up to 1/8 steps.
If you look at the following video,
you can see that at maximum speed of my motor stopping at the tip of my finger every 5 turns.
Now I think u should be able to make some stepper motor apps pretty easily…

If you are having any trouble with above app, please e-mail max@zedomax.com
If you have any cool apps you’d like to share, please e-mail to max@zedomax.com

2011년 12월 26일 월요일

헬스바이크

헬스바이크

NPN과 PNP의 차이점

NPN과 PNP의 차이점

NPN type에서 다시 NO,NC 종류로 나뉘어 지므로 모두 4종류가 있다고 할수 있습니다.
물론 둘다 흑색이 출력이므로 흑색과 청색을 전압계로 찍었을때 입니다.


1.NPN,NO type 은 검출물체가 있는 경우 출력은 0이 됩니다. 검출물체가 없는 경우는 24V(+V 전압)이 나옵니다.
실제로는 24V 보다 약간 낮게 나오겠네요.



2.NPN,NC type은 검출물체가 있는 경우 출력은 24V가 나옵니다. 검출물체가 없는 경우는 0이 되죠.
NPN type의 경우 비록 24V는 나오지만 이것으로는 어떠한 부하(모터나 램프등등)를 동작할수 없습니다.
즉 위의 그림처럼 부하의 한쪽은 반드시 +V에 연결하여 사용해야 하고 출력이 0이 될때 부하가 동작하는 것입니다.

3.PNP,NO type은 검출물체가 있는 경우 출력은 24V가 나오고 검출물체가 없는 경우 0이됩니다.


4.PNP,NC type의 경우 검출물체가 있는 경우 출력은 0이되고 검출물체가 없는 경우 24v가 나옵니다.
PNP type의 경우 부하는 한쪽을 반드시 GND(0V)에 연결해 사용해야 합니다.

조금 헷갈릴수 있지만 사실 간단합니다.
우선 NPN,PNP의 차이는 부하의 한쪽선을 24V에 연결할것인지, GND에 연결할것인지 결정이고,
NO,NC는 검출했을때 동작을 할것인지, 검출을 하지 않았을때 동작하다가 검출할때 멈출것인지의 차이죠.
예를 들어 손을 가까이 하면 물이나오는 장치를 만든다고 가정합니다.



물의 꼭지를 조정하는 솔레노이드나 모터를 한쪽선은 24V에 다른 선은 흑색에 연결한 상태에서 검출했을때만

동작하게끔 하고 싶다면 NPN,NO type으로 선정하면 됩니다.

npn,pnp센서와 plc입력방식

npn,pnp센서와 plc입력방식

Blog/IT Information 2009/03/19 11:01by 나르
제가 알기로는 plc도 npn(동양)type 과 pnp(서양)type이 있고 엔코더아 각종센서등에도 npn(동양)type 과 pnp(서양)type이 있는 걸로 알고 있는데 이들 각각의 결선 방법에 대해 알고 싶습니다. 참고로 센서들은 3선식인 갈색,흑색,청색이고 엔코더는 5선인 갈색,흑백,흰색,청색,실드선으로 각각의 결선 방법에 대해 알고 싶습니다.
사용자 삽입 이미지

요즘 대부분의 PLC는 COMMON단자에 +든-든 관계없이 구성할 수 있습니다.
센서의 갈색은 + ,흑색은 출력,청색은 -..
엔코더의 경우는 백색과 등색등이 추가되어서
갈색+,청색-,흑색A상,백색B상,등색Z상(메이커마다 다를 수 있습니다).
NPN형 센서의 경우라면 위도면에서 PLC의 COMMON단자에 +를,
P0에는 센서의 출력선인 흑색선을 연결하면 되겠죠

>그리고 소스와 싱크에 대해서도 자세히 알고 싶고요, pnp타입의 센서 및 엔코더를 npn타입의 plc 에 릴레이를 사용하여 결선하여 임시방편으로 사용 할수있다고 하는데 그것도 궁금합니다.
>저도 알고 있지만 제가 아는게 확실한 것이지 알고싶습니다.

사용자 삽입 이미지


위의 그림이 plc입력방식중에 소스입력방식입니다.
간단히 익히시려면
전류의 흐름을 보세요.
전류는 실제로 +에서 -로 흐르므로 입력모듈에서보자면 전류를 내보내는 형식이 소스방식입니다.

싱크는 이와 반대로 전류를 유입시키는 방식입니다.
그럼 plc common은 -로 결선이 되어야겠죠.
그래야 입력모듈에서 보자면 전류가 유입되는 형식이 되겠죠.

릴레이를 사용하여 입력을 한다는 것은 전류의 흐름을 맞춰 준다는 의미로 사용가능 합니다.
결국 릴레이 홀딩을 시켰을때 릴레이 접점으로 연결되는 전기의 극성을 -로 p0에 연결하면 plc입력으로 사용할수사 있겠죠.


>그리고 입력카드의 종류중 dc싱크와 dc소스가 있는데 이것이 각각pnp타입 npn타입의 plc를 일컷는 것인지 궁금합니다.

위그림에서 이해하셨겠지만 소스입력방식의 plc라면 입력카드에 +common이 되어 있는상태이니까
-의 출력값을 가지고 있는 npn형의 센서를 사용해야겠고
싱크입력방식의 plc라면 입력카드에 -common이 되어있는 상태이니까
+의 출력값을 가지고 있는 pnp형의 센서를 사용해야겠지요.
간단히 말하자면 이렇습니다.
센서가 유니버샬출력형이든 오픈콜렉형이든 간에 npn과 pnp의 형태는 맞춰줘야합니다.
그래야 전류의 흐름이 맞겠죠.

>한가지더 npn타입의 센서의 갈색을 dc+24를 접속하고 plc의 com단자에 dc+24를 접속하고 흑색은 p0001인 디바이스에 연결하고 청색은 청색을 dc-24에 연결하는게 npn타입의 센서를 npn타입의 plc에 연결하는 올바른 접속방법인줄로 알고 있는데 npn타입의 센서의 갈색을 dc+24를 접속하고 plc의 p0001인 디바이스에 dc+24를 접속하고 흑색을 plc의 com단자에 청색을 dc-24에 연결하는것은 무엇을 의미하는지요 이두가지 결선이 바로 첫번쨰가 소스타입의 npn plc입력카드에 연결방법이고 두번쨰가 싱크타입의 npn plc입력카드에 연결방법인지 궁금합니다.

맞습니다.
첫번째 방식이 위에서 말씀드린것처럼
npn형 센서로 소스입력방식의 plc에 결선하는것이고 정상적인 결선이죠.
두번째 결선방식은 plc의 입력방식이 싱크타입인데도불구하고,
임시방편으로 npn형의 센서를 결선한 방식입니다.
중요한것은 전류의 흐름을 파악하시면 이해가 가실겁니다.
두번째의 경우에 동작이가능한 이유는 싱크입력방식은 plc에 -common이 되어있는상태가 아닌
p0에 이미 +가 입력이 되어있고 센서 작동시 common을 통하여 전류의 흐름이 발생하기 때문이겠죠.

맨위에서 말씀드린것처럼 요즘 기본값으로 나오는 plc의 입력방식은 도면처럼 소스와 싱크
두가지 입력이 다 가능합니다.

간단히 더 설명 드리자면
소스와 싱크의 두가지로 나눈 이유는
기기의 특성에 따라 소스든 싱크를 사용할수 있기때문에 분류가 됩니다.
한 예로 소스의 입력방식은
plc의 common이 +이고 스위치를 통하여 p0에 결선되는것이 -입니다.
만약 스위치에 결선된 -의 전선이 어떤이유로든 접지(혹은 도장이 안된 박스에 닿는 경우)가 된다면
어떻게 될까요?
전류의 흐름을 볼때
소스방식은 전류를 내보내는 형식이므로 입력접점이 삽니다.
기기 오작동이 일어날 수가 있겠죠.
출력에도 릴레이 출력과 트라이액출력 ,그리고 tr출력으로 구분됩니다.
tr출력에는 당연히 싱크와 소스방식이 있겠구요.
출력쪽도 당연히 전류의 유입이냐 유출이냐로 소스싱크를 구분할 수있겠습니다.
....
허접 답변이었습니다.
도움이 되시길....
[출처] |작성자 감찬이

2011년 12월 22일 목요일

Processing

http://www.processing.org/


Processing is an open source programming language and environment for people who want to create images, animations, and interactions. Initially developed to serve as a software sketchbook and to teach fundamentals of computer programming within a visual context, Processing also has evolved into a tool for generating finished professional work. Today, there are tens of thousands of students, artists, designers, researchers, and hobbyists who use Processing for learning, prototyping, and production.               

2011년 12월 16일 금요일