Project tutorial
Arduino Remote/Wireless Programming and Homemade Power Bank

Arduino Remote/Wireless Programming and Homemade Power Bank © CC BY-NC-SA

I must test the problem on my freezer (:-P) and I don't want to rewrite a sketch. The solution is to use a Bluetooth module!

  • 1,924 views
  • 0 comments
  • 5 respects

Components and supplies

About this project

The problem.

Bluetooth serial connection

Refer to my site for updated version https://www.mischianti.org/2019/01/31/arduino-remote-wireless-programming/

I developed a sketch near PC and I use USB and serial to "debug." In this case, I create the lib for DHT12. I deliver a version on GitHub of the library.

But arrive an issue, "When temperature goes under 0, the readed value is wrong."

Now I must test the problem on my freezer (:P) and I don't want to rewrite a sketch and use WiFi for a simple situation like so.

So without rewriting the sketch, I want to continue programming like previously, but my Arduino must go on my freezer.

I need two things. One is a battery, but I don't know how many test I must do so I need a rechargeable battery, and an adapter to work with microcontroller remotely, like Bluetooth.

Additional Component

For remote connection I'm goint to use:

Bluetooth adapter like:

  • HC-05 (only partially tested)
  • SPP C (eBay) (If you search you can find it at 1.5$)
  • 0.1uf Capacitor (for HC-05).

For power supply I'm going to use (you can use a simple 9v battery for arduino but It isn't rechargeable and I don't know how much test I need) a small rechargeable power pack:

18560 Battery (SparkFun) (Digi-Key) buy from here, I create a battery capacity checker and I see that the majority of 18650 battery on the net have fake capacity (the battery on test is 4500mha declared and 1100mha real)

  • TP4056 Lithium Battery Charger Module (eBay)
  • 0.9V-5V to 5V DC-DC USB Voltage Converter Step Up Booster Power Supply Module (eBay), It have only 600mha of output, If you want something more professional >1A you must go here (Digi-key)
  • 18560 Battery holder (Digi-Key) (SparkFun)
  • 2 position switch (eBay)

If you want all in one module you can look at this (Digi-key)

Power Supply (Simple Power Bank or UPS)

In my lab I have various device (buy to build something) but I think that a little emergency rechargeable usb power supply/battery pack is usefully, so with 2 simple component we are going to create one.

I buy TP4056 Lithium Battery Charger Module to create my solar power weather station.

And I have 5 step up usb module to recharge my phone with various battery, It's convert voltage from 0.9-5v to constant 5v.

In the connection schema you can see that we must add a switch before step up module because to get 5v It drain continuously current.

It can be used as power bank or UPS, the recharge module can recharge and give power supply at the same time.

The connection is simple, TP4056 battery output go to battery, TPR056 output go to step up usb module, on the positive wire must add a 2 position switch.

Power Bank: at Work

Power back at work

A minimal video of standard usage of this power bank/UPS.

Remote Connection

To create a remote connection without USB cable I want use bluetooth module as serial pass throw.

Than we must connect and program It with our Arduino. The connection schema is for programming bluetooth adapter.

In my lab I have 2 module an HC-05 and an SPP C.

But I use HC-05 to do wireless connection of my CNC router, but the low cost SPP C It's sufficient.

Normally I use 115200 baud rate for serial transmission, so I configure my bluetooth module to that rate.

Configure Bluetooth Module: HC-05 Clone

(refer to SetBluetoothModuleHC05.ino attach)

For HC-05 I use that code to configure for my cnc.

Serial output baud rate is setting here:

#define SERIAL_SPEED 115200

Bluetooth comunication baud rate here:

#define BLUETOOTH_SPEED 38400

First time you must set to configure bluetooth to 9600 to HC-06 devices, 38400 to HC-05 devices.

Than set bluetooth baudrate to set:

#define SET_BLUETOOTH_SPEED 115200

You can set new device name:

#define BT_NAME "TEST-Reef"

But HC bluetooth module is quite clean and standard, but that code not work on SPPC.

Configure Bluetooth Module: HC-05 (zs-040)

(refer to BluetoothATSender.ino attach)

This module is different from the other, connection is the same.

First you must pay attention to if button is present (to go on configuration mode press that button instead of but high pin 9 of the sketch). When led blink slow (every 2 secs) you are in configuration mode, configuration mode put device at 38400 baudrate, so you must put serial and software serial to that boudrate. Than insert this command:

AT
AT+ORGL
AT+POLAR=1,0
AT+NAME=Test-Reef
AT+UART=115200,0,0
AT+INIT

Pay attention ATèORGL reset device.

AT+INIT can give Error(17) but don't worry It means that It's already in that mode.

Configure Bluetooth Module: SPP C

(refer to SetBluetoothModuleSPPC.ino attach)

The code for SPP C isn't so clean like HC-05, but the result remain the same.

Serial output baud rate is setting here:

#define SERIAL_SPEED 115200

Bluetooth comunication baud rate here:

#define BLUETOOTH_SPEED 38400

First time you must set to configure bluetooth to 9600 to HC-06 devices, 38400 to HC-05 devices.

Than set bluetooth baudrate to set:

#define SET_BLUETOOTH_SPEED 115200

You can set new device name:

#define BT_NAME "TEST-Reef"

Connect Bluetooth Adapter to Arduino to Use As Serial Connection

For HC05 the only thing to note is that long leg (+) of capacitor going on reset, the negative going to DTR (or MCU-INT or State) of bluetooth adapter, you can use also a 0.1uf ceramic capacitor.

I didn't test HC-05 as programmer but only as substitute of USB cable for serial communication, so I'm going to show SPP-C module.

The SPP-C module in my case not work if I add capacitor, but work great without :D.

The rx of bluetooth adapter go wired on tx of microcontrollor, and tx to rx, than you must connect VCC and GND and DTR or MCU-INT or State of bluetooth adapter to reset of microcontroller.

For a better stability It's good thing to do a voltage divider versus RX bluetooth pin like in the image because transfer voltage is 3.3v not 5v.

Simple Sketch and Upload Via USB

USB serial connection

I create very simple sketch to upload, It's only write progressive number on serial every 1500 milliseconds.

In the video is show standard usage via USB cable.

Same Simple Sketch Upload via Bluetooth

Bluetooth serial connection

In this video the previously sketch upload remotely via Bluetooth without change code.

Real Test

Now I need response from the freezer.

From the deep of freezer, near the sausages, the remote test tell me that (damn) there is a bug on my DHT12 library when go under 0.

Thanks

Bug on DHT12 lib now fixed.

Code

SetBluetoothModuleHC05.inoArduino
No preview (download only).
BluetoothATSender.inoArduino
No preview (download only).
SetBluetoothModuleSPPC.inoArduino
No preview (download only).
Github
https://github.com/xreef/DHT12_sensor_library

Schematics

Configure bluetooth
connectionschemaconfigurebluetooth_KwRzeT3yzv.fzz
Connection schema bluetooth
connectionschemaprogrammingviabluetooth_I4fskaerx2.fzz
Connection schema bluetooth SPP-C
Connectionschemaprogrammingviabluetoothpccf bb mguf2btcaq

Comments

Similar projects you might like

BLUE_P: Wireless Arduino Programming Shield

Project tutorial by Shubham Shinganapure

  • 2,538 views
  • 10 comments
  • 20 respects

Take Control Over Lego Power Functions

Project tutorial by Patrick Müller

  • 57,966 views
  • 4 comments
  • 74 respects

Programming Atmel AT89 Series Via Arduino

Project tutorial by Patel Darshil

  • 11,236 views
  • 2 comments
  • 19 respects

Emergency Power Bank

Project tutorial by Tadeas Dvoracek

  • 5,074 views
  • 1 comment
  • 17 respects

A Power Router to Optimize Homemade Electricity with Arduino

Project in progress by philippedc

  • 1,313 views
  • 0 comments
  • 6 respects

Home Automation with Self-learning 433 Power Switches

Project tutorial by WJ4IoT

  • 2,746 views
  • 0 comments
  • 11 respects
Add projectSign up / Login