[vc_row][vc_column][vc_column_text]
[/vc_column_text][/vc_column][/vc_row][vc_row][vc_column width=”1/1″][vc_tour][vc_tab title=”1.Know the modules” tab_id=”1411780447-1-74″][vc_column_text]a. Control board
b. Laser transmitter
c. Galvanometer and driver
d. Power supply (The left one powers control board and galvanometer, the right one powers laser transmitter
[/vc_column_text][/vc_tab][vc_tab title=”2.Connect control board with pcDuino” tab_id=”1411780447-2-88″][vc_column_text][/vc_column_text][/vc_tab][vc_tab title=”3.The connection of power supply” tab_id=”1411780472230-2-2″][vc_column_text]
a. The galvanometer signal: 220V AC connected to input(L,N), output(V+,V-) connected to VIN of driver, laser control wire connected to control board which mentioned in the above picture.
b. Control board and galvanometer: 220V AC connected to input (L, N), output (V+, GND, V-) connected to power input as in the below picture.
c. Connect 220V AC as below: Put two 220V AC power supply’s L,N together, then plug into power.
[/vc_column_text][/vc_tab][vc_tab title=”4.Test code” tab_id=”1411780473152-3-8″][vc_column_text]
#include <core.h> #include<math.h> #define uchar unsigned char #define uint unsigned int #define WR_Control 10 #define Enable 0 #define Disable 1 #define channel_x HIGH #define channel_y LOW #define Select_Channel 11 #define LED_ON digitalWrite(12,HIGH) #define LED_OFF digitalWrite(12,LOW) void AD7528_write_byte(uchar dat) { uchar i; for(i=2;i<10;i++) { if((dat&0x01)) digitalWrite(i,HIGH); else digitalWrite(i,LOW); dat >>= 1; } } void AD7528_write_data(uchar channel,uchar dat) { LED_ON; digitalWrite(Select_Channel,channel); digitalWrite(WR_Control,Enable); AD7528_write_byte(dat); digitalWrite(WR_Control,Disable); LED_OFF; } void out_xy(int x,int y) { digitalWrite(WR_Control,Disable); AD7528_write_byte(y); digitalWrite(Select_Channel,channel_y); digitalWrite(WR_Control,Enable); digitalWrite(WR_Control,Disable); AD7528_write_byte(x); digitalWrite(Select_Channel,channel_x); digitalWrite(WR_Control,Enable); digitalWrite(WR_Control,Disable); } void Create_Point(uchar x,uchar y) { AD7528_write_data(channel_x,x); delayMicroseconds(1); AD7528_write_data(channel_y,y); delayMicroseconds(1); } void draw_line(uint x1,uint y1,uint x2,uint y2) { uint t; int xerr=0,yerr=0,delta_x,delta_y,distance; int incx,incy,uRow,uCol; delta_x=x2-x1; //ŒÆËã×ø±êÔöÿ delta_y=y2-y1; uRow=x1; uCol=y1; if(delta_x>0)incx=1; //ÉèÖõ¥²œ•œÃò else if(delta_x==0)incx=0;//Ž¹Ö±Ãß else {incx=-1;delta_x=-delta_x;} if(delta_y>0)incy=1; else if(delta_y==0)incy=0;//ˮƜÃß else{incy=-1;delta_y=-delta_y;} if( delta_x>delta_y)distance=delta_x; //Ñ¡È¡»ù±ŸÔöÿ×ø±êÖá else distance=delta_y; for(t=0;t<=distance+1;t++ )//»ÂÃßÊä³ö { //delayMicroseconds(5); out_xy(uRow,uCol);//»Âµã //LED_ON; //delayMicroseconds(15); //LED_OFF; //delayMicroseconds(10); xerr+=delta_x ; yerr+=delta_y ; if(xerr>distance) { xerr-=distance; uRow+=incx; } if(yerr>distance) { yerr-=distance; uCol+=incy; } } } void DrawCircle( int cx, int cy, int r ) { float t; int x,y,px,py; t=0; px = r + cx; py = cy; while(t<=2) { x = cos(t*PI) * r + cx; y = sin(t*PI)*r+cy; draw_line(x,y,px,py); t = t + 0.01; px = x; py = y; } //draw_line(x,y,r+cx,cy); } void setup() { uchar i; for(i=2;i<13;i++) { pinMode(i,OUTPUT); } digitalWrite(WR_Control,Disable); LED_OFF; } void draw_star(uchar x,uchar y,uchar size) { LED_ON; draw_line(x+size*2,y+size*5/4,x,y+size*5/4); draw_line(x,y+size*5/4,x+size*2,y); draw_line(x+size*2,y,x+size,y+size*2); draw_line(x+size,y+size*2,x,y); draw_line(x,y,x+size*2,y+size*5/4); LED_OFF; } #define time 450 uchar table[]={ 1,10,60,30,120,50,10,90,60,80,49,100,50,30,2,100,40,80,20,120, 20,23,90,50,20,60,100,120,90,10,60,30}; void loop() { for(int j=0;j<16;j++) { for(int i=0;i<20;i++) { draw_star(table[j],table[j+1],30); delayMicroseconds(100); } } delay(300); int i; for(i=0;i<100;i++) { //display 'A' out_xy(62,0); delayMicroseconds(time); LED_ON; //delayMicroseconds(500); draw_line(62,0,52,0); draw_line(52,0,46,17); draw_line(46,17,16,17); draw_line(16,17,10,0); draw_line(10,0,1,0); draw_line(1,0,25,63); draw_line(25,63,37,63); draw_line(37,63,62,0); delayMicroseconds(800); LED_OFF; //delay(1); out_xy(43,25); delayMicroseconds(time); LED_ON; //delayMicroseconds(500); draw_line(43,25,31,56); draw_line(31,56,19,25); draw_line(19,25,43,25); delayMicroseconds(800); LED_OFF; } delay(300); for(i=0;i<120;i++) { out_xy(9,16); delayMicroseconds(1000); LED_ON; draw_line(9,16,37,16); draw_line(37,16,37,167); draw_line(37,167,68,167); draw_line(68,167,68,16); draw_line(68,16,105,16); draw_line(105,16,105,109); draw_line(105,109,129,109); draw_line(129,109,129,16); draw_line(129,16,153,16); draw_line(153,16,153,202); draw_line(153,202,179,202); draw_line(179,202,179,20); draw_line(179,20,205,20); delayMicroseconds(1000); LED_OFF; } delay(300); }
[/vc_column_text][/vc_tab][vc_tab title=”5.Testing Results” tab_id=”1411780575977-4-5″][vc_column_text] [/vc_column_text][/vc_tab][/vc_tour][/vc_column][/vc_row]
Leave a Reply
You must be logged in to post a comment.