How to remote reset your arduino with bluefruit from matlab

I’m using the bluefruit bluetooth adaptor for the arduino controlled mobile robot Piero

20140424_143025

Soldering JST PH male socket connectors to the bluefruit modules

This module is very useful for mobile robotics since is allows you to communicate wireless with your arduino and more important: to remote program the arduino.

In order to reprogram your arduino, the module needs (apart from dynamically adapt its uart speed) to invoke the arduino bootloader by resetting the microcontroller. This is done by using the module’s DTR output. This signal is connected to the arduino’s reset line trough a high-pass filter (electrolitic capacitor in series), as described in this tutorial. This hardware handshake signal can be controlled if you are using bluetooth EDR 4.0 or later, so choose your computer adapter carefully.

If you just want to remote resetting your arduino and you are using matlab this is all you have to do is to switch on and off the DTR line (Data Terminal Ready). Assuming that the com port for the bluetooth device is “COM20”, write in the matlab’s console:

s=serial("COM20");
fopen(s);
s.DataTerminalReady = 'on';
s.DataTerminalReady = 'off';
fclose(s)

This way, the arduino receives a short pulse with a duration that depends on the capacitor size. Enough to reset the micro, but short to let your program run.

Enjoy

Leave a Reply

Your email address will not be published. Required fields are marked *