parikhrohan
Published

433mhz and WiFi Connected Amazon Alexa Hub

This device can be incorporated in a home to connect up to 3 available Amazon Alexa's on the same WiFi network.

IntermediateShowcase (no instructions)1,733
433mhz and WiFi Connected Amazon Alexa Hub

Things used in this project

Hardware components

Breadboard (generic)
Breadboard (generic)
×1
Arduino UNO
Arduino UNO
×1
LED (generic)
LED (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Buzzer
Buzzer
×1
Resistor 10k ohm
Resistor 10k ohm
×1
Resistor 330 ohm
Resistor 330 ohm
×2
433mhz Transmitter and Receiver
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Custom parts and enclosures

No File

Schematics

Arduino w/ all Components

The diagram labels how to connect all the pins and components between the Arduino and breadboard, as well as the resistors.

Code

Transmitter & Receiver Hub Code

C/C++
Make sure to check that the pins match and then upload and press the button on your breadboard! it will scan for and connect multiple devices to the central Arduino. Now, when you use Alexa, one/two of the pair or trio will be accessing the cloud while the other just relays the information, reducing time.
#include "pitches.h"
#define GND 8
#define VCC 9
#define DATA 10
#define GND_R 5
#define VCC_R 2
#define DATA_R 4
#define button 12
#define buzzer 6
#define yellowled 11

int buttonState;
boolean recordedSignal[] = {1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1};
int melody[] = {
  NOTE_C4, NOTE_G4, NOTE_A4, NOTE_A3, NOTE_B3, NOTE_D3, NOTE_D4,
  NOTE_DS5, NOTE_E5, NOTE_FS5, 0, NOTE_B5, NOTE_E5, NOTE_DS5, NOTE_E5, NOTE_FS5, NOTE_B5, NOTE_DS6, NOTE_E6, NOTE_DS6, NOTE_AS5, NOTE_B5, 0,
  NOTE_FS5, 0, NOTE_DS5, NOTE_E5, NOTE_FS5, 0, NOTE_B5, NOTE_CS6, NOTE_AS5, NOTE_B5, NOTE_CS6, NOTE_E6, NOTE_DS6, NOTE_E6, NOTE_CS6,
 NOTE_E4, NOTE_F4, NOTE_G4, NOTE_G4, NOTE_G4, NOTE_CS4, NOTE_D4, NOTE_CS4, NOTE_B3, NOTE_B3, NOTE_CS4,
  NOTE_D4, NOTE_D4, NOTE_CS4, NOTE_B3, NOTE_CS4, NOTE_DS4, NOTE_FS4, NOTE_GS4, NOTE_DS4, NOTE_FS4, NOTE_CS4, NOTE_DS4, NOTE_B3, NOTE_CS4, NOTE_B3,
  NOTE_DS4, NOTE_FS4, NOTE_GS4, NOTE_DS4, NOTE_FS4, NOTE_CS4, NOTE_F4, NOTE_F4, NOTE_G4, NOTE_F4, NOTE_E4, NOTE_CS4, NOTE_B3, NOTE_CS4,
  NOTE_D4, NOTE_B3, NOTE_CS4, NOTE_DS4, NOTE_FS4, NOTE_CS4, NOTE_D4, NOTE_CS4, NOTE_B3, NOTE_CS4, NOTE_B3, NOTE_CS4,
  NOTE_FS4, NOTE_GS4, NOTE_D4, NOTE_DS4, NOTE_FS2, NOTE_CS4, NOTE_D4, NOTE_CS4, NOTE_B3, NOTE_B3, NOTE_CS4 };

// note durations: 4 = quarter note, 8 = eighth note, etc.:
int noteDurations[] = {
  32, 32, 32, 32, 32, 32, 32, 32,
  32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
  32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
  32,32,32,32,32,32,32,32,32,32,32,
  32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,
  32,32,32,32,32,32,32,32,32,32,32,32,32,32,
  32,32,32,32,32,32,32,32,32,32,32,32,
  32,32,32,32,32,32,32,32,32,32,32
};
 int randomNote; 

void setup() {
  // put your setup code here, to run once:

  pinMode(GND, OUTPUT);
  pinMode(VCC, OUTPUT);
  pinMode(DATA, INPUT);
  pinMode(13, OUTPUT);
 // pinMode(buzzer, OUTPUT);
  digitalWrite(GND, LOW);
  digitalWrite(VCC, HIGH);
  pinMode(GND_R, OUTPUT);
  pinMode(VCC_R, OUTPUT);
  pinMode(DATA_R, INPUT);
  digitalWrite(GND_R, LOW);
  digitalWrite(VCC_R, HIGH);
  Serial.begin(115200);
  pinMode(button, INPUT);
  pinMode(yellowled, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:

  for (int i = 0; i < sizeof(recordedSignal) - 1; i++)
  {
    buttonState = digitalRead(button);
    if (buttonState == LOW)
    {
      randomNote = random(101);
      int noteDuration = 1000 / noteDurations[randomNote];
      tone(6, melody[randomNote], noteDuration);
      int pauseBetweenNotes = noteDuration * 1.30;
      delay(pauseBetweenNotes);
      digitalWrite(yellowled, HIGH);
      Serial.print("Binary Value Transmitted: ");
      Serial.print(digitalRead(DATA));
      Serial.println();
      digitalWrite(13, LOW);
      digitalWrite(DATA, recordedSignal[i]);
      delayMicroseconds(315);
      digitalWrite(13, HIGH);
    }
    else {
        digitalWrite(yellowled, LOW);
        digitalWrite(13, LOW);
        buttonState = 0; 
    }
  }
 
  delayMicroseconds(9000);
}
    

Credits

parikhrohan

parikhrohan

2 projects • 0 followers

Comments