FabLab CALI ... to build almost anything

Interface with PC

The interface with the PC was done with the serial port, similar to what had been done in the networking assignment. The user interface was built in Matlab and the serial information sent was the distance read by the sensor.




In order to connect the PSoC to the serial port it was necessary to get a USB-to-serial converter since most computers do not have a serial port anymore. In this case a DTech USB2-to-Serial RS232 was used.



After configuring the speed in the port to 19200 bauds, a similar adjustment was done in the PSoC, giving the UART module a clock signal of the system clock (24 Mhz) divided by 156 and it internally divides it again by 8, giving a Baud Rate of 19230.7 which is the closest value. This was the only adjustment necessary to the program made for the master micro controller in the networking assignment. See VC3 Divider on the left column of the image below.



  To facilitate the work and to be able to take pictures of what was happening the distance sensor was replaced by the linear slide that provided a more constant signal. The code was developed in Matlab and consisted in creating a serial port object, configuring the speed and terminator character, then reading the data that has been received, and finally clearing the memory of that data. In the picture below you can see the interface with the PC through Matlab.




Here we can see that the distance read in the PSoC (8.279 cm) is indeed being transmitted to the PC and it is being read by the interface in Matlab. Similarly two other readings are shown below:








 

Alvaro J. Rojas Arciniegas, PhD

 

Assistant Professor Department of Automatics and Electronics - UAO

ajrojas@uao.edu.co

+57 (2) 318-8000 ext. 11384