Thursday, 14 May 2015

Control speed of a dc motor with pwm in Arduino


Right, in this post I'm going to show you what "PWM" is and how it works?

Ok, the pwm stands for Pulse Width Modulation. What it means is that you kind of cntrol the power by switching the power on and off. And you control the duration of the power you putting in and the duration of the power that you are not giving.

So, let me give you an example, as you can see in the picture above, there are three examples in that picture. Every example's got same input power which is 5volts, but the output power is different.


Why?
Well, that's because in the first example you can see that the duration of the power is 75% then 25% no power then 75% power again so if you continue like this then the output power will be 3.75 volts.

Let's have a look at the second example. The input power is 5volts and the output is 2.5volts. That's because we can see in this example that the duration of power is 50% and none duration of power is 50% too. So we getting 2.5volts in result.

Ok, Let me give you a real example which I've done with Arduino, please watch the video and see how easily you control speed of a dc motor without any potentiometer.




There are three sketches, please upload one sketch at a time.

// sketch 1. high speed
int motor = 2;

// the setup routine runs once when you press reset:
void setup() { // initialize the digital pin as an output.
pinMode(motor, OUTPUT);


}

// the loop routine runs over and over again forever:
void loop() {
digitalWrite(motor, LOW);
delay(50);
digitalWrite(motor, HIGH);
delay(100);
}

// Sketch 2. medume speed
int motor = 2;

// the setup routine runs once when you press reset:
void setup() { // initialize the digital pin as an output.
pinMode(motor, OUTPUT);

}

// the loop routine runs over and over again forever:
void loop() {
digitalWrite(motor, LOW);
delay(25);
digitalWrite(motor, HIGH); //Motor on
delay(100);
}

// Sketch 3.low speed
int motor = 2;

// the setup routine runs once when you press reset:
void setup() { // initialize the digital pin as an output.
pinMode(motor, OUTPUT);

}

// the loop routine runs over and over again forever:
void loop() {
digitalWrite(motor, LOW);
delay(15);
digitalWrite(motor, HIGH);
delay(70);
}

Note: You can change the "delay" numbers according to your needs.

Circuit diagram: 


Friday, 8 May 2015

The cheapest way to get rid of bed bugs! 100% works

Bed bug 

If you are looking for the cheapest way to get rid of bed bugs then you have come to the right place.

Actually few years ago some bed bugs came with one of my family member from some where,  and it spread whole house very quickly. As you know that if just one female bed bug enters your house it can produce thousands of them. So after few month people started realising that something has entered the house.

Ad

I started finding small black sometimes red dots  (which was obviously my blood they were sucking out of me) all over my bed and my body, one day when I was looking at the mirror and I saw few black dots emerging. I didn't care much when I saw those dots on other parts of my body, but when I saw on my face that's when it struck me the hardest. Straight way I started to think why is this happening and what is the reason behind it?

After some research I found that those dots actually are signs of bed bugs. When I found that I got really scared because I don't want some nasty bugs suck my blood. Any way it started worrying me a lot so much so that when ever I used to feel that something is crawling on my body in middle of the night I used wake up and find them and kill them then I used to get my torch out and look for their hiding place. 

I've spend lot of money to buy sprays to eliminate them but that didn't work, then I tried hot steam clean but that didn't work as well.  Then I've tried sticky tape, but that didn't work too and I found sticky tape is a big hassle. So started catching them and experimenting with them. 

Once I was catching them and putting them in a plastic bottle I've realised that they are not climbing up in fact I found out that they can't get a grip on plane surface so I did a small experiment with sellotape and I saw that they can't climb up the sellotape either. So I've put one line of sellotape all around my bed in three layers. One near the wheels  second round in the middle of my bed and the third round in the middle of my mattress over the bed sheet. After doing this I've never seen a bed bug sign after that.

My logic was simple. Make them stay away from you and they will die due to starvation. 


Ad