Friday, February 19, 2016

Infrared Transmitter Sensor Driver for Raspbery pi


37 sensor kit box is shipped with a Infrared Transmitter sensor. Alike Line Tracking Sensor, this one also a single pin sensor, turned on infrared while got ON / High on Signal port.

Hardware Description :
The IRT sensor circuit is very simple, just consist of a Infrared LED. The sensor got 3 physical PIN, and only Signal marked as S. Well, the middle on is for Volt [5v], and last one is for GND.
S is connected to GPIO – 2.


Thursday, February 18, 2016

Line Tracking Sensor Driver for Raspberry Pi


KY-033 is a line tracking sensor. This project is to develop a dynamically loadable device driver for sensor KY-033 to enabled in RaspberryPi -1.
KY-033 is a single pin line tracking sensor. 

Raspberry Pi -1, a very popular SBC running with Debian linux (code name Wheezy for raspberry pi) with default kernel version 3.18. 


As it required to develop a kernel module, same version of running kernel header should be installed and configured for the system.


Description of Hardware:

The traget sensor KY-033 is a Line Tracking Sensor consist of one Infrared light and one LED. It also consist of a Si photosensor. The basic principle of Line Tracking Sensor is to detect if any white light component reflect from opposite surface.

Wednesday, February 17, 2016

Precision Time Measurement to read Remote Sensor


A scenario is like this --

You got a task to figure precise round trip time of a remote device or perhaps, need to measure how much time it required to receive the sensor data at requested side.

To measure accurate round trip time from client to sensor, two different technique is mainly popular. 

First, used timespec struct (sec & nano-sec) with CLOCK_MONOTONIC marco of kernel to measure time between sending client request and receive of result from server. 

Second, fill timespec struct (sec and nano-sec) variable with network driver packet timestamp macro SIOCGSTAMPNS for sending socket and receiving socket and calculate the difference.


Example Output =>

 SHELL>$ ./pngclnt_v2 192.168.178.100  
 0.000000s : 0.019165 sec  
 Output 1  
 0.000000s : 0.020459sec  
 Output 0  
 0.000000s : 0.019314sec  
 Output 1  

The idea is client -- server scenario, which means a server will run on sensor side and wait for client will request. Once receive the request, server script will perform the task and respond back to client.