Garage Door Opener shield

Hi Guys…

I am in the process of upgrading my electric motorcycle conversion dashboard and am including a garage door opener shield.

My Dashboard is my Google Pixel 3 mobile phone. It acts as the ignition key, monitors coolant and battery temps, and now will open and close my garage door!!

Here is a short video clip of the dashboard :
dashboard video

The garage door opener shield is the circuit board out of one of my Genie key fob controllers.
I found that a simple jumper controlled by a 5v relay should do the trick

If anyone is interested in my code, this is what I have written so far.Please let me know if you see any obvious errors that I am not seeing. It tests ok, I shall see after I install it on the bike if it really works.

/*This is my 1st attempt at tidying up my program that I created for my electric motorcycle conversion's secure keyless ignition
  via the Android Virtuino  app.
  UNO didnt hold up too well to the motorcycle hits, bumps and crashes!!
  I am replacing a temporary BT relay switch that I have in now in order to continue riding, with an Arduino Nano board.
  These are much smaller, so I will be able to put this and the HC-05 into better foam isolation in order to protect from road vibrations.
  I also intend to make an attempt at adding a garage door opener shield to the Virtuino dashboard. This shield is a modified circuit board found
  inside the Genie garage door opener key fob.


  The following code is what you'll need to run the interface between your Arduino board and your cell phone's VirtUino app via Bluetooth...

   Before  running this code config the settings below as the instructions suggest on the right...
   Virtuino example No3 (Bluetooth)
   Example name = "Read - write to Virtuino memory"
   Created by Ilias Lamprou
   Updated Jul 01 2016



   Download latest Virtuino android app from the link: https://play.google.com/store/apps/details?id=com.virtuino_automations.virtuino
   Getting starting link:
   Video tutorial link: https://www.youtube.com/watch?v=CYR_jigRkgk
   Contact address for questions or comments: iliaslampr@gmail.com
*/

/*========= VirtuinoBluetooth Class methods
   vPinMode(int pin, int state)                                  set pin as digital OUTPUT or digital INPUT.  (Instead of using default pinMode method

  ========= Virtuino General methods
   void vDigitalMemoryWrite(int digitalMemoryIndex, int value)   write a value to a Virtuino digital memory   (digitalMemoryIndex=0..31, value range = 0 or 1)
   int  vDigitalMemoryRead(int digitalMemoryIndex)               read  the value of a Virtuino digital memory (digitalMemoryIndex=0..31, returned value range = 0 or 1)
   void vMemoryWrite(int analogMemoryIndex, float value)         write a value to Virtuino float memory       (memoryIndex=0..31, value range as float value)
   float vMemoryRead(int analogMemoryIndex)                      read the value of  Virtuino analog memory    (analogMemoryIndex=0..31, returned value range = 0..1023)
   run()                                                         neccesary command to communicate with Virtuino android app  (on start of void loop)
   int getPinValue(int pin)                                      read the value of a Pin. Usefull for PWM pins
   void vDelay(long milliseconds);                               Pauses the program (without block communication) for the amount of time (in miliseconds) specified as parameter
   void clearTextBuffer();                                       Clear the text received text buffer
   int textAvailable();                                          Check if there is text in the received buffer
   String getText(byte ID);                                      Read the text from Virtuino app
   void sendText(byte ID, String text);                          Send text to Virtuino app
*/



#include <VirtuinoBluetooth.h> // Include VirtuinoBluetooth library to your code
#include <SoftwareSerial.h>
SoftwareSerial bluetoothSerial =  SoftwareSerial(3, 5); // arduino RX pin3= goes to HC-05 TX
//arduino TX pin=5 goes to HC-05 RX *use a voltage divider to protect HC-05 (3.3 v)
VirtuinoBluetooth virtuino(bluetoothSerial);
//The following libraries are needed for the DS18B20 temp sensor(s)
#include <DallasTemperature.h>
#include <OneWire.h>
#define One_Wire_Bus 10
OneWire oneWire(One_Wire_Bus);
DallasTemperature sensors(&oneWire);

boolean debug = true;           // set this variable to false on the finale code to decrease the request time.


void setup()
{

  bluetoothSerial.begin(9600);
  sensors.begin();
  const byte relay_power (9 , HIGH); // provides 5v power to relay switches
  const byte temp_sensor_power (12, HIGH); //provides 5v power to DSB20S temp sensors
  /* The above code is to avoid any noise on the bluetooth circuit by using seperate pin outputs for 5v power 
   * while the HC-05 is powered up by te Nano's 5v output. Probably not necessary and I'm testing to see if it works 
   * either way.
   */
  const byte emc_Power (7, LOW);  // controls Relay switch A for main power, initialzing it in the off position
  const byte garage_door (8, LOW); // controls Relay switch B for garage door opener shield add-on, initializing in the off positioncx 


  virtuino.vPinMode(7, OUTPUT);    // Relay A to power up eVOR
  virtuino.vPinMode(8, OUTPUT );   // Relay B to send garage door signal
  virtuino.vPinMode(11, INPUT); //string of DSB20S temp sensors


  Serial.println("Setup complete.");


}



void readTemperatures()
{
  Serial.println("Requesting temperatures...");
  sensors.requestTemperatures();
  Serial.println("DONE");
  /* The code following is to read the temp sensors and transmit the data to your android device.
      The DSB20S sensors are on a one wire string and automatically connected closest to arduino pin as first, furthest sensor is last.
    You can add as many sensors as needed. Add a 4.7K Ohm pull-up resistor at the start of the chain between yellow and +5v.

    ***IMPORTANT: Remember to assign Virtual pins in the Virtuino app settings. The V Pin # is associated with the specific sensor...
     example:   virtuino.vMemoryWrite(0, coolantTemp);  << this sensor will be assigned V0 pin on my phone
  */
  float coolantTemp = sensors.getTempFByIndex(0); //the first DS18B20 sensor on the BUS line (Coolant Temp)
  float leftBattTemp = sensors.getTempFByIndex(1); // Left Battery temp
  float rightBattTemp = sensors.getTempFByIndex(2); // Right Battery temp
  Serial.println("Temperature for Device 1 is: " + String(coolantTemp));
  Serial.println("Temperature for Device 2 is: " + String(leftBattTemp)); // disable this code line if using only one temp sensor
  Serial.println("Temperature for Device 3 is: " + String(rightBattTemp));

  virtuino.vMemoryWrite(0, coolantTemp);   // write temperature 1 to virtual pin V0. On Virtuino panel add a value display or an analog instrument to pin V0
  virtuino.vMemoryWrite(1, leftBattTemp);   // write temperature 1 to virtual pin V1. On Virtuino panel add a value display or an analog instrument to pin V1
  virtuino.vMemoryWrite(2, rightBattTemp);


}


void loop(void) {

  virtuino.run();  //  necessary command to communicate with Virtuino android app

  /*-- Enter your loop code below here. This is the code that controls the power relay to turn bike on/off.
    Avoid to use delay() function in your code. Use the command virtuino.vDelay() instead of delay()
     Change a virtual memory value every time Pin 7 changed
     Add a Value Display on Virtuino app to virtual memory V1

  *** Remember to program the Virtuino code on your Android device to match pins on the Arduino (using Digital or Analog Pin #s)
  */

  const byte emc_Power = digitalRead(7);                          // read  the value of Pin 7
  if (emc_Power == HIGH)  virtuino.vMemoryWrite(7, HIGH);  // change the virtual memory value
  else virtuino.vMemoryWrite(7, LOW);                  // change the virtual memory value

  const byte garage_Door = digitalRead(8);   // determines state of pin 8
  if (garage_Door == HIGH) virtuino.vMemoryWrite(8, HIGH);
  else virtuino.vMemoryWrite(8, LOW);

  readTemperatures();

  virtuino.vDelay(1000);
}