Google Assistant is a digital assistant that is developed by Google. It is a part of the Google Home product line and can be used with Google Home, Android devices, and iOS devices. It can perform actions such as setting alarms, adding calendar events, and playing music. It can also answer questions about general topics such as the weather and sports. Google Assistant can also control smart home devices such as lights and thermostats.
The Google Assistant Notice Board is a new feature that allows users to post notes and reminders for themselves and other members of their household. This can be useful for leaving messages for family members or for posting reminders about upcoming events. The Notice Board can be accessed by saying "Hey Google, show me my Notice Board"
Smart Notice board with google assistant and Esp32 Making video:
Smart Notice board with google assistant and Esp32 code :
#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <SPI.h>
#include <WiFi.h>
#include <WiFiMulti.h>
#include <HTTPClient.h>
#include <Adafruit_MQTT.h>
#include <Adafruit_MQTT_Client.h>
//*************IMPORTANT***************************//
//***** Next line you have to check one by one to see which one works with your display!! *****//
//***** Simply uncomment the line and check if it works and comment the previous one *****//
#define HARDWARE_TYPE MD_MAX72XX::FC16_HW
//define HARDWARE_TYPE MD_MAX72XX::GENERIC_HW
//#define HARDWARE_TYPE MD_MAX72XX::ICSTATION_HW
//#define HARDWARE_TYPE MD_MAX72XX::PAROLA_HW
#define SCROLL_DELAY 70
char* str;
String payload;
uint32_t present;
bool first_time;
uint16_t scrollDelay;
#define CHAR_SPACING 1
#define BUF_SIZE 96
char curMessage[BUF_SIZE];
char newMessage[BUF_SIZE];
bool newMessageAvailable = false;
WiFiMulti WiFiMulti;
#define MAX_DEVICES 4
#define CLK_PIN 18 // or SCK
#define DATA_PIN 23// or MOSI
#define CS_PIN 15 // or SS
#define AIO_SERVER "io.adafruit.com"
#define AIO_SERVERPORT 1883 // use 8883 for SSL
#define AIO_USERNAME "Veera7474"
#define AIO_KEY "aio_QGkO381zsGTNIawGXB87TNWoU9yx"
WiFiClient client;
Adafruit_MQTT_Client mqtt(&client, AIO_SERVER, AIO_SERVERPORT, AIO_USERNAME, AIO_KEY);
Adafruit_MQTT_Subscribe message = Adafruit_MQTT_Subscribe(&mqtt, AIO_USERNAME "/feeds/project1");
void MQTT_connect();
MD_MAX72XX mx = MD_MAX72XX(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);
uint8_t scrollDataSource(uint8_t dev, MD_MAX72XX::transformType_t t)
{
static char *p = curMessage;
static uint8_t state = 0;
static uint8_t curLen, showLen;
static uint8_t cBuf[8];
uint8_t colData;
switch (state)
{
case 0:
showLen = mx.getChar(*p++, sizeof(cBuf) / sizeof(cBuf[0]), cBuf);
curLen = 0;
state++;
if (*p == '\0')
{
p = curMessage;
if (newMessageAvailable)
{
strcpy(curMessage, str);
newMessageAvailable = false;
}
}
case 1:
colData = cBuf[curLen++];
if (curLen == showLen)
{
showLen = CHAR_SPACING;
curLen = 0;
state = 2;
}
break;
case 2:
colData = 0;
curLen++;
if (curLen == showLen)
state = 0;
break;
default:
state = 0;
}
return (colData);
}
void scrollText(void)
{
static uint32_t prevTime = 0;
if (millis() - prevTime >= scrollDelay)
{
mx.transform(MD_MAX72XX::TSL);
prevTime = millis();
}
}
void no_connection(void)
{
newMessageAvailable = 1;
strcpy(curMessage, "No Internet! ");
scrollText();
}
void setup()
{
mx.begin();
mx.setShiftDataInCallback(scrollDataSource);
scrollDelay = SCROLL_DELAY;
strcpy(curMessage, "Hey! ");
newMessage[0] = '\0';
Serial.begin(57600);
Serial.print("\n[MD_MAX72XX Message Display]\nType a message for the scrolling display\nEnd message line with a newline");
// Serial.setDebugOutput(true);
Serial.println();
Serial.println();
Serial.println();
for (uint8_t t = 4; t > 0; t--) {
Serial.printf("[SETUP] WAIT %d...\n", t);
Serial.flush();
delay(1000);
}
WiFi.mode(WIFI_STA);
WiFiMulti.addAP("mewt","Veera@0000"); // ssid and password
Serial.println("Connecting");
newMessageAvailable = 1;
present = millis();
first_time = 1;
// Setup MQTT subscription for onoff feed.
mqtt.subscribe(&message);
str = "Ask Google Assitanat ";
}
void loop()
{
while (WiFiMulti.run() != WL_CONNECTED) {
Serial.println("WiFi not connected!");
delay(1000);
}
MQTT_connect();
Adafruit_MQTT_Subscribe *subscription;
while ((subscription = mqtt.readSubscription(1))) {
if (subscription == &message) {
payload ="";
Serial.print(F("Got: "));
Serial.println((char *)message.lastread);
str = (char*)message.lastread;
payload = (String) str;
payload += " ";
str = &payload[0];
newMessageAvailable = 1;
}
}
scrollText();
}
void MQTT_connect() {
int8_t ret;
if (mqtt.connected()) {
return;
}
Serial.print("Connecting to MQTT... ");
uint8_t retries = 3;
while ((ret = mqtt.connect()) != 0) {
Serial.println(mqtt.connectErrorString(ret));
Serial.println("Retrying MQTT connection in 5 seconds...");
mqtt.disconnect();
delay(5000);
retries--;
if (retries == 0) {
while (1);
}
}
Serial.println("MQTT Connected!");
}
download the code by clicking on the download button
0 Comments