星期五, 9月 17, 2010
星期日, 8月 08, 2010
EMG Signals Drive Servo
This simple project is what I really want to do before. I used Biopac system to amplify my EMG signals and acquired these signals by NI USB-6009.
##CONTINUE##
Originally, I want to use serial communication to send the control signals to arduino, but I don't know how to send the unsigned long integer in labview instead of string. As the result of that, I used USB-6009 to generate analog output to arduino.
Every hardware thing is ready, next is to write the program. As I mentioned before, I used labview to acquire EMG signals, so I just acquired the signals, calculated by RMS, and transformed the number into the range 0-5 to have the USB-6009 generate analog output voltage between 0 and 5.
The arduino program is also very simple. It just uses analogInput to receive the voltage from USB-6009 and controls the servo by the voltage value.
However, as you can see, the control is not good. I think this is the key point that I need to establish a good control strategy in the future.
星期六, 7月 03, 2010
Arduino + Processing
I made it to control my robotic arm originally. However, it's bad looking, so I used wii nunckuk instead.
##CONTINUE##
Yesterday, I was thinking how I can do to simply model hand motion and display in computer screen. I am not good at 3D painting, so I used RGB cube that I saw some people used it to demonstrate some programs. You can also find the processing code from the above link.
In this simple project, I used two potentiometers to control two axises. I am sorry that I don't have any idea to use the flex sensor, but I pasted it before, so I did not take it out.
Here is the code in arduino board:
int val_1; //flex sensor int val_2; //middle potentiometer int val_3; //bottom potentiometer void setup() { Serial.begin(9600); } void loop() { val_1=analogRead(0); val_2=analogRead(1); val_3=analogRead(2); val_2=map(val_2,340,1023,0,360); val_3=map(val_3,0,1023,640,0); To2bytes(val_2); To2bytes(val_3); /* Serial.print(val_1); Serial.print("\t"); Serial.print(val_2); Serial.print("\t"); Serial.println(val_3); */ delay(200); } void To2bytes(unsigned int inX){ byte H_Byte; byte L_Byte; // int a=B01111111 H_Byte=inX>>8; L_Byte=(inX%256); Serial.print(H_Byte,BYTE); Serial.print(L_Byte,BYTE); }
And I only add some codes in RGB cube code.
In void setup
println(Serial.list());// List all the available serial ports myPort = new Serial(this, Serial.list()[1], 9600); //You have to import serial class before. //import processing.serial.*; //Serial myPort; // The serial port
In void draw()
int[] inByte = new int[4]; while (myPort.available() == 4) { inByte[0]= myPort.read(); inByte[1]= myPort.read(); inByte[2]= myPort.read(); inByte[3]= myPort.read(); inY=(inByte[0]<<8)+inByte[1]; inX=(inByte[2]<<8)+inByte[3]; print("X" +inX); print("\t"); println("Y" +inY); }
星期一, 4月 26, 2010
New robotic arm controlled by wii nunchuk
Continue by the Robotic arm controlled by wii nunchuk. I changed the material corrugated to acrylic, so it must be more consolidated. Also, I saw some videos on the youtube about grippers and tried to design my Robot Gripper.
星期六, 4月 10, 2010
Simple codes to build a pyramid
Someone asked me how to write a program to build "*" pyramid when reading this article. However, I didn't learn java since that time, so I wrote some simple codes in C language. The concept is very simple because it can be done by using nest loop.
##CONTINUE##
Here is the code to build "*" pyramid.
You can also arrange the "*" on the left side.
##CONTINUE##
Here is the code to build "*" pyramid.
#includeint main() { int i,j; for (j=1; j<=5; j++) { for (i=1; i<=5; i++) { if (i<5-j+1) { printf(" "); } else { printf("* "); } } printf("\n"); } return 0; }
You can also arrange the "*" on the left side.
#includeint main() { int i,j; for (j=1; j<=10; j++) { for (i=1; i<=10; i++) { if (i<10-j+1) { printf(" "); } else { printf("* "); } } printf("\n"); } return 0; }
星期四, 3月 25, 2010
Test for syntax highlight by programming a simple sort function program in C language
Actually, I wanted to set the syntax highlight before, but I don't know why I didn't set it until now. You can find how to set the syntax highlight from here.
##CONTINUE##
##CONTINUE##
#includeint main() { int num[5]; int i,j,temp; printf("請輸入五個整數:\n"); for (i=0;i<5;i++) { printf("第%d個數字:",i+1); scanf("%d", &num[i]); } printf("您所輸入的數字為:\n"); for (i=0;i<5;i++) { printf("%d ",num[i]); } // begin to sort data for (i=0;i<5;i++) { for (j=0;j<4;j++) { if (num[j] > num[j+1]) { temp=num[j]; num[j]=num[j+1]; num[j+1]=temp; } } } printf("\n由大到小排序為:\n"); for (i=0;i<5;i++) { printf("%d ",num[i]); } printf("\n"); return 0; }
星期五, 3月 05, 2010
Robotic arm controlled by wii nunchuk
Recently, I was doing my robotic arm by using corrugated because I did not receieve any education of mechanism and I do not have other materials such as plastic, acrylic or stainless to build it.
##CONTINUE##
My girlfriend, Jean, helped me redesigning and improving some structures, so now it is more solid than before.( The movie I posted yesterday. See What the hell is this??!!)
The code of wii nunchuk I used from here. I think it is easy to find the code of wii nunchuk from some smart guys. A guy drawed this picture about the pins of wii motion plus and it is the same with wii nunchuk. I added some commands to control servo.
| 1 2 3 |
| |
| 6 5 4 |
|_-----_|
1 - green - data
2 - nothing
3 - red - 3.3+v
4 - yellow - clock
5 - nothing
6 - white - ground
By the way, this time I asked my girlfriend to demonstate this movie because my hand hairs are so many that once time my mother asked me why my hand is so dirty without wearing her glasses. = =""
##CONTINUE##
My girlfriend, Jean, helped me redesigning and improving some structures, so now it is more solid than before.( The movie I posted yesterday. See What the hell is this??!!)
The code of wii nunchuk I used from here. I think it is easy to find the code of wii nunchuk from some smart guys. A guy drawed this picture about the pins of wii motion plus and it is the same with wii nunchuk. I added some commands to control servo.
| 1 2 3 |
| |
| 6 5 4 |
|_-----_|
1 - green - data
2 - nothing
3 - red - 3.3+v
4 - yellow - clock
5 - nothing
6 - white - ground
By the way, this time I asked my girlfriend to demonstate this movie because my hand hairs are so many that once time my mother asked me why my hand is so dirty without wearing her glasses. = =""
星期四, 3月 04, 2010
I am a pseudo-environmentalist
My product I bought from internet auction comes today. It's a solar board which can charge some ordinary devices like cellular phone or camera.
##CONTINUE##
I bought it just because it's funny and cheap. Maybe I can apply it in my arduino project!!
##CONTINUE##
I bought it just because it's funny and cheap. Maybe I can apply it in my arduino project!!
You can see the light is on when I put the solar board in the place with sun light.
What the hell is this??!!
Is there anyone who can tell what is it?? If you can, you must be a very smart guy or you must know me very well.
##CONTINUE##
I wanted to build a robotic arm in the beginning. But now it looks a little bit like the dinosaur which can move automatically in the museum. = =''
##CONTINUE##
I wanted to build a robotic arm in the beginning. But now it looks a little bit like the dinosaur which can move automatically in the museum. = =''
星期三, 3月 03, 2010
Wii motion plus + Arduino
My wii nunchuk adapter comes today, I can wait testing it in wii motion plus. (Not nunchuk)Here is the movie. (I know the resolution is worst!!)
##CONTINUE##
I have to great thank the amazing guy who decodes the wii motion plus and I use the code in arduino directly. Here is his blog: http://randomhacksofboredom.blogspot.com/2009/06/wii-motion-plus-arduino-love.html. What I only need to do is to connect the wires between the wii adapter and arduino.
##CONTINUE##
I have to great thank the amazing guy who decodes the wii motion plus and I use the code in arduino directly. Here is his blog: http://randomhacksofboredom.blogspot.com/2009/06/wii-motion-plus-arduino-love.html. What I only need to do is to connect the wires between the wii adapter and arduino.
星期一, 2月 15, 2010
An Electrogoniometer Controls a Servo Motor
I think that it is my final project(or called game) before my TOEFL test. The concept is very simple. The arduino reads the voltage of an electrogoniometer and sends the analog signals to servo. However, the voltage of the electrogoniometer is unstable, so you can see the servo motor is shaking. No wander when I used the electrogoniometer for my research, I needed to smooth the data.
星期五, 2月 12, 2010
ES triggered by muscle activation
Today, I tried to establish a system which can detect muscle activities and then trigger an electrical stimulation to help muscle contraction. One reason that I did this project is learning to control DAQ card by labview. The other is that I saw some functional electrical stimulation applications and tried to build a proto type system by myself.
##CONTINUE##
1. The DS7 Digitimer is the electrical stimulation, here is the information: http://www.digitimer.com/pdf/digitimes/Digitimes%202009.pdf
2. The Electrogoniometer is to measure my elbow angle.
3. NI USB 6009 is a data acquisition card which can acquire analog inputs and send digital outputs.
4. The Logitech Webcam is used to record videos.
5. The BNC line is used to connect the trigger of DS7 Digitimer.
The concept of my program is pretty simple. When detecting muscle activation which is over a certain level, the DAQ card sends one digital signal to DS7 digitimer which stimulates muscle.
There is a problem that I do not have any amplifier to record the EMG. I use the sound card of my computer because a sound card is also a kind of DAQ card which can amplify sound signals and records them.
Here is my GUI of labview program. You can see I measured the EMG and joint angle. It also record the video. I can change the threshold which means the level of EMG signals need to over the setting level which trigger the ES.
Here is one thing that I should mention that I did not calibrate the voltage of EMG and the time scale. However, you can understand how it works on below movie.
It is a big sacrifice for me because the temperature is quite low today and I was naked when doing the project.
##CONTINUE##
2. The Electrogoniometer is to measure my elbow angle.
3. NI USB 6009 is a data acquisition card which can acquire analog inputs and send digital outputs.
4. The Logitech Webcam is used to record videos.
5. The BNC line is used to connect the trigger of DS7 Digitimer.
There is a problem that I do not have any amplifier to record the EMG. I use the sound card of my computer because a sound card is also a kind of DAQ card which can amplify sound signals and records them.
Here is one thing that I should mention that I did not calibrate the voltage of EMG and the time scale. However, you can understand how it works on below movie.
It is a big sacrifice for me because the temperature is quite low today and I was naked when doing the project.
星期六, 2月 06, 2010
Control a Servo by a Mouse via python and arduino
After I watched this interesting movie, I tried to do it by using python. However, I am a novel of python and arduino, so I spent lots of time to find the reference.
In python, I need:
1. win32gui module: to get the mouse position
2. pySerial module: to send the data to arduino
##CONTINUE##
Here is my python code
And my code in arduino
In python, I need:
1. win32gui module: to get the mouse position
2. pySerial module: to send the data to arduino
##CONTINUE##
Here is my python code
import win32gui
import time
import serial
ser = serial.Serial(4)
while (True):
x,y = win32gui.GetCursorPos()
time.sleep(0.2)
pos=int(179*x/1599)
ser.write(chr(pos))
print x,y
And my code in arduino
#include
Servo myservo;
int val;
void setup(){
myservo.attach(9);
Serial.begin(9600);
}
void loop(){
if(Serial.available()){
val=Serial.read();
myservo.write(val);
delay(15);
}
}
星期四, 1月 21, 2010
My New Toy
Recently,I bought the other kind of microcontroller called Arduino. Before this one, I've played Basic Stamp in my lab, but just know a little simple concept. Because Arduino is cheaper than Basic stamp, I bought it for myself and hope I can learn some knowledge about electricity or autocontrol. However, although I have great interest of it, I suppose to study my TOEFL test first because the test date is coming~~~~ T.T
星期四, 1月 14, 2010
Get the signal when pressing mouse left key
A Few weeks ago, I had a project which I need to synchronize two data acquisition system. One is recording force, the other is EMG data. Originally, I hope the force acquisition system can send the analog output to the EMG system, so I can record both data on EMG system. However, the force recording system is too difficult to send the analog output because the manufacture close all the lines in the box.
##CONTINUE##
Another way coming in my mind is to use a analog signal sending to both system. However, as I mentioned before, the force recording system closes all the lines in the box and I can't open it. I was forced to think another solution. Finally, I come up with sending a signal by the mouse when pressing the start of the force recording system so my EMG system can record the time of the beginning of force recording.
However, I know nothing about printed circuit board. I relied on the spirit of try and error to find the two position which can generate 5 voltage when pressing the mouse left key and then wield it.
I know it is nothing for many people, but for me, it's a good experience to do the thing that I have never done before although I accomplished it by try and error.
訂閱:
文章 (Atom)