Geek-Press Geeky Blog about software development


Codebits VI and the project PNS

Another Codebits happened!

Another year full of good things, good talks, good projects, good gifts .....

This year brought me André Gil, Claudia Frutuoso and Gonçalo Basto to make a funny project.

The project is called PNS - Personal Notification System.

The concept is simple, a device that can be added to any garment or accessory that allows a communication bridge between the user and your mobile phone via bluetooth.

This device allows you to interact with your phone without removing it from your pocket, which can be helpful during our jogging session, a meeting, while driving or even in a situation where expose our phone in public is not our intention.

Thus we can set patterns for RGB LEDs that allow us to identify what we are receiving in our mobile phone:  for example a twit, a post on facebook directed at us, a SMS, a call from a certain person. We can also program each button to perform an action on your phone. We can reject or forward a call, send a message back to whoever called us to say that we can't currently talk, send a twitt or foursquare  post with our geographical location, we can even program a button to check the status of the weather on the internet and show a sequence of LEDs as the weather will be.

The boundary between the things we can do with this device and a smartphone is your imagination.

This device can be used by both advanced or basic users,  there is a page like a user community where you could add your code snippets where you can  share to the others or download them to your phone and then assign them to our device .

To carry out this project we used a android phone, an Arduino Uno and a bluetooth module as well as a webapp created using Ink.

Obviously a device with these features has to be small and easy to customize and the final version of our prototype was anything but small although functional!


Arduino + WebCam = Volumetry

One of the projects I have worked occasionally in recent months was finding a way to measure materials volumes with "low-cost"!

I thought about the challenge and started to get down to work and got amazing results using an ordinary webcam and a sensor with an Arduino.

To begin with let's talk about hardware:

- Arduino + Distance Sensor Sharp GP2Y0A02 (20-150cm): I must say I thought it was the easiest but failed miserably.

To achieve acceptable results (about 1 cm of deviation in distances near the limit of the sensor) I have had to follow a set of procedures that's tricky because the sensor tends to return lots of noise and so we do not have accurate results.

First I do 10 readings and determine the average value, then determine the upper and lower limit values ​​from this first average, capture another 10 and make the average ​​of all the values.

I must say it worked really well

float GetAverage(float * _values, uint8_t size)
	float avg = 0;
	for(int i = 0; i< size; i++)
		avg += _values[i];
	avg = avg / size;
	float setMax = avg * 1.15;
	float setMin = avg * 0.85;
	float precisionAvg;
	int counter = 0;
	for(int i = 0; i < size; i++)
		if((setMin < _values[i]) && (_values[i] < setMax))
			precisionAvg += _values[i];
	return precisionAvg / counter;

To achieve volumetric measuring I used Emgu library and a few filters  to find the contours of the object based on a mask. In other words we must have a mask from the background in order to make the exclusion of what it already was there and just stay with the new object in the image. We use a few tricks of image processing, some trigonometric calculations and voila here is the result