Skip to content

6. Arduino Simulation

Patrick Robichaud edited this page Jan 2, 2018 · 2 revisions

Description of the decision process and implementation of Proteus Arduino simulation with Bluetooth library.

In order to develop and test Arduino code intended to control the glove vibrator motors, the following simulation environment is proposed.

Simulation Environments

Arduino Programming IDEs

Multiple environments were considered, with the following issues.

PCB Simulation Environments

The following is a very powerful, full-fledged circuit simulation environment with support for BT modules (HC-05/06), any Arduino model (nano/micro/uno...) with Arduino source code deployment (accepts the path of "*.elf" binaries and runs them on the virtual Arduino), and BT emulation over COM port.

Serial Port Emulators

C++ Serial Comm Classes

Simulation Platform Selection

Proteus is the ideal simulation environment due to its greater sophistication and maturity (ability to design complete circuits from scratch), and though it is not free it can easily be cracked. The following steps must be taken to make Proteus ready to use.

Objective

The goal of this simulation is to have a working circuit that accepts commands from a paired Bluetooth device, and successfully controls virtual vibrator motors. The basic components I see are as follows:

  • Bluetooth communication protocol/commands shared between Platform and Arduino.
  • Power delivery system (5V for Arduino + 3.7V for motors).
  • Bluetooth module hardware connection + software communication accepting commands from paired device.
  • Software loop that parses control commands from paired device and modulates vibrator control voltages accordingly.

Software Loop

A paired bluetooth device (eg. Arduino) shows up to a Windows host as a serial (COM) port device once it is paired. Assuming that the device has already been paired (once-and-for-all), BlindAid will simply need to integrate serial communication, and develop the proper commands following whatever the chosen serial protocol.

Challenges

  • Communication with the Proteus virtual HC-05 BT module is done via COM serial ports, there is no emulation of a true BT connection. Thus, we will only be able to implement Control simulation from BlindAid through a serial communication API class.
  • It seems as though on the Windows PC side, a bluetooth connection to an Arduino will show up as a COMP port in Realtime anyway, so regardless of whether we are using the simulation OR a physical BT module, the connection method MAY end up being roughly the same.
  • in Realtime an additional act of PAIRING the Arduino and PC will be required, but I don't think this will involve code (the user manually pairing - hopefully only one - will be a prerequisite to the software working).