Feasibility: use Arduino to control motor over serial Bluetooth connection

A project I'm working on requires using a motor to move a platform up and down at the flick of a switch. It would also be required to change the motion profile, either with a button on the device, or by uploading a new sketch to the Arduino (all via Bluetooth--the Arduino would be enclosed in a box).

My idea right now is to have an Arduino mediate between the battery and the motor in order to be able to tell the motor how to rotate. I would attempt to replicate the now discontinued Arduino BT using a Bluetooth module and micro controller.

It's been a while since I've used an Arduino, and even then it was only brief, so I'm really not sure about how to go about actually implementing this. I have tried Googling but have ended up more confused than anything. So, my questions are:

  • Is it possible to make an Arduino run a program as soon as it receives power (i.e. as soon as I turn on the device)?
  • Is it possible to add and remove programs from an Arduino wirelessly via Bluetooth using a Bluetooth module as a serial connection?
  • Is it possible to make an Arduino run a different program at the flick of a switch?
  • Is it possible to change the output voltage of the Arduino based on waveform data obtained from an external source (i.e. a waveform in the form of time and voltage values which would need to be input as a data table)?

Thanks in advance for any help or advice!

This is certainly possible: Arduino – Control DC Motor via Bluetooth

  1. That is what it does.

  2. You can program over bluetooth. Uploading a new program overwrites the previous one, you don't "remove" a program.

  3. No, but you can have multiple profiles in your program and chose which to run at the flick of a switch.

  4. I am sure it is but I haven't done so myself. just remember the arduino outputs a pwm signal not a true analog signal. If you need a analog signal pwm can be filtered but will still have some amount of ripple and it will slow response time. otherwise you will need to add a digital to analog converter(DAC).

Thanks for the reply Hutkikz! Just as a follow-up:

  • Just to confirm--this will work in the absence of a computer? I don't have to send the program to the Arduino each time? By "device" in my original question I am referring to the system consisting of the Arduino, motor, and battery.
  • See #3 below
  • What do you mean by profiles? And how would I set up these profiles in terms of hardware and software to achieve the functionality I mentioned (the ability to change profile by flicking a switch)?
  • I'll have to do some further searching here, but your answer has pointed me in the right direction Thanks again!
  1. yes once the program is uploaded it will run on it's own every time it is turned on or reset.

  2. ?

  3. I meant the "motion profiles" you mentioned. without knowing more I would say to write a separate function for each routine then use a state machine to chose(by flicking a switch or by a timer or .....) which one is active at any given moment.

Of course there is more to it. this series of tutorials shows a few ways you could approach it: Multi-tasking the Arduino part-1

You can send as much data as you like over Bluetooth but it's not as easy to reprogram the Arduino over Bluetooth.

What will be sending the messages to the Arduino? You mention "flicking a switch". Where/what is this switch?

Bluetooth is just "serial by wireless" and any data that you can send to the Arduino using the USB connection to your PC could also be sent using Bluetooth.

You should assume that you CANNOT upload a program using Bluetooth.

However you can write a complex Arduino program that can respond in different ways depending on the data that is sent.

You might also consider having very little "intelligence" in the Arduino program so that it just applies the data that it receives - for example whenever it receives speed and direction data it just applies that to the motor driver. Then the changing pattern of the output is entirely in the control of the PC sending the data. This approach means that it is much less likely that the Arduino will need to be re-programmed. But it is not suitable for every situation.

...R