Tuesday, February 25, 2014

Laser Cutter Tutorial

Safety First

- It is very easy to start fires with the laser cutter, never leave machine alone while cutting
- The laser cutter can also produce dangerous fumes (e.g. chlorine) if used with improper materials. Never cut PVC, or other chlorinated plastics.


User Laser cutter for 
- Cutting acrylic, wood, paper and foamcore. You can not cut metals with 100W laser cutter.
- You can raster (image) engravings into above materials as well as glass, stone, slate, etc.


Driver Software
You can use either fab modules or CorelDRAW software for laser cutter.

Fab modules

CorelDraw Software
- Import 2D .dxf files, Postscripts files and general pixmaps
- All the lines in 2D design sign should have minimum width hairline ("0.04") to be preserved as "vector" cuts
(lines/arcs). Wider lines will be automatically rasterized.
- Line colors are mapped to different laser speeds, powers, and PPI by the CorelDraw laser cutter driver.
- Load or import your drawing into CorelDRAW and change the paper size to the dimensions of the laser cutter. "Layout...Page setup", page size should be 32" x 18"

Procedure 


Step - 1: Turn on Laser Cutter 

The switch is in the rear-right of the unit. The cutter takes approximately 30 seconds to power-on/boot.

Step - 2: Clean Lens

When the cutter is used with a dirty lens, particles can ignite and destroy the lens. So it is important to clean the lens before using laser cutter. Follow this procedure - 
- Unscrew the three thumbscrews and remove lens assembly.
- Soak cue-tip with one or two drops of cleaning liquid and gently clean the lens using it.

Step - 3: Set bed to focus height

 If not properly focused, the laser cutter won't properly cut. This will results in a poorly cut part, as well as produces lots of extra material residue and gas, which is especially problematic with acrylic and other plastics.
- Put the sheet you want to cut on laser cutter bed.
- Bring the laser cutter head near to center of your cutting area.
- Put the plastic focusing tool below the laser cutting head.
- Increase the height of the bed until the head touches the shoulder of plastic focusing tool. Press "Select" to toggle between Fast and Slow z-adjust and use Up and Down arrow to move laser cutter bed.

Monday, February 24, 2014

STM32 Evaluation Board

Introduction

Description of the board and all the necessary documents can be found here 




USB Device and Host using Eval board

1) Download the library from here
2) Download the user manual for library. In the project folder read "readme" file on how to run the code.

For VCP example

Connect TX and RX pins: PC10 and PC11 (with a cable or a jumper). PC10 is UART4_TX and PC11 is UART4_RX. The micro-controller in the kit is in UFBGA176 package. In the board PC10 is in connector CN4 pin no 36 and PC11 is in connector CN4 pin no 35. A jumper can be used to simply connect them.

Jumper JP22 should be connected in position 1-2 (Rs232)

Wednesday, February 19, 2014

Getting Started with STEM32

We are going to use STM32F4 Discovery Board. 

Things you need


1) STM32F4-Discovery Board
2) Keil uVision

STM32F4DISCOVERY board includes an ST-LINK/V2 embedded debug tool interface. The embedded ST-LINK/V2 supports only SWD interface for STM32 devices

Documentation


The library documents, examples etc are difficult to find even in ST website. For library documentation, you can check this website.

All resources in general here


Discovery Board support library
http://web.eece.maine.edu/~hummels/classes/ece486/docs/libstm32f4_doc/modules.html

STM32F4 Peripheral Library
http://web.eece.maine.edu/~hummels/classes/ece486/docs/libperiph_doc/modules.html

To document follow this guide line

Features of STM32F4 uC


- Three 12-bit ADCs. They can be used separately or combined. When used in combined mode sampling rate unto 1MSPS can be achieved.
- Two DACs
- One low-power real-time clock (RTC)
-  Twelve general-purpose 16-bit timers including two PWM timers for motor control, two general-purpose 32-bit timers. a true random number generator (RNG). TIM1 and TIM8 are advanced timer.

Note on RX/TX pins of Discovery board:  Discovery board has uC which has LQFP100 pin-out. PC10 is pin 78 which is UART4_TX and PC11 is pin 79 which is UART4_RX. 


VCP using CDC Library

The buffer reseaving data in STM32F4 part is defined as uint8 so whatever data you send from MATLAB or any other serial port device should be of the form character or uint8. If you want to set some value of register (say DAC register to set some output value) send it as uint8 in matlab (check interpret data as hex..) in tmtool. Use the following command

fwrite(obj1, [hex2dec('B')], 'uint8');

If the register is uint16, then find a way to use two uint8 to make one uint16
uint8_t d1=0x01; 
uint8_t d2=0x02;  
uint16_t wd = (d2 << 8) | d1;

For rest you can use %c\n or %s\n for communication.








Once the code is successfully uploaded, use the reset button to run the code.



Using STLink/v2 for Debugging and Programming

1 - Download and install STM32 ST-Link Utility
2 - Connect the discovery board via USB. Reset board
3 - In 


Using DACs

First ready DAC section in refernce manual to get a little idea. Then read stm32f4xx_dac.c get idea about various functions available to program DACs.
DAQOUT = Vref*(DOR/4095);   
note: 4095 is in decimal (0FFF in hex);In discovery board
DOR value -  DAC output
0x0FFF (4095)  - 2.87
0x0800 (2048) - 1.41
DAC conversion can be triggerd by counter, or software or external trigger line.

DACs have ability to DMA and use data there to convert. It needs to be periodically triggered (using say counter) to continuously generate waveform. Period of the waveform is obviously determined by the period with it is triggered.

General Procedure

Configure the GPIO pins using
GPIO_InitStruct->GPIO_Mode = 
GPIO_Mode_AN for DAC/ADC


Source Code documentaiton

The peripheral library provided by ST is documented using DoxyGen. Things like @param etc are for doxygen. It integrate doxygen to Keil to generate documentation using Doxygen, follow the following steps-

1 - Download Doxygen from here and install. 
2 - Instructions here










Matlab + STM32F4


Download package for STM32F4 Discovery board from here

To install package go to MATLAB toolstrip and click Add-Ons > Get Hardware Support Packages.During installtion "Support Package Installer" will ask to install third-party software "CMSIS" which you can download from ARM website. Copy paste the downloaded folder to C:\ and rename as CMSIS. Matlab will identify this folder and add into the package.

Could compile the code and blink green LED in board.



Simplifying code

Example code from ST website are usually everthing hoch puch together for example they have code for all evaluation board in one project to simply it simply go to project - manange - component..  and remove all other targets.