Monthly Archives: June 2014

Digital Notch filter

Now we have a working digital Notch filter, needed to eliminate the 60Hz Power line interference from an ECG signal. The filter was implemented by  writing a C/C++ code and inserting it into a Code Composer Studio Project. As it has already been mentioned, Code Composer Studio is compatible with TI OMAP-L138 LCDK, so we were able  to load the code to the board and run it. The video, linked below, shows that the filter attenuates the amplitude of the 60Hz input signal while keeping the amplitudes of  other frequencies inputs unchanged.

Digital notch filter demonstration

The Code for the Notch filter will be posted under the “Code examples”  tab on this website.  =)

Encoder Issues

Recently, I have been testing the encoders to successfully trigger interrupts on the Arduino board to record the distance the wheels of the platform have traveled. This is so that the platform can travel precise distances using PID algorithms and feedback from the encoders.

While the motors of the platform are not active, the interrupts trigger successfully as the wheels are rotated manually. This is because the encoders produce a clean digital signal to the interrupt pins on their own. However, when any of  the motors are active, the inductive noise generated gets carried into the interrupt pins which causes the interrupts to trigger much more often than they are supposed to. This is a problem if we want to get reliable feedback from the encoders.

With the encoder connector carrying the motor noise, one solution was to control the signal from the connector using a pull-up resistor. A pull-up resistor ties the input of the interrupt pin to 5 volts or a HIGH value so that when the encoder signal goes HIGH, it actually translates to 5 volts instead of where the interrupt pin’s threshold voltage may be. Unfortunately, this method was not effective in reducing the false interrupt triggers.

Another solution was to add a 10 microFarad  capacitor between ground and the same pin to filter out the inductive noise being carried by the connector. While the capacitive effect on the signal was measured, it also was not effective. This was to be expected because the oscilloscope measurements did not show any noise affecting the signal while the motors were active. Yet the interrupts on the board react as though it is coming from the signal.

Further solutions were to ground the motors directly to the board as well as rearranging the motor and encoder connectors away from each other but to no avail. So while the problem seems to be motor noise travelling through the encoder connector, none of the solutions made a difference which suggests that the problem may be elsewhere.

However, one test showed some results that verified the issue. When connecting only the right motor’s encoder to an interrupt pin with only the left motor active, the same issue in triggering the interrupts occur. Also, the further the left encoder connector is from the right, much less interrupts are triggered. These results definitely indicate motor noise being carried.

Further testing will be done to solve the issue at hand.

 

Some progress regarding Experiment 3.

Using the analog amplifier circuit, built for Experiment 2, we have been able to record an ECG signal on a digital oscilloscope screen.

Capture

After having connected the analog amplifier’s output (pin 6 of the U4 op-amp) to the analog Line  In  input of the OMAP-L138 LCDK board, we were able to obtain a  digital    signal of approximately 1 Hz frequency with clearly distinguishable QRS peaks on a PC screen, using the Oscope/Analizer function of the winDSK8 software. The signal, however, was distorted by  a  60Hz noise, which is to be removed by means of a digital Notch filter.  The results  for  filtered ECG signal, as well as the   lab guide for Experiment 3 will be posted soon.

Picture treatment

This post is about the method using to determinate the distance between the robot and the Nexus 7 tablet, using tablet’s camera. So I used a picture of the robot to know how the robot is far from the tablet. And with information coming from several cameras I am able to determine the robot position.

photo

In order to know the distance between the robot and the tablet, I built a kind of flag. This flag is a colored circle, so because it is a circle, whatever the perspective, it will be every time the same diameter.

Thus if the robot is far from the tablet, the circle will be smaller in the picture than if the robot was close to the tablet. Thanks to this know, I made some test, take some values, and find the equation.

Sans titre 1

Now, thank to the equation, I know the distance between the robot and the tablet with only a picture. You wan see on the following picture a screen shot of my program, with the distance measurement.

2014_06_17_14.33.13[1]

 

Camera

After tried two methods not enough reliable, this method is my last chance to find a well way to determinate distance between a tablet and a robot.

This method using the tablet camera and Bluetooth. Principle is pretty simple, we assume that the robot start from position 1 to position 2. When the robot leave position 1, it sends a Bluetooth signal to the tablet saying “I am started” (This signal is only a character). Once the robot is arriving at the position 2 it sends another signal indicating the distance between position 1 and position 2 (in centimeters). So we can ask us several questions about this new way:

Is it possible to communicate with Bluetooth between the robot and an Android device ?

Is the measure will be precise ?

Is one camera enough do measure the distance ?

I began by EV3 robot Bluetooth communication. Bluetooth protocol is pretty simple, there are only some important steps to follow:

1) Connector declaration

NXTCommConnector connector = Bluetooth.getNXTCommConnector();

2) Established connection

NXTConnection connect = connector.waitForConnection(0, NXTConnection.RAW);

3) Stream declaration

 DataInputStream dis = connect.openDataInputStream();
 DataOutputStream dos = connect.openDataOutputStream();

4) Read or write information

 short n = dis.readShort();
 dos.writeShort(n);

About Bluetooth on the Nexus 7 tablet, we will use a very simple program, made with processing. First of all, we declared and established the connection between the EV3 robot and the Nexus 7 tablet

 bt = new KetaiBluetooth(this);
 bt.connectToDeviceByName("EV3");
 bt.start();

To send a data you will use :

byte[] data = {'t','e','s','t','\r'};
bt.broadcast(data);

And you will use the event on the buffer to receive the data :

void onBluetoothDataEvent(String who, byte[] data) {
 if (isConfiguring)
 return;

 info += new String(data);

}

Now, we can share information between EV3 robot and the Nexus 7 tablet.

Next step is about picture treatment, I will talk about it in the next post. I used Processing to do picture treatment because it is a more adapted for thus kind of application.