Week 14

/ /
Today is Industry day, so all students who take fyp 2 need to present their project in Gemilang Hall. I was given table number 10 and my accessors is Madam Afifah and Sir Azmi. Alhamdulillah everything is fine, I won 2nd place for Industry Day 2012.

Figure 1: Full specification Pedometer

Figure 2: Front View

Figure 3: Before presentation

Figure 4: Preparation for 2nd presentation

Figure 5: I won the 2nd place

Special thanks to Mr Zubir (advisor) and Mr Adib for guide and give support to me to complete this project.    thanks also to Ali, Akmal, Hariz and who help me to complete this project.

Week 13

/ /
This week will be last preparation and testing for the project. Alhamdulillah, this pedometer function well and fully function. So since the presentation is next week, this week task is to complete the poster and testing project. 

Figure 1: Pedometer poster

Figure 2: Switch ON/OFF

Figure 2: LED power indicator

Figure 3: complete pedometer


Figure 4: Video demonstrate the pedometer



Week 12

/ /
This week I had done my hardware part. The hardware part include soldering, design protype and drill PCB board. In this protype, I had made 2 design which is normal size and small size. For small size, it has problem because battery drain too fast. So, i had change plan to build to a normal size. For normal size, it used two battery 9V, each battery for Arduino and bluetooth device. I had combine 9V battery to power up Arduino and bluetooth device but it seems no support because when running, the bluetooth sometimes not send the data to the android. This can be no enough power to power up the bluetooth. So I had to used 2  9V battery to power up Arduino and Bluetooth.  For Bluetooth, I had made regulator to 5V since the operating for bluetooth is 5V.

Figure 1: soldering components 

Figure 2: Soldering the sensor and connect to the circuit

Figure 3: Screw the casing of pedometer

Figure 4: Make a hole for LED power indicator

Figure 5: 2 9V battery is connect

Figure 6: sewing the strap on ankle band

Figure 7: Pedometer small size 

Figure 8: Pedometer normal size


Week 11

/ /
After complete my software which is application on Android, I move to another part to complete my project.  This week I spend my time to complete circuit part which is PCB board and testing. The PCB board etching was done at BMI lab.

Here is the step for beginning to the end of process to do in PCB board.

1.Sketch the circuit in software and print on OHP paper.

    Figure 1: Design using Fritzing software
    Figure 2: Printed on OHP paper

2.Expose in UV lamp
    Figure 3: set expose for 72 seconds

    Figure 4: Put the UV board into UV box

3. Remove the green layer
   Figure 5: shake the box until the green layer disappear

    Figure 6: The green layer disappear and only line for circuit left


4. Remove the gold layer by put the circuit into ecthing machine
Figure 7: run the machine 2~3 times until fully disappear

5. When all complete, using thinner to clear the PCB board and only copper line left .










Week 10

/ /
This week i had complete my apps on Android. I had research and study Java language in YouTube and other blog in order to complete on application part on Android. This is not easy, but trust me, put more effort and never give up to learn and try & error in Eclipse software. Then you can create your application yourself.

Here is the program and interface for my apps.

figure 1: The Eclipse software with my complete apps

Figure 2: Simulator Android run the apps

Figure 3: The icon shoes (pedometer) as my apps




----------------------------------------------------------------------------------------------------
Coding for pedometer apps (Fadzli)
----------------------------------------------------------------------------------------------------

/*
  SensorGraph - Example to use with Amarino 2.0
   

*/
package edu.mit.media.hlt.sensorgraph;

import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Chronometer;
import android.widget.TextView;
import at.abraxas.amarino.Amarino;
import at.abraxas.amarino.AmarinoIntent;

/**
 * <h3>Application that receives sensor readings from Arduino displaying it graphically.</h3>
 * 
 * This example demonstrates how to catch data sent from Arduino forwarded by Amarino 2.0.
 * SensorGraph registers a BroadcastReceiver to catch Intents with action string: <b>AmarinoIntent.ACTION_RECEIVED</b>
 * 
 *
 *
 */
public class SensorGraph extends Activity {
private static final String TAG = "SensorGraph";
// change this to your Bluetooth device address 
private static final String DEVICE_ADDRESS =  "00:12:04:20:51:76"; //"00:06:66:03:73:7B";
double myElapsedMillis;
double distance;
double calory;
private TextView mValueTV;
private TextView mValueDS;
private TextView mValueCL;
private ArduinoReceiver arduinoReceiver = new ArduinoReceiver();

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
         
        setContentView(R.layout.main);
        
        // get handles to Views defined in our layout file
     
        mValueTV = (TextView) findViewById(R.id.value);
        mValueDS = (TextView) findViewById(R.id.distance);
        mValueCL = (TextView) findViewById(R.id.calories);
        final Chronometer myChronometer = (Chronometer)findViewById(R.id.chronometer1);

        Button buttonStart = (Button)findViewById(R.id.button1);
        
        buttonStart.setOnClickListener(new Button.OnClickListener(){

@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
myChronometer.start();
}});
       
       
        }
        
    
    
@Override
protected void onStart() {
super.onStart();
// in order to receive broadcasted intents we need to register our receiver
registerReceiver(arduinoReceiver, new IntentFilter(AmarinoIntent.ACTION_RECEIVED));
// this is how you tell Amarino to connect to a specific BT device from within your own code
Amarino.connect(this, DEVICE_ADDRESS);
}


@Override
protected void onStop() {
super.onStop();
// if you connect in onStart() you must not forget to disconnect when your app is closed
Amarino.disconnect(this, DEVICE_ADDRESS);
// do never forget to unregister a registered receiver
unregisterReceiver(arduinoReceiver);
}

/**
* ArduinoReceiver is responsible for catching broadcasted Amarino
* events.
* It extracts data from the intent and updates the graph accordingly.
*/
public class ArduinoReceiver extends BroadcastReceiver {

@Override
public void onReceive(Context context, Intent intent) {
String data = null;
// the device address from which the data was sent, we don't need it here but to demonstrate how you retrieve it
final String address = intent.getStringExtra(AmarinoIntent.EXTRA_DEVICE_ADDRESS);
// the type of data which is added to the intent
final int dataType = intent.getIntExtra(AmarinoIntent.EXTRA_DATA_TYPE, -1);
// we only expect String data though, but it is better to check if really string was sent
// later Amarino will support differnt data types, so far data comes always as string and
// you have to parse the data to the type you have sent from Arduino, like it is shown below
if (dataType == AmarinoIntent.STRING_EXTRA){
data = intent.getStringExtra(AmarinoIntent.EXTRA_DATA);
if (data != null){
mValueTV.setText(data + " steps");
try {
// since we know that our string value is an int number we can parse it to an integer
final int sensorReading = Integer.parseInt(data);
distance = sensorReading * 0.762;
mValueDS.setText(distance + " m");
calory = sensorReading * 0.05;
mValueCL.setText(calory + " kcal");
catch (NumberFormatException e) { /* oh data was not an integer */ }
}
}
}
}

}



Week 9

/ /
Android meets Arduino : Communication between Android and Arduino

Today i work with Android part, which i had to create a software in android to communicate with Android smartphone. I start with example which found on internet called "Amarino". In Amarino web, i try the example "sensor graph". Software i use is Eclipse, where to develop my apps.

Figure 1: The interface of Eclipse software

Figure 2: The programming for my apps

Figure 3: Simulator Android in PC


So, this week must be busy day because I had to study Java language and need to develop Android apps for my project. 





Week 8

/ /
Last week the bluetooth cannot connect with arduino Uno because the Uno version is no longer support Bluetooth connection. I had try many times and still the same result ( cannot connect). I had done my research on this problem and found that the Arduino Nano can support the bluetooth. So i decide to buy this Arduino nano from myduino and cost about RM 75.00 only. The problem with this arduino is the ATMEGA is mounted to the board, so i cannot make a new circuit to this arduino. I had to use the NANO in my circuit.


Features of Arduino NANO

  • Automatic reset during program download
  • Power LED
  • Green (TX), red (RX) and orange (L) LED
  • Auto sensing/switching power input
  • Small mini-B USB for programming and serial monitor
  • ICSP header for direct program download
  • Standard 0.1” spacing DIP (breadboard friendly)
  • Manual reset switch

Figure 1 : Arduino NANO


Figure 2: Arduino NANO and Blutooth

Figure 3: Connection of NANO and Bluetooth

Using method last session, the connection was succesful.  Android pairs and starts sending data with the help of Test Event which was configured earlier. Now every 5 seconds a random number is forward to Arduino and it flashes LED for 1 sec and this continues for ever till one disconnects Android from Arduino. 

This testing was successful and function well as expected. So next step is prepare to play with this Bluetooth and Android application.  





Week 7

/ /
This week I buy Bluetooth transmitter. I buy it from myduino.com.my . This Bluetooth cost about RM 128.00 only.

Figure 1 : Bluetooth V3 by DF Robot

So i decided ti try this Bluetooth. First i must have :

1) Android phone
2) BT modue
3) Arduino
4) LED.

Android phone will send random numbers from 0-255 to Arduino every 5 second via BT module. This Will light up the LED attached to port 13 on Arduino. This is done with the help of an application called Amarino. Amarino has several test data which can be used for data transfer. Here event named Test Event  will be used. I had download amarino from android meet arduino (AMARINO) and install it. 

So, i open Arduino program and i test example "Test" in the arduino library. 

 Figure 2 : Open example "Test"


Figure 3 : The coding in Arduino


Figure 4 : Amarino in Android


Figure 5 : Monitor test event

Android cannot pairing with the bluetooth and no event was found. I must find the solution and why it cannot connect with Arduino.






Week 6

/ /






Figure 1 : FSR connected to the Arduino A0 pin

# coding for FSR (read value from sensor)


  1. int fsrAnalogPin = 0; // FSR is connected to analog 0
  2. int LEDpin = 11; // connect Red LED to pin 11 (PWM pin)
  3. int fsrReading; // the analog reading from the FSR resistor divider
  4. int LEDbrightness;
  5. void setup(void) {
  6. Serial.begin(9600); // We'll send debugging information via the Serial monitor
  7. pinMode(LEDpin, OUTPUT);
  8. }
  9. void loop(void) {
  10. fsrReading = analogRead(fsrAnalogPin);
  11. Serial.print("Analog reading = ");
  12. Serial.println(fsrReading);
  13. // we'll need to change the range from the analog reading (0-1023) down to the range
  14. // used by analogWrite (0-255) with map!
  15. LEDbrightness = map(fsrReading, 0, 1023, 0, 255);
  16. // LED gets brighter the harder you press
  17. analogWrite(LEDpin, LEDbrightness);
  18. delay(100);
  19. }
---------------------------------------------------------

This sensor was function well during testing and confirmed this is official sensor for my pedometer. I reprogrammed the coding to make this sensor count if FSR detect the sensor value high than threshold. So it will count 1 and i declare it as a step.


#coding for FSR counting

int fsrPin = 0;     // the FSR and 10K pulldown are connected to a0
int fsrReading;     // the analog reading from the FSR resistor divider
int counter = 0;
 
void setup(void) {
  // We'll send debugging information via the Serial monitor
  Serial.begin(9600);   
}

void loop()
{
  fsrReading = analogRead(fsrPin); 
   Serial.print(counter);
   Serial.println(" steps");
  
  if (fsrReading > 500 && fsrReading < 600)
  {
    counter=counter + 1;
   Serial.print(counter);
   Serial.println(" steps");
  }
  else
  {
   Serial.print(counter);
   Serial.println(" steps");
  }
  
  delay(100);   
}






Week 5

/ /
FSRs are sensors that allow to detect physical pressure, squeezing and weight. They are simple to use and low cost.  This is a photo of an FSR.
Figure 1 : FSR sensor

The FSR is made of 2 layers seperated by a spacer. The more one presses, the more of those Active Element dots touch the semiconductor and that makes the resistance go down. FSR are basically a resistor that changes its resistive value (in ohms Ω) depending on how much its pressed. These sensors are low cost. I buy from myduino.com.my around RM25.00. 

I order this sensor and takes about 4 days to delivery. So nothing much i do this week. I just research about this FSR and cant wait to test it. 



Week 4

/ /
Sensor was chosen in my project is Piezoelectric sensor.
This sensor was chosen because the ability to detect vibration and accurate.

Here some basic information piezoelectric sensor :

piezoelectric sensor is a device that uses the piezoelectric effect to measure pressureaccelerationstrain or force by converting them to an electrical charge.

Here some arduino code :


/* Knock Sensor
 * ----------------
 *
 * Program using a Piezo element as if it was a knock sensor.
 *
 * We have to basically listen to an analog pin and detect 
 * if the signal goes over a certain threshold. It writes
 * "knock" to the serial port if the Threshold is crossed,
 * and toggles the LED on pin 13.
 *
 * (cleft) 2005 D. Cuartielles for K3
 */

int ledPin = 13;
int knockSensor = 0;               
byte val = 0;
int statePin = LOW;
int THRESHOLD = 100;

void setup() {
 pinMode(ledPin, OUTPUT); 
 beginSerial(9600);
}

void loop() {
  val = analogRead(knockSensor);     
  if (val >= THRESHOLD) {
    statePin = !statePin;
    digitalWrite(ledPin, statePin);
    printString("Knock!");
    printByte(10);
    printByte(13);
  }
  delay(100);  // we have to make a delay to avoid overloading the serial port
}



This arduino code was tested and the output was monitored by using Serial Monitor.
Yes, the piezoelectric sensor function well as expected. So, the next is modified the coding to become a counter. The idea is, when a person step on the sensor, the sensor detect and count as a step. 

Week 3

/ /
During the lab session :

Figure 1: The lowest voltage during inactive movement

Figure 2: Activity during the sensor sense

Figure 3: The graph show the sensor sense movement and no movement 

Figure 4: The whole circuit to test the sensor

Figure 5: The accelerometer sensor

Figure 6: LED to test the result from sensor

Figure 7: The sensor and LED

Figure 8: The programming 

During the lab session, I was test the function of the sensor. In this lab, I test the X axis to check whether it can detect movement or not. The sensor was function well and very accurate. The LED used to indicate the movement of the sensor) mean it detect movement). In X orientation, The MSB of the LED show the highest  or most activity and the LSB of LED show the lowest of activity of the sensor. 

This video show how the sensor detect X axis ( X-axis is upward and downward)

During the highest peak, the sensor is at high level and during the lowest peak ( refer the video), it show the sensor is at lower level. 


Week 2

/ /
                                            Figure 1 : Triple Axis Accelerometer MMA7260 



Finally, the accelerometer has arrived. I order the sensor at Myduino.com. The MMA 7260 is a 3.3V part and outputs an analogue voltage for each of three outputs. This voltge is in ratio to the measured acceleration and to the supply voltage.



Specification:
  • Voltage:3.3-8V
  • Selectable sensitivity:±1.5g/2g/4g/6g
  • Low power:500μA @ measurement mode,3μA @standby ;
  • High sensivity: 800 mV/g @ 1.5g;
  • Low pass filter
  • Size:23x26mm
  • Weight: 5 gram



Week 10

/ /

BENEFIT

This project is invention from previous pedometer. Commercial pedometer now a days have some issue with accuracy. So, this project come out with benefit than other pedometer that commercially used.

a)      The pedometer is simple and easy to use. Commercial pedometer normally used, need to locate the pedometer properly to avoid from wrong reading. By using this project pedometer, the pedometer itself can be located anywhere and get the accurate reading or result.
 
b)      Other than that, the benefit of this pedometer is more accurate than other pedometer because it is using accelerometer compared to pendulum. Accelerometer detect motion in three direction X, Y, and Z.  

Lastly, the user can stored and check back the result of pedometer in computer and can analyze it time to time. This can be motivate people to achieve the target or mission. 

Week 9

/ /
Flow Chart :

 
Copyright © 2010 Pedometer, All rights reserved
Design by DZignine. Powered by Blogger