Hi. I’ve ordered a few bluetooth modules, so that we can (Eventually) control things with out smartphones (or your latop I guess). HOURRAY!!!
They are coming from China and the total order cost is a bit pricey. Heaven knows what’s going to happen over GST and so on. In the past they let my orders through with not much problem…if the order was about less than $100 USD (about RM350). This one from China is about RM600 and I’ve got another overseas delivery on the way for almost RM700, so I’ll probably get hit really hard with some kind of silly taxes 😦
Anyway, I want you to consider downloading the following apps:
1) S2 terminal for Bluetooth (Also called BT Term for BT) – the FREE one (red icon)
2) ArduDriod by TechBitar (newly designed for Arduino use 🙂 )
We will connect the bluetooth module to the arduino which can then control something like a motor etc.
So we will first learn (revise) about PWM (pulse width modulation) and use it to control a servo motor.
PWM basically involves switching the ‘power’ to something on and off at various speeds in order to control it. Hot water showers use this to control the water temperature. If you want to water to be more hot, you turn the dial on the shower and this causes an increase in the amount of time that the power flows into the water heater, hence the water gets warmer.
Servo motors ‘read’ the PWM signal frequency of the on-off pulses and turn the motor arm a certain angle depending on what PWM frequency they see. So say, 40 pulses per second will cause a 10degree rotation. 80 pulses may cause a 15degree rotation…. you get the picture. No signal causes the servo to bring the motor arm back into the rest position (zero degrees)
This is why the servo’s have 3 wires. One for input voltage, one for ground and a third one to carry the PWM signal.
Once we are happy with servo motor control then we will add the bluetooth module. AND BEWARE: WHEN MOTORS ARE USED, YOU MUST PROTECT THE CIRCUIT WITH A PROPER DIODE !!! The reason is that motors use electromagnetic coils, which causes INDUCTANCE. When fluctuations in current through the coil occurs (we control the current via the voltage) then “counter” currents are released by the coil. These reverse currents can be large and large currents damage things (even at low voltages!). A Diode can block these inductive currents.
Remember, you can probably learn this by yourself. I’m pretty sure your kits contain the parts already to do this. Go to the excellent Jeremy Blum arduino tutorial website to learn arduino with motors. (You’re probably better off watching tutorials 1-4 before you move onto #5)
Remember, Jeremy’s site has the video, parts list and importantly the “arduino sketch” (arduino code).
If you’re interested in inductance afrotechmods has made a couple of intro videos on inductance. Watch them in sequence. The third one is where the dangerous ‘inductive spiking’. Don’t worry if you don’t understand everything (especially about the MOSFET, you won’t need to understand it – the way the info is presented makes me confident you will appreciate it well enough)