Thursday, October 12, 2017

Controlling the fan speed with your Arduino





Intro

You savaged a fan from an old PC to use it as a ventilator? Just hook it up to 12V and the sucker runs. Well, it runs at a constant speed. Maybe too fast, maybe too noisy. There must be a possibility to slow it down.

The idea

When you apply 12 Volts to it and then remove the power supply, it keeps spinning while getting slower. So if you continuously apply and remove the power, you can control the fan of the speed by the duration of the phases when the 12V is on and when it is not.

What do we need

The Arduino doesn't supply 12 Volts. So we have to use some sort of switch. An electronic switch. A MOSFET. That's a kind of transistor, that can handle the needed current/voltage needed. I used the IRF530N, because it was the only Mosfet I had and it matches the specification of the vent by far ;-). It's a N-channel Mosfet. That means you can control the connectivity of the negative pole of the power source to the fan by applying a positive voltage.

PWM

Pulse Width Modulation is the magic phrase. A digital output pin can only have two possible states. On or off. 1 or 0. HIGH or LOW. While HIGH is typically indicated by an output of 5 Volts (3.3 Volts occasionally) is LOW represented by a 0 Volt output. So how do we simulate an output of 2.5 Volts? Well, simply spoken, if we have a time frame of 10 seconds. Half the time we put out 5 Volts and half the time 0 Volts, we will have an output of 2.5 Volts of the time of those 10 seconds. Wired? Sure. But this is how math works ;-)
PWM



Video



Wiring





Links
IRF530N at Amazon

PWM-Image
https://commons.wikimedia.org/wiki/User:MatthiasDD


Monday, October 9, 2017

Use the force, Maker!




Into

Controlling a servo just by the wave of your hand? The wet dream of every Star Wars fan, isn't it? Yeah, mine too! With Microsoft's Kinect or OpenCV and a webcam and a ton of programming you can do it! Or there is a tiny, little module for your Arduino or your Raspberry Pi that can handle some simple gestures. The APDS-9960 can do the job.
It can be set to three different modes. It can work as a proximity sensor. Well, of that we have quite enough in the Arduino world. It can also operate as a ambilight sensor. Not bad. With four of them - each for every corner of your TV - you can make your own low cost ambilight.
But the mode, we're looking for, is the gesture recognition mode. It can detect following hand-movements:
- left to right
- right to left
- up to down
- down to up
- close to far
- far to close

How to use

Well, this is a multi functional sensor. It is developed by SparkFun. Therefore SparkFun published a pretty good library with very useful examples. If you pick the GestureTest example, you can implement easily your own control mechanism.

Video

 Connections 

 Careful

There are some versions of the sensor, marked as APDS-9960, that are really a APDS-9930. That means they are lacking the coolest of all functions - the gesture recognition thing!

Links

SparkFun Library @ Github
APDS-9960 @ Amazon