Posts

Turn ChatGPT into Your own Voice AI with Python

Image
For more information about the Vosk speech recognition engine used, refer to: https://alphacephei.com/vosk/ Code used in this video: # TinkerChatGPT by The Tinker Foundry # Giving ChatGPT ears to hear and a voice to speak # ---------------------------------------------------- # Dependencies on python libraries described below # ---------------------------------------------------- # Uses Vosk speech recognition: #    pip install vosk #    pip install sounddevice #    prerequisites: as described in https://alphacephei.com/vosk/install and also python module `sounddevice` (simply run command `pip install sounddevice`) # Also uses text-to-speech (TTS): #    pip install pyttsx3 # Of course, we use the openAI api for access to ChatGPT engine: #    pip install openai # ---------------------------------------------------- import argparse import queue import sys import json import sounddevice as sd import pyttsx3 import openai from vosk ...

ESP32 as a Server Handling HTTP GET Requests from a Client

Image
  ESP32 C-Code used in this video: // Tinker Foundry // ESP32 Server to handle GET requests from a client on the local WiFi network // Indicate request on serial interface and also provide a response to the client // To test this, once uploaded onto the ESP32, note the IP address reported by ESP32 over the serial monitor, and // then open a browser on your computer and enter the following in the address bar: http://IP_Address_from_ESP32/?param1=10&param2=hello // Also, try running the accompanying Python HTTP client code with GUI for a complete experience... #include <WiFi.h> // need to install libraries ESPAsyncWebserver and AsyncTCP from Github respository // https://github.com/me-no-dev/ESPAsyncWebServer // https://github.com/me-no-dev/AsyncTCP // In both cases, download library zip files and extract to C:\Users\name\Documents\Arduino\Libraries directory so Arduino will see them // Remove the "-master" suffix of the library directories #include "ESPAsyncWe...

Up Close With a US $10 Bill

Image

ESP32 Posting Requests to Local Webserver

Image
Code used in this demonstration: Python Server Code: # Tinker Foundry Example Python Code # Python web server to work with ESP32 POST request # This runs on your local computer, connected on the same WiFi network as your ESP32 controller from http.server import BaseHTTPRequestHandler, HTTPServer hostName = "192.168.xx.xxx" # use ipconfig in console (command prompt) to get the "IPv4 Address" of this machine serverPort = 8080 # BaseHTTPRequestHandler class is used to handle the HTTP requests that arrive at the server class MyServer ( BaseHTTPRequestHandler ):     def do_POST ( self ): # handle POST request from ESP32 (or anything else, really)         content_length = int ( self .headers[ 'Content-Length' ]) # Gets size of data         post_data = self .rfile.read1(content_length) # Gets data         print ( "Post Data: " )         print (post_data.decode( 'utf-8' )) # This is the message fr...

Up Close with a US $20 Bill

Image

Accurate Timekeeping on ESP32 using an NTP Server

Image
Below is the code used in the video to have ESP32 request time from an NTP server and update the internal RTC clock. // The Tinker Foundry ---  https://youtu.be/c6r9kECS6RQ // ESP32 Code for testing RTC - real-time clock updated from an NTP (network time protocol) server over the Internet // Use NTP to get Coordinated Universal Time (UTC) and adjust to local time/date // ESP32 will connect to an NTP server and send a request packet // In response, the NTP server will send a time stamp packet #include <WiFi.h> // The usual for ESP32... #include "time.h" // ESP32 native time library to handle NTP server connectivity and synchronization   const char * ssid     = "********" ;   // input your wifi name const char * password = "********" ;   // input your wifi passwords   // set up the NTP server name const char * NTPServer = "time.google.com" ; // for our example, let's use Google's public NTP - see developers.google.time for m...

Up Close with a Canadian $100 Note

Image