Introduction: Gemini AI Assistant With Esp32

As you may have used google's new AI assistant Gemini. A few time ago Gemini's api got out, so this is a project to test the gemini api

why gemini?

  1. there is a controvercy between google's Gemini and open ai's chatGPT while chatGPT has huge popularity it isn't free.
  2. where as gemini is free that means we can ask as many questions as we want.

Supplies

  1. ESP32 dev module
  2. 2.8 nich tft display

Step 1: Connection

components

here i have used (ili9341) tft display and esp32 dev module

  1. 2.8 inch tft display - (buy)
  2. esp32 dev module -(buy)


2.8 inch tft display --> Esp32

  1. Vcc. ----> 3.3v
  2. Gnd. ----> Gnd
  3. CS. ----> D15
  4. RST. ----> D4
  5. DC. ----> D2
  6. MOSI. ----> D23
  7. SCK. ----> D18
  8. LED. ----> 3.3V
  9. MISO. ----> D19

Step 2: Getting the Api Key

  1. search for gemini API docs.
  2. click on "get a Gemini api key".
  3. then "create API key".
  4. then click "Create new api key".
  5. click "copy".

And here you have the API key for gemini AI.

Step 3: Setting Up the Boards

Skip this step if you have all library and boards installed.

Installing arduino ide :

  1. go to Arduino.cc
  2. then click on "software"
  3. install the software according to your pc.
  4. after it gets download install it.

Installing esp32 bord manager :

  1. In your Arduino IDE, go to File> Preferences
  2. In Additional Boards Manager URL paste this url - https://dl.espressif.com/dl/package_esp32_index.json,http://arduino.esp8266.com/stable/package_esp8266com_index.json
  3. Open the Boards Manager, Go to Tools> Boards> Boards Manager
  4. search fo esp32 by Espressif Systems and click install.

All the libraries you will need for this project :

  1. TFT_eSPI -https://github.com/Bodmer/TFT_eSPI.git
  2. SPI.h - https://github.com/PaulStoffregen/SPI.git

NOTE :- replace the user setup.h file of TFT_eSPI library with the file given below.

User setup file location

documents --> Arduino --> libraries --> TFT_eSPI

Step 4: Code

There are just few changes to be done and you are good to go

  1. replace the "ssid" with your wifi"s name.
  2. replace "password" with your wifi's password.
  3. replace "API" with the Gemini API key got in the 2nd step.
  4. click on upload.

and there you have the your esp32 runnig Gemini AI.

Step 5: Conclusion

you can aks any question using the serial monitor in the IDE press "ctrl+shift+m" keys to open the serial monitor and after it gets connected to network try asking your question

the answer will get displayed on both serial monitor and tft display.

enjoy.