Wednesday, November 26, 2014

Using Wire EDM DRAFT

1 - Press Source ON button and wait until all electronics and monitor is turned on
2 - Press Power ON to power machine.
3 - In monitor you will see instruction to press ENT so just press ENT button in pannel
4 - To press buttons in monitor you can either use mouse or use touch-screen functionality. Click toggel button "Subpanel" and change CNO (condition number) to "0006". This value is required for wire gauge. For changing it to another value ask Will
5 - You can use joystick to move stage select speed number from 0-3 and then use X or Y buttons to move stage. 0 is fastest and 3 is slowest speed.
6 - For clamping use coin or circuler thing to avoid scratching stage base. You can use two different orientation to of "mounting thing" for mounting your part.
7 - All the tools required to mount part is in drawer near EDM, the key to it is in .... When mounting make sure that the part doesn't collide with EDM head over-hanging thing. (image). For tighting the part use finger and thumb rule.

Loading your file
1 - EDM only accept .dxf files and it should be loaded only using their propriety usb drive. Eject EDM usb drive from back of EDM monitor and insert it in nearby computer. Copy-paste your file into "UTV" folder inside usb drive. Note that file name should be less than 8 characters.
2 - Insert usb drive in EDM machine, now go to IQ - File - EX Memory. Drag and drop your file to "Intelligent ..." this will copy file into EDM internal memory.
3 - To see file go to HeartNC (2D .dxf file editor) than File - Open. Here you can draw lines and put "Arb points". To put arbitrory points you can just click or put co-ordinates in inches.
4 - "Wire Cut Dets" has three options a) Die - when you want to create hole in your part b) Punch - when you are cutting your part out of other thins and open ...
5 - "Resident stack" put stubs before cutting so that you can cut multiple parts or also useful for multiple pass say final pass for finish.

------ don't know what this is -------

Press OK
"0.0059"
Work Piece: can select different metals usually steel works for all purposes
Thickeness:
Punch - Close : This setting determines how close nozzle is with your part. When part is flat use close, when non-flat use open.
Condition term


USB stick to load file



Pictures needed
- picture of panel for source on and power on
- picture of mounting thing
- Mounting head picture to demonstrate which part should not collide with your part.

Ref
Will's SOP

Sunday, October 26, 2014

Developing USB Peripheral Devices DRFT

Presentation

Intro to USB - USB in nutshell (teach thing give demo in pyUSB)


Hub connected to USB function. one host many function (diagramn). host communicate by sending packets to host. Each USB transaction consists of serveral packets mainly token packet, data packet and status packet.


There are four types of packets - Token packet (sub divided into in our setup), data pacekt (sub divided into data0 and data1) , handhshake packet  (sub divided into ACK, NAK, STALL, start of frame packet

Each packet has certain fields
Sync PIDvalue (4bit decide what kind of packet/subpacket) - 7bit address of device (127 devices) -  4-bit Endpoint (16end point possible) - Cycle redudency check - End of teoken

he Universal Serial Bus specification defines four transfer/endpoint types,
 Because ther is so many ways, you define something called USB class


Device descroptor (e device descriptor includes information such as what USB revision the device complies to, the Product and Vendor IDs used to load the appropriate drivers and the number of possible configurations the device can have.)
- Configuration descriptor (power options)
-- interface descriptor
-- Endpoint descriptor

Demo descriptor
lsusb -vv

connect atmel avrisp2 connector and go through device descroptor


For example you could have a multi-function fax/scanner/printer device. Interface descriptor one could describe the endpoints of the fax function, Interface descriptor two the scanner function and Interface descriptor three the printer function. Unlike the configuration descriptor, there is no limitation as to having only one interface enabled at a time.



 Go detail each function has address and endpoints. Every device has E0 in and E0out, rest depends upon your device. Host come to know about it with device descriptor.


- Start with pyUSB, tell how all devices are connected, getting there ID etc.
https://github.com/walac/pyusb/blob/master/docs/tutorial.rst


Implementation
Hardware consideration - 3.3V schottky diode, pull-up resisotr
Zener diodes come with a broad range of characteristics, especially at low currents, results may not be reproducible.
http://vusb.wikidot.com/hardware

Software :Firmware-only Implimentation

V-USB 
Demo - Easylogger/keyboard
http://www.obdev.at/products/vusb/easylogger.html
http://codeandlife.com/2012/02/22/v-usb-with-attiny45-attiny85-without-a-crystal/

- Change fabISP crystal to 12MHz
Demo-
Download from here
Go to examples, change makefile use what you are using, fuses etc. Burn the code. This will do

Dedicated USB-Controller

atmega32u4 has in built usb-driver (search datasheet) show datasheet connection, inbuilt 3.3V regulator. Now every vendor has there own library files. Fortunately, for avr there is free library called lufa
 
LUFA tutorial
http://www.mcqn.com/weblog/running_lufa_at90usbkey2_ubuntu
- Download LUFA .zip file extract t. you need doxygen for documentation in ubutu type
sudo apt-get install doxygen
once installed navigate to root directory of LUFA and type
make doxygen
 navigate to root/LUFA/Documentation
 note - there are many documentaiton in the website look for your version. For latest below is the link
http://www.fourwalledcubicle.com/files/LUFA/Doc/140928/html/
-call with "make all" to rebuild everything, "make clean" to clean everything,

Demo
Mouse done
keyboard - done 
Virtual port - done
serial port as ttyACM0
- AnalogOut (show in device system setting - sound)

- virtual serial port
--  before using any demo you would need its documentation file. go to perticular demo folder and run "make doxygen" this will create a folder called "Documentaiton" and inside it html, and run index.html

Board file, Drivers/Board has various .h files which provide corresponding .h file for various boards. For example if Drivers/Board/joystic.h is included in project and board is say USBKEY then this "Dirvers/Board/Joystic.h" will provide path for "AVR8/USBKEY/Joystic.h" . if the file is not there then it will look for "Board/Joystic.h" so if adding some hardware to say micro inorder for it to be include create folder "Board" inside "Driver/Board" folder and keep all header file.



- LUFA keyboard mouse sparkfun tutorial

commands
lsusb
- lists all usb devices in linux

 First off you need to install the tools required to compile things for AVR chips, and the programmer used to flash the devices:

$ sudo apt-get install gcc-avr binutils-avr avr-libc avrdude 

 http://www.nongnu.org/avr-libc/user-manual/install_tools.html

 

Blinky example

#include 
#define F_CPU 1000000UL  // 1 MHz
#include 
int main() {
        DDRB |= 1; // LED on PB0
        
        while(1) {
                PORTB |= 1; // Turn LED on
                _delay_ms(500);
                PORTB &= ~1; // Turn LED off
                _delay_ms(500);
        }

        return 1;
}

 

 

Introduction

Developing USB devices is a two part job, one side you have to develop USB perhipheral device (called "USB function" according to usb standards) and a USB host. Here, we will use libusb/pyusb for host side programing and STM32F4Discovery board for USB function. We will first start with USB host programing and then gradually move to developing usb peripheral devices

USB Host Programming

USB is host centric. USB host initiate all transaction and controls all data communication. Host sends data in from of packets. 

| USB Host | --> packet --> packet --> packet --> | USB Peripheral device |

Each packet has bits for

Sync | Packet ID | Address of Device | End Point | Cycle Redundancy | End of Packet |

Sync - To sync with clock. It consist of 8 bits for FS and 32 bits for HS usb. The last two bits tell when packet ID starts.

Packet ID - Determines group of packete and also specify which packet in that group
These packets can be classified into four types of "packet -group"

1 - Token Packet - It send at the beginning of every communication and indicate type of transaction to follow.
2- Data Packet - It carries the data to be transfered i.e. payload
3 - Handshake Packet - Acknowledge data or report error
4 - Special Packet -



Open terminal and type following command:

lsusb -vv

This will output list of all the usb function connected to your computer.  Lets write driver for one of these device.

Install pyUSB

sudo apt-get update

sudo apt-get install libusb-dev

sudo apt-get install python

sudo apt-get install python-usb

 sudo apt-get install python-pip

sudo pip install --upgrade pyusb 

To test success full installation

python
import usb.core
dev = usb.core.find()
dev






The loading of the appropriate driver is done using a PID/VID (Product ID/Vendor ID) combination. The VID is supplied by the USB Implementor's forum at a cost
 Isochronous allows a device to reserve a defined amount of bandwidth with guaranteed latency
USB supports Control, Interrupt, Bulk and Isochronous transfers. 


Start with this
http://www.beyondlogic.org/usbnutshell/usb3.shtml

While developing always thinks in term of host. For example IN packate for device is host asking for input data or read data.


Editing the VCP for Discovery board code

- In code when you send a data, the code will sent it to Tx, Rx will recieve it and intrupt code will be executed, now Rx recieving code should be thre in the intruppt code else the uC will not come out of intruppt.




Developing Driver 



the output should be something like 


To test VendorID and ProductID of your devices, simply create "getdevices.py" with following code

#!/usr/bin/python
import sys
import usb.core
# find USB devices
dev = usb.core.find(find_all=True)
# loop through devices, printing vendor and product ids in decimal and hex
for cfg in dev:
  sys.stdout.write('Decimal VendorID=' + str(cfg.idVendor) + ' & ProductID=' + str(cfg.idProduct) + '\n')
  sys.stdout.write('Hexadecimal VendorID=' + hex(cfg.idVendor) + ' & ProductID=' + hex(cfg.idProduct) + '\n\n')

save it and run it
 python getdevices.py

You will get a list of connected devices. Connect a STM32Disc board (after uploading VCP code) device and run the code again. A new entry will appear in the list. This is your products VendorID and productID. Most likely it will be

VendorID = 0x483 and ProductID = 0x5740

Now, open VCP project and in usbd_desc.c change the entry 

#define USBD_VID     0x0482

save and recompile and burn it to board.  run the getdevices.py again and you should see the vendorID updated.

VCP implimentation is FS. During running code DIEPCTL1 and DOEPCTL1 changes value when data sent from terminal.

Device descriptor can have many configuration( although most of them just have one configuration), this can be check my value bNumConfiguration. Each configuration can have multiple interfaces.

STM32 VCP code is detected as ttyACM0 (ls /dev)

Once you connect the board, Ubuntu will read the device descriptor and based on entry in "bDevcieClass" for CDC its 02h and hence in VCP code in usbd_cdc_core.c its its set as 0x02. To make sure OS doesn't load default COM port driver, change this value to 0xFF (which means class code is vendor specified, see here) . SB defines class code information that is used to identify a device’s functionality and to nominally load a device driver based on that functionality. SB defines class code information that is used to identify a device’s functionality and to nominally load a device driver based on that functionality. There are two places on a device where class code information can be placed.One place is in the Device Descriptor, and the other is in Interface Descriptors

- a serial port may have set two Interrupt endpoints for transferring data in and out and then a control endpoint for setting the baud rate. For stm32f4 vcp, The CDC core uses two endpoint/transfer types:
● Bulk endpoints for data transfers (1 OUT endpoint and 1 IN endpoint). EP1 out (bulk) and EP1 IN (bulk)
● Interrupt endpoints for communication control (CDC requests; 2 IN endpoint). EP2 IN (interrupt type).

#define CDC_IN_EP                       0x81  /* EP1 for data IN */
#define CDC_OUT_EP                      0x01  /* EP1 for data OUT */
#define CDC_CMD_EP                      0x82  /* EP2 for CDC commands */


configuration descriptor and all other descriptor is defined in library usbd_cdc_core.c. You can varify the output of lsusb -vv with the data in this file.


ediging usbd_cdc_core.c
- removed HS core code.

ST Library
usbd_cdc_core.c manages all CDC communication and uses lower level drive to access hardware.  usbd_cdc_core.c talks to usbd_cdc_vcp.c using following structure -

typedef struct _CDC_IF_PROP
{
uint16_t (*pIf_Init) (void);
uint16_t (*pIf_DeInit) (void);
uint16_t (*pIf_Ctrl) (uint32_t Cmd, uint8_t* Buf, uint32_t Len);
uint16_t (*pIf_DataTx) (uint8_t* Buf, uint32_t Len);
uint16_t (*pIf_DataRx) (uint8_t* Buf, uint32_t Len);
}
CDC_IF_Prop_TypeDef;

above structure is defined in usbd_cdc_core.h , is defined as

extern CDC_IF_Prop_TypeDef  APP_FOPS;

in usbd_cdc_core.c and in usbd_conf.h defines APP_FOPS as VCP_FOPS. In short usbd_cdc_core.c is accessing functions defined in usb_cdc_vpc.c files.

in STM32F4 USB_Rx_Buffer(unsignedchar[64]) stores all the data. So if you send dev.write(1,'test',1) then this buffer if wateched in watch window will show you 'test'. App_Rs_Buffer (unsignedchar[2048]) stores data that is to be sent to host.

Functions defined in  usb_dcd.c
DCD_EP_Tx - Transmit data over USB


- 03/19/14
USB1 has only bulk interrupts, pyusb can send data.
- While defining descriptor make sure wTotalLength is properly set. I was removing other times form descriptor keeping wTotalLength same which created read problem. Modified the code so that it can return exactly what I typed. Modified cdc_vcp.c functions.

03/21/14
 An unsigned char is a (unsigned) byte value (0 to 255). In code USB_Rx_Buffer is [64] and each of the bite value can be seen in debug mode if you expand it.



Adding USB capability to your project
-Files needed
-- usbd_conf.h
 To change USB IN data size change
 #define APP_RX_DATA_SIZE               20 /* Total size of IN buffer: in 2048  */
#define APP_FOPS                        VCP_fops


--usbd_desc.c - Defines usb descriptor and string format.
#define USBD_VID                        0x0483
#define USBD_PID                        0x5740

--usb_regs.h
change
#define USB_OTG_FS_MAX_PACKET_SIZE           64
#define USB_OTG_MAX_EP0_SIZE                 64



usbd_cdc_core.c
"__ALIGN_BEGIN uint8_t USB_Rx_Buffer   [CDC_DATA_MAX_PACKET_SIZE] __ALIGN_END
__ALIGN_BEGIN uint8_t APP_Rx_Buffer   [APP_RX_DATA_SIZE] __ALIGN_END ;

usbd_cdc_vcp.c/.h

usbd_usr.c/h   For user application interface.

Note - usbd_cdc_core.c talks to usbd)cdc_vcp.c using CDC_IF_Prop_TypeDef pointer which is defined in usbd_cdc_core.h


The Setup Packet

Every USB device must respond to setup packets on the default pipe. The setup packets are used for detection and configuration of the device, setting device address, requesting device descriptor or checking the status of  a endpoint.


 In STM32 this is taken care by structure usb_setup_req and is defined in usb_core.h.

typedef  struct  usb_setup_req {
   
    uint8_t   bmRequest;                     
    uint8_t   bRequest;                          
    uint16_t  wValue;                            
    uint16_t  wIndex;                            
    uint16_t  wLength;                           
} USB_SETUP_REQ;

 Request type can be standard (further divided into standard, interface and endpoint) or Class specific.

This structure is used in setup stage function USBD_SetupStage() decide if its standard device request, interface request or endpoint request and accordingly calls the functions.

This structure is used in usbd_cdc_core.c to take care of cdc class specific requests. This class specific request are then handle by usb_cdc_vcp.c

To change packet size of IN/OUT EP change following value in usbd_conf.h
 #define CDC_DATA_MAX_PACKET_SIZE       64
#define APP_RX_DATA_SIZE               2048

Starting a Keil Project From Scratch

Create a Folder "Project Name" and inside it create folder "MDK-ARM" . We want to keep all the files seperate from uVision folder so that the project can be easily ported to new IDE.

1. Select Project > New uVision Project
2. Select Device for Target ‘Target 1’ - STMicroelectronics > STM32F407VG

In Manage run time environment - do nothing

Go to project- manage-component, environments groups and rename Target1  and group. Create main.c and save it one folder outside location of "MDK-ARM"

Note - When writing tutorial, first mention directory structure as it can be confusing.

copy "Utilities" folder in "Project Name" folder. Now add "stm32f4_discovery.c" to the "User" group, this file is inside Utilities" folder

Crate a new group"MDK-ARM" in "Project Target", copy startup_stm32f4xx.s inside "MDK-ARM" folder and add this file to newly created "MDK-ARM" group.


While adding usb to other project make sure to add usb interrupt functions interrupt file in  in stm32f4xx_it (both in .c and .h)

/**
  * @brief  This function handles EXTI15_10_IRQ Handler.
  * @param  None
  * @retval None
  */
#ifdef USE_USB_OTG_FS 
void OTG_FS_WKUP_IRQHandler(void)
{
  if(USB_OTG_dev.cfg.low_power)
  {
    *(uint32_t *)(0xE000ED10) &= 0xFFFFFFF9 ;
    SystemInit();
    USB_OTG_UngateClock(&USB_OTG_dev);
  }
  EXTI_ClearITPendingBit(EXTI_Line18);
}
#endif


/**
  * @brief  This function handles OTG_FS Handler.
  * @param  None
  * @retval None
  */

void OTG_FS_IRQHandler(void)
{
  USBD_OTG_ISR_Handler (&USB_OTG_dev);
}



 




Wednesday, August 27, 2014

Scanning Probe Microscopy DRAFT


Overview of Machine



AFM base, environmental chamber, afm scanner, stm scanner, nose - contact mode nose (2 pins, 9 degree tilt), ac mode nose, cs-afm nose (4-pins), piezo nose, fludic sample nose( has 9degree tilt ?). Scanner stand, spring clip tool, nose remover, sample plate, liquid sample plate addon, sample plate holder

For liquid sample we mainly use contact mode, but if you want to use the AC mode in liquid sample (which adds noise because of entire liquid in vibration) you need to take out the AC block from the AC nose and put it into the liquid nose. It has 9degree tilt because in liquid beam bents and go out of the detector range, making it 9degree brings it back to the detector range.

Nose

Nine-degree nose assemblies are used for general purpose imaging. Nine and eight-degree nose assemblies may be used for imaging in liquid.

There is a notch filte which only reflect red light to the cantilever.

Blue cable is low voltage bias to scanner, laser and tip (for CS-AFM), sensor

Red cable is 250V high voltage for piezo inside the scanner.

There is an led in the scanner to provide some more light. There are two window cap for the scanner, the blue cap has no lens and the black cap has a lense. Black cap can be used when you interface optical microscope into it.
STM scanner pre-amplifier sensitivity - 1nA/V (blue)
Gain switch x10 or x1

To calculate the final sensitivity, use this equation:

Final Sensitivity = (Preamp Sensitivity) / (Gain)

For HOPG imaging - Set final sensitivity to 1nA/V (In my case it will be gain switch to 1x)


There is a lens inside the scanner which makes inverted image of the cantilever

Warning


No lateral force on scanner as it can damange the piezo material inside the scanner.

Keep the “spring clip tool” connected to the magnet provided in the scanner stand

When done unmount scanner, nose and keep it back in the nose box.

Use gloves while handling any parts of the afm

Don;t pressurize or create vacuum inside the enviromental chamber.


3 AFM Imaging Steps

3.1 Parts required

Decide which mode you want to use and select appropriate nose. scanner, scanner stand, spring clip tool, nose remover

3.2 Install Nose in scanner

Select the desired nose. There is one nose with 12 degree angle which is used for general imaging. The nose with 9 degree angle is used for liquid samples and liquid further deviate the laser beam and we need to bring it back to the detector. General purpose nose has two pins for piezo assembly that is used for AC mode. In principle the AC mode piezo can be transfered from general purpose nose to liquid sample nose for liquid sample AC imaging but it will be noisy as there will be many resonant peak since the tip is in the sample. For most of the imaing select the 12 degree two pin nose.

1- Put the scanner on scanner holder as shown in figure

2- Slide the nose in proper orientation. The needle should go inside the hole in the scanner.

3- Gently press it

3.3 Install the cantilever

1- Raise the box and hold cantilever with twizer such that cantelver make acute angle with the twizer (its importat) and close the cantilever box

2- Using spring to raise the spring, retract it until the spring tool touches the scanner

3- Gently place the cantiliver at the grew provided and release the screw. Make sure that the cantilever is at proper distance inside

Slide the nose into the scanner opening using guided slots. Push gently inside till the small rubber o-ring. Be careful not to apply any force laterally as this may damage the piezo material. If its difficult to insert the nose, apply some grece in the o-ring.

To take out the nose, slide the nose inside the slot of the nose reomver tool and gently pull the handle upwards

3.4 Install the Scanner

1- Center the stage, reading on both the moving stage screws should read 5/5

2 - Slide the scanner inside, be carefull about the led switch, rotate the scanner slightly to mare some room for the led switch

3- Tighten the side screw.

4- Connect the red and blue cable

3.5 Align the laser

Note : If you see the full circle Sum = 10.00V chances are that detector cable is not connected. Make sure that the cable is connected and proceed with alignment.

1 - Insert the detector assembly and connecte the cable.

2- Maximise the laser alignment window. See if you can see the laser spot at the bottom of the afm. If yes clockwise rotate the right knob on scanner until the spot disaperar and clock wise to make it visible again. This is the base of the cantilever.

If no move it close wise until you see the spot. Then do as described above.

3- Use the left knob to bring the spot to the top of the cantilver - cockwise rotation move it righ and counter-clockwise move it left. When image dissapera it means its on top of the catilever bring the image back. This is the position when beam is at bottom and at the side of the cantiliver.

4- Use right knob to bring the spot at the tip of the cantilever

3.6 Insert the detector

1 - Gently slide the detector in completely and make sure that laser power supply cable (green cable) is connected

2 - If Laser alighment window is not already open go to controls -> Laser alignment and the laser alignment window will appear. Have a look at the Deflection, friction and sum values. and the laser spot. If the spot is hollow circle then beam is off the detector and signal is very low. If the circle is solid then signal is good. Use the two knobs in the detecot to bring the red spot at the center of the cross (if ac mode) or at intersection of yellow and green light (if using contact mode)

First bring the spot at horizontal center using side screw. Hold the detector assemble with your left hand thumb and use the finger to rotate the knob. Rotating the side knob away from you will move the spot from left to right

Clockwise rotation of fron knob will bring the laser up

Note - There are four switchs for the gain in detector assembly. It reads “NO gain” don't get confused it with “ON”

3.7 Mount the Sample

1- Put your sample on the sample disk. Put the disk on top of the sample mouting

2 - Open the lid - hold bottom with your right hand and and use left hand to open

3- Retract the three motors all the way down using the open switch in EHB. Visualise the plane passing through the two ball rings this plane should be at safe distance from the cantilever tip.

4- Attach the sample cable. The ball bearings are magnetic. First attache the plate to the bottom ball bearing then the one at the front. Now looking at the sample and the tip distance gradualing slide the posts inside the sample plate.

and close the lid

5- Bring the sample plate close to the tip using the close button in EHB. Make sure that the sample and tip don't collide. If the sample is reflective do it until you observe the reflection of the tip in the sample.

3.8 Approach

3.8.1 Contact Mode

The AFM tip is brought into gentle contact with the sample and then scanned in raster fashion across the sample surface. Because of this reason the initial deflection in AC mode is set to a non zero value (force vs distance figure, as the tip come closer to the smaple first there is “non-contact” attraction force and then “intermittent contact” repulsive force).The system will either maintain a constant force on the tip or will maintain the tip at constant height (higher resolution). Constant height mode is used for very flat surface.

Controller maintants a constant deflection of the tip based on the specified Setpoint voltage. The deflection signal is the differece between setpoint voltage and the actual cantilever defelection measured in voltage by the photodetector.

1. Select contact Mode in PicoView software Mode -> Contact AFM

2. Click Controls -> Imaging to open the Servo window. Set the setpoint value slightly more positive than the current deflection reading. This is the deflection that the feedback loop will achieve and maintain.

3. Click on the approach button. The scanner will retract (approach range) see if the sample is there come back and then stage will be. The aproach range can be set by Controls->Setup-> Microscope. Currently its 400nm.

4. Make sure that the IGain and PGain is set to 10% in servo window (more on it later)

5. Once you click the Aproach button a windows will appear “ Apprach In Progress”. This window will show you how much your tip is moved and will dissapear when the approach is done. You can see the yellow bar in Servo window moving up and down. This is the motion of the tip.

6. Once the approach is done click the Scan arrow in “Scan and Motor” Window .

7. In the “Realtime Images” window select the “Topography, deflection and Friction

3.8.2 AC Mode

1. Find out the resonant frequency of the tip - Go to controls -> AC mode tune, AC tune window will apear. select Auto, look at the datasheet of the catilever and set the start and stop value accordingly, Set the peak applitude to be 4V (default value) and click on Auto Tune. The software will change the drive values to get the specified amplitude. typtically drive is less the 1%. Using slider slide the red dotted line little bit left of the peak . Close the window

2- In the scan and motor window set the stop at - 95%, what is will do is that the feedback loop will start at 95% of the peak voltage (in this case 4V) and click on the approch button. YOu can look into the servo window location of the tip. Wait until the Approach window disapear. When done the oscilloscope windows shows the differece between set point and actual point

3- Now change the setvalue voltage. Smaller the voltage more is the interaction with the sample and more is the resolution of the image. Set the setpoint to 3V.

4- In the scan and motor window go to scan tab. Select the scan size (max 10um), offset etc. click the up-arrow button to start the scan.

In the race/retrace window see if race and retrace curves are following each other. Increase the I-gane so that both curve follow each other. If you observe high frequency noise in the curves decrase I-gain little bit.



STM Mode

 First check the conducting side of the substrate and make sure during mounting it, the conducting side faces upside. Mount the sample on sample plate and attach the electrode from bias point to substrate.Connect 3-cable pin connector to sample holder. Set the bias value in software and check if you are getting sample value at sample (use serial port outer casing as ground)



Closing Up Session

- Retract AFM Tip and Open stage (increase distance between tip and stage)
- Turn off Laser, remove scanner cable and detector cable.

- Close software and turn-off PC.
- Turn-off AFM controller and AC Mode III.

Consumables 


1) Mica Disk 10mm diameter (Ted pella Product# 50)
2) Atomic flat gold substrate
3) AFM/STM Metal Specimen Discs 15mm, Part# 16218
4) Metal Speciman Disk 15mm Part# 16218-G 
5) General lab supply to keep small sample - Prod# 1395-10


AFM Probes

http://www.nanoworld.com/afm-probes-catalog

For contact mode (used in mica atomic resolution)
5) AFM probe contact mode,  Part# PNP-TR-20

http://www.nanoworld.com/pyrex-nitride-triangular-silicon-nitride-cantilever-afm-tip-pnp-tr
 


Part I AFM Calibration

I ordered gold calibration kit for AFM calibration[AFMCalibrationKit]. It has spheres of size of many size

References http://www.tedpella.com/calibrat_html/16200.htm


Maintanace

1) Updating to PicoView 1.18.2 version.

Friday, April 18, 2014

CIE Co-ordinate Calculator DRAFT

You can download program from here


PL Data File Format

First save photoluminescence data in text format. Usually these files have the format as shown below

 

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.