Universal Control Panel

by Bluebotlaboratories in Circuits > Remote Control

603 Views, 5 Favorites, 0 Comments

Universal Control Panel

IMG_8938 (1).jpg

The IoT Control Panel is an all-in-one solution to controlling your smart-home devices easilly.

It has Google Assistant Integrated into it too!

It uses wxPython as well as an open-source modular coding system which allows it to be easilly expanded by other people.

Supplies

Please Note:
You will need basic Linux experience with programs such as bash and nano.
Soldering Experience is recommended.
Knowledge on Python/wxPython is required if you intend to develop apps and modules for it.

Software:

Hardware:

Tools:

  • Screwdriver Set
  • Pry Tool
  • Drill
  • 3D Printer
  • Wire Stripper
  • Scissors
  • Glue

The files for the main case are available here on Tinkercad

Taking Apart Speaker

IMG_8591.jpg
IMG_8592.jpg
IMG_8593.jpg
IMG_8594.jpg
IMG_8595.jpg
IMG_8596.jpg

First, peel of the rubber feet from the buttom of the speaker.

Next, use a pry tool or a screwdriver to gently pry the inner piece off.

Once it is high enough, grab it with your fingers and gently pull it out of the outer shell.

Then, undo the screws in the inner sheel and pry it apart.

Once that is done, slide the circuit board out and pry off the speaker.

Then, take off the fake rubber piece and cut the plastic to remove the speaker completely.

Extract the Speaker and Speaker Driver

IMG_8599.jpg
IMG_8600.jpg
IMG_8602.jpg
IMG_8603.jpg
IMG_8604.jpg
IMG_8921.jpg
IMG_8924.jpg
IMG_8922.jpg
IMG_8923.jpg
IMG_8907.jpg

First, unscrew the top part of the inner shell and gently remove it from the bottom part.

Then, pry off the speaker and gently slide the circuit board out if its enclosed space.

To remove the USB Cable, use the scissors or any other tool to enlarge the hole containing the usb cable and once it is large enough, slide the USB cable through it.

Now, remove the fake rubber speaker piece and cut the plastic in between it and the wire as shown in the image and slide the speaker wire through the gap and then slide the rest of the speaker through the gap too.

Please Note: The speaker wires are very delicate and will break easily so please take care

Extract the Microphone Form Its Enclosure

IMG_8609.jpg
IMG_8614.jpg
IMG_8616.jpg
IMG_8617.jpg
IMG_8620.jpg
IMG_8622.jpg
IMG_8624.jpg
IMG_8625.jpg

First, turn the microphone upside down and begin drilling a hole near the edge.

Make sure the hole goes through the lower panel of the microphone.

As long as you stay on the edge and away from the USB Cable you should not have to worry about the internal PCB being damaged

Now, using a screwdriver or a pry tool, pry the bottom panel off the rest of the microphone.

Now, pry the microphone and its circuit off the base plate and remove any remaining adhesive from it.

Install Raspbian

IMG_8634.jpg
IMG_8633.jpg
Screenshot 2021-02-20 195722.png
It's an installer.png
Imager.png
Select OS.png

First, insert your Micro SD Card into your computer

Download and install the Raspberry Pi Imager from here

Once it is installed, open it

Select 'CHOOSE OS'

Select Raspberry Pi OS (32-Bit)

Then, click on 'CHOOSE SD CARD' and select the SD Card you inserted into your computer

Now, click on 'WRITE' and wait for it to flash the image onto the Micro SD Card.

Enable SSH

ed7dc3c8-e197-4090-ba17-a18ea2cba816.png
sdlkdffdf-sdffsd-453f.png
xcznmkbczxnm ,xczf-cfxdcxfvxdf-5454335.png
rdetsffgdgfd.png
dfgsdgsd.png
3xdsgfdfshdfsgd.png
sdjkhsdjhkfdshjsdffsdfajkfd.png
sdfsdafsadfsd.png
re4tty6yu76ht.png
IMG_8635.jpg

Open the file explorer and select the device named 'boot'.

Then, right-click and select 'New'. Then click anythin below 'Folder' and 'Shortcut'.

This should create a new file, rename it to SSH and click on yes when prompted to rename the extension.

Then, create a new text file called 'wpa_supplicant.conf', open it with your preferred text editor and paste the following info into it:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=<Insert 2 letter ISO 3166-1 country code here>

network={
ssid="<Name of your wireless LAN>"
psk="<Password for your wireless LAN>"
}

Replace the placeholders (in triangle brackets <> with your own information as shown below):

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=GB

network={
ssid="Home-WiFi"
psk="Password123"
}

Then, eject the drive by right-clicking it and pressing 'Eject'.

Adding the Screen and Powering on Your Pi

IMG_8919.jpg
IMG_8920.jpg
IMG_8639.jpg
IMG_8640.jpg
IMG_8641.jpg

First, put the screen onto your RPi as shown in the image.

Then, turn you Raspberry Pi upside-down and insert the Micro SD Card

Then, plug it in and turn it over

If the LCD does not glow a bright white like in the image, then unplug the Raspberry Pi and check your connections and power supply. Also verify that the Micro SD card is inserted correctly and is not corrupted.

Find the Pi's IP

SCN000.png
SCN 01.png
vfczdgfgdcnbjvcbxcvfnhfbvmjnhbv.png

First, you will need to download an IP scanning tool, for example this one.

Then, you can either install it or run it.

Normally, the default settings should be fine so when it opens, click on Scan

Please Note: Other Raspberry Pi's with unknown IP addresses must be unplugged or they may show up on the scanner

When the table fills up, look in the 'Manufacturer' column and there should be one labeled 'Raspberry Pi Foundation', to the left of that column if the IP Address of it.

If you have multiple Pis, then list all of the IPs and cross out the ones that belong to your already-plugged in Pis

Now you should have the IP Address of your Pi, note it down somewhere.

Connecting to the Pi Via SSH

PTY 02.png
pty 03.png

In order to connect to the Pi, you will need to use PuTTY.

Install PuTTY from here.

Once it is installed, open it and enter the Pi's IP in the input box as shown in the image above.

Next, click on 'Open'

If you see a window with the title of 'PuTTY Security Alert', click on 'Yes'

Then, when prompted for a username type in 'Pi' and press Enter, then type in 'raspberry' for the password and press enter. You will not see the password being typed, this is ok.

Installing the Driver

asdfsdfsdf.png
IMG_8643.jpg

Type the following commands into the PuTTY Terminal:

cd ~
sudo rm -rf LCD-show
git clone https://github.com/goodtft/LCD-show.git
chmod -R 755 LCD-show
cd LCD-show/
sudo ./LCD35-show
sudo reboot

Your Pi should now reboot and the screen should display an image!

If you see some set up steps then follow them and update the Pi, then, shut down your Pi and put the Micro SD Card back into the PC.

Configuring the Display Properly

ghtgf.png
dfbhced.png
eryg.png
kjhjhjhhj.png

Open the config.txt file in the 'boot' drive and scroll to the end of it.

Then add the following lines to the file:

hdmi_group=2
hdmi_mode=87
hdmi_drive=2
hdmi_cvt=320 480 60 1 0 0 0

Now, eject the card, put it back into your Pi and turn it on. If the screen does not work, please check the code you entered.

Add Wires to the Raspberry Pi

IMG_8914.jpg
IMG_8915.jpg

Now that the display has been set up, you can construct the rest of the control panel.

First, power of your Pi and gently take of the display.

Then, add 4 double sided female connector wires to the RPi in the positions shown in the image

Note the wires in the same positions as the ones in the image as:

  • Blue = Ground
  • Brown = Ground
  • Purple = Ground
  • Yellow = GPIO 16
  • Red = GPIO 20
  • Orange = GPIO 21
Please Note: Note the wires by position, not by colour, check the image

Now, be careful to fold the wires outwards of the Pi and then slide the screen on top of the GPIO pins as shown in the image.

Assemble the Case: Add the USB Hub

IMG_8954.jpg
IMG_8955.jpg
IMG_8953.jpg
IMG_8916.jpg
IMG_8918.jpg

Since the Raspberry Pi 3A+ only has one USB Port, we need to install a USB Hub. To do this, first, cut of the rubber around the USB plug, be careful not to break the USB plug. Now, slide the bug in between the Pi and the Screen

Assemble the Case: Button Wiring

IMG_8929.jpg
IMG_8930.jpg
IMG_8931.jpg
IMG_8932.jpg
IMG_8933.jpg
IMG_8934.jpg
IMG_8935.jpg

First, 3D print the three parts of the case.

Then, grab 3 tactile buttons and cut off two pins from each button as shown in the image.

Then, slide each button into each hole in the button bracket as shown in the image.

Please Note: You will need to bend the remaining pins slightly forwards so that you can fit the button in the button bracket

Now, connect one ground wire into each button as shown and then connect the GPIO 16, 20, and 21 wires into each button as shown. Make sure you order it correctly.

You may need to press down firmly for the wires to "click" into place.

Please Note: You may want to use some glue to secure the wires to the 3d printed part

Assemble the Case: Button Assembly

IMG_8941.jpg
IMG_8936.jpg
IMG_8937.jpg

Now, put the completed assembly into the main case assembly as shown in the image above and make sure that GPIO 16 wire is at the top as shown in the second image.

Make sure you use a little bit of glue on the tabs

Assemble the Case: the Pi

IMG_8945.jpg

Now, peel off the screen plastic and slide it into its slot.

Make sure it is flush and then press a little on the screen to check if it is secured.

If it is not, you may want to re-slide it in but with some dabs of glue applied.

Assemble the Case: Insert Speaker and Microphone

IMG_8957.jpg
IMG_8960.jpg
IMG_8961.jpg
IMG_8962.jpg
IMG_8963.jpg
IMG_8944.jpg

Add a little bit of glue around the edge of the speaker and microphone and stick it into its slot in the case.

Then, fix the microphone wire using the second piece and by matching the colours.

Now, connect them to the USB Hub.

Setting Up Google Assistant Service

How Set up The Google Assistant Service for the Universal IoT Control Panel

Using This Tutorial as reference, set up the service as follows:

First, open the google actions console and click on add/import project

Then, give it a name Now, scroll down and select device registration Now, without closing that tab, open a new one and go to the google assistant api Make sure you have the correct project selected as shown If it isn't already enabled, enable the API Now click on the credentials tab and click on configure consent screen Choose external and click on create Now, fill in the fields with any value and click on save and continue Now click on save and continue again Click on save and continue again Now, scroll down and click on back to dashboard Then, click on the add users button and when prompted type your email and click on save Once you are done, go back to the previous tab and click on register model Now fill in the fields with any information you want and click on register model Now download the credentials by clicking on the button. Now click on next and then select the brightness trait and then click on save traits. Now, get a USB Drive and format it. Please note: This will delete all your files. Formatting is required so the program can read it. Now copy the credentials file to the root of the USB.

Now, go to https://github.com/Bluebotlabz/Universal-IoT-Control-Panel and download the example config.ini, change the modelID and the projectID values to match the ones from the Google Assistant Service as shown:

From:

[config]
; Enable/Disable debug mode, 0 = disabled, 1 = enabled
debug = 0

[assistant]
; Assistant can be 'googleAssistant' (for google assistant)
assistant = googleAssistant
; Enter IDs
modelID = <ModelID>
projectID = <ProjectID>
; File for hotword detection (COMING SOON)
;model = /file/model.pmdl<br>

To:

[config]
; Enable/Disable debug mode, 0 = disabled, 1 = enabled
debug = 0

[assistant]
; Assistant can be 'googleAssistant' (for google assistant)
assistant = googleAssistant
; Enter IDs
modelID = iot-control-panel-fgerg
projectID = iot-control-panel-greqf
; File for hotword detection (COMING SOON)
;model = /file/model.pmdl

Now, copy the config.ini file you just edited onto the root of the USB Stick, plug the USB Stick into one of the Pi's USB Ports and run the commands in the rest of the Instructable.

Installing the Main Program

Now we have the hardware assembled and configured, we can now install the software for the app itself.

First, you will need to scan the IP and connect to it using SSH as shown earlier and run these commands:

cd ~/
sudo apt update && sudo apt upgrade -y
sudo apt install git python3 libjpeg-dev libtiff5-dev libnotify-dev libgtk2.0-dev libgtk-3-dev libsdl1.2-dev libgstreamer-plugins-base0.10-dev libwebkitgtk-dev freeglut3 freeglut3-dev portaudio19-dev libffi-dev libssl-dev python-rpi.gpio python3-rpi.gpio python3-wxgtk4.0 python3-wxgtk-webview4.0 python3-wxgtk-media4.0 -y
sudo python3 -m pip install --upgrade pip setuptools wheel google-assistant-sdk[samples] google-auth-oauthlib[tool] PyAudio urllib3[secure] sounddevice click tenacity futures pathlib2 google-assistant-grpc google-auth-oauthlib appdirs
git clone <a href="https://github.com/Bluebotlabz/Universal-IoT-Control-Panel.git" rel="nofollow"> https://github.com/Bluebotlabz/Universal-...</a>
cd Universal-IoT-Control-Panel
python3 ./install.py

Follow the instructions in the terminal and when you are complete the Pi should reboot.

Please Note:
To copy stuff from PuTTY, just select it and it will automatically copy.
To paste stuff into PuTTY, just right-click.
When you get asked by Google, click on Continue. Clicking on "Back to Safety" will stop the code from being generated.

If you get an error, check the previous steps.

Now wait until the Pi reboots and you should have a working IoT Control Panel.

Don't forget the unplug the USB Stick from earlier!

Assemble the Case: Assembling the Case

Now, get the back part of the case and slide it onto the front part. You may need to press down firmly, but make sure to not break any of the internals

Finished

Your Universal IoT Control Panel is now complete!

Fequently Asked Questions

Why is there no video?

Video coming soon, the microphone broke whilst demonstration, new one arriving soon

How can I fix 403 Error with Google OAuth?

Make sure you have added yourself as a test user in the project settings

The 3D Design does not fit

The front and back may be slightly difficult to put together, I am aware of the issue and am working on it