Sunday, 15 December 2019

How to set up a PiHole with PiVPN and DNS-Over-HTTPS

I was recently trying to configure my PiVPN to work how I wanted after many months of PiHole running flawlessly on my home WiFi. I ended up breaking something, so I decided to start from scratch.
This tutorial contains instructions on how I have recently setup my PiHole with this functionality on a Raspberry Pi Zero W with an Ethernet connection to my router.

I have tried to make this as easy to follow as possible. If anyone has suggestions on how to make it better, please leave a comment.

Go to this link if you want to read about what PiHole is.
PiHole Logo

Equipment Required:

  • Raspberry Pi (Pi 2 or above recommended, or a Pi Zero)
  • Official power supply or alternative that can provide the required amount of power to the Pi
  • Micro SD card (minimum 8GB, but 16 or 32 GB recommended)
  • Optional: Micro USB to Ethernet adapter for Pi Zero and Zero W (Ethernet is STRONGLY recommended)

Setting up Raspbian:

  1. Download a copy of the latest version of Raspbian Lite (or the full version, but you don't need it) from the official site here
  2. Extract the zip file
  3. Install Etcher or any other image writing tool and flash the image to the micro SD card. Etcher can be downloaded from here. NOTE: If etcher freezes while writing the image or goes to a white window, close the program and run it as Administrator. 
  4. To be able to gain access to the command line remotely, SSH access is required. This can be done by accessing the Windows readable partition of the SD Card (/boot) and creating an empty file called "ssh" or "ssh.txt". This is case-sensitive. Now SSH access will be enabled. 
  5. Insert the micro SD card into the Pi, plug in the Ethernet and then power it on. 
  6. Find the IP address of the Pi by either going to your router/switch control panel and looking for "raspberrypi" in connected devices or by downloading and using an IP scanner like Angry IP Scanner (download here). Make sure you enter the correct IP range of your network. Once again look for "raspberrypi". 
  7. Once you have found the IP address, go to Command Prompt or Terminal and enter:
    ssh [email protected][IP ADDRESS]
    The default password is "raspberry". 
  8. Once your are logged in, it is strongly advised you change the default password. This can be done by entering:
    This will ask for the current password, then the password you want to set. 
  9. One more recommended thing is to upgrade all your packages. This can be done by entering:
    sudo apt update
    sudo apt upgrade
    This may take a few minutes, depending if you installed the lite version or the full. Once complete, type:
    sudo reboot
  10. Once it has rebooted, reconnect using SSH and type:
    sudo raspi-config
    This menu allows you to change many settings on the Raspberry Pi, including setting up a WiFi connection if your board supports it, as well as setting up localisation and many other things. 
  11. In this menu, use the arrow keys to navigate to "Localisation Options" and hit Enter.
  12. Change your Locale and Timezone to make sure your time and location are set correctly. 
  13. Once finished, use the arrow keys to select "Back", then hit Enter.
  14. Go to 'Network Options" and hit Enter.
  15. Select "Hostname" and click Enter. This allows you to change the name or your Pi.
  16. Read the warning/instructions and enter the new hostname. Once complete, hit Enter.
  17. If it asks you to reboot, hit "Yes"

Installing and Configuring PiHole:

  1.  Copy this command into the Raspberry Pi terminal:
    sudo curl -sSL | bashPaste this into the SSH session with the Raspberry Pi and hit Enter.
    NOTE: The command is from this link and does not include sudo on the PiHole website, however when I was installing it, it only seemed to work with sudo. 
  2. An ascii PiHole logo should appear and it should start doing some checks. 
  3. The installer should start within 1 - 2 minutes
  4. If your Raspberry Pi has more than one network interface, select the one you are using. If it is Ethernet, click "eth0", while WiFi is "wlan0".
  5. The installer will ask if you want to use IPv4 and/or IPv6 to block ads. unless you know what you are doing, leave it as the default. 
  6. Next, it will ask if you want to use your current IP address and subnet as the static IP for the PiHole. Unless you know what you are doing, click "Yes"
    NOTE: Once you know the IP address for your PiHole, it is recommended you set an IP Address reservation on your DHCP server, which is most likely your router. To find out how to do this, type your router model and "IP Address reservation" into Google. This will make sure the PiHole continues to function correctly. 
  7. The installer will ask you to confirm your settings. If they are correct, press "Yes".
  8. Next, it will ask you to select your Upstream DNS provider. unless you prefer something else, leave it as the default and hit enter. 
  9. When it asks you to confirm, press "Yes".
  10. For all of the rest of the prompts, leave it as the defaults and press "Enter" unless you know what you are doing. 
  11. Once it is complete, it will show you the Web Interface password. Write this down somewhere. 
  12. To change this password enter this command into the terminal:
    pihole -a -p
    Then follow the prompts. 
  13. Once you are back to the terminal, open up a web browser and go to:
    http://pi.hole/admin or http://[Pi IP Address]/admin
  14. Login using the password you set. 
You have now successfully setup the PiHole! To use it to block ads on your devices, you can set it up 2 ways:
  1. Set the DNS servers on your router to only include the IP Address of your Raspberry Pi
  2. Set the DNS servers of each device to the IP Address of your Raspberry Pi.
Currently, it is only setup to work on your WiFi. To make it work externally, you need to install PiVPN. 

Installing and configuring PiVPN to work with PiHole:

Installing PiVPN is quite straight-forward, and it allows you to use an encrypted connection to connect to your PiHole, as well as optionally devices on your home network. It can also be configured to encrypt and send all data through the VPN to make it look like you are at the location of the Raspberry Pi.
NOTE: For your VPN server to function its best, it is recommended you get a static Public IP address from your ISP, or (like me) your Public IP from your ISP needs to be mostly static and not change too often.

  1. Open an SSH connection to your Raspberry Pi and enter this command:
    curl -L | bash
    This command downloads the setup script for PiVPN and runs it. 
  2. If it asks for your password, type it in and hit Enter
  3. After this, a window should pop-up saying that it will install a VPN server on your Pi. it will next warn you that you need a static IP address for it to work properly. NOTE: This was setup in the PiHole section, but if you need to set it up now, refer to step 6 above. 
  4. Next it will ask you to select your network interface. If the Pi is connected over WiFi (NOT recommended), select wlan0 with by clicking Space, or eth0 if you are using ethernet. Once done, hit Enter.
  5. Now it will ask you to select which user will store your OpenVPN configurations. Leave it as the default "Pi" unless you know what you are doing.
  6. It will now ask you if you want to enable unattended upgrades. It is strongly recommended you enable this as it will ensure vulnerabilities are patched. 
  7. It will ask if you want to use UDP or TCP. Like it says, only use TCP if you know what you are doing. 
  8. Now it will ask you to select what port you would like to use for your VPN. It is recommended you change it slightly to make it harder for attackers to find your VPN server. I just add a random number on the end. NOTE: You need to remember this port number for later.
  9. Next it asks what level of encryption you want. Leave this as the default as increasing encryption will make it more secure, but it will slow the connection down. 
  10. Click enter to this window.
  11. Next it will ask if you want clients to connect directly to your Public IP address or through a domain name. leave it as the default unless you know what you are doing. 
  12. Now you need to select your DNS Provider. Select any as this will later be changed to the PiHole. 
  13. PiVPN should now be installed on your Raspberry Pi!
  14. It will ask you to reboot. This is recommended. 
  15. Once it has rebooted, reconnect over SSH.
  16. Next we need to setup a profile for you client device. This can be done by entering:
    pivpn add or pivpn -a
  17. Enter the required credentials.
  18. You can create as many profiles as you want. It is recommended you create one profile per device. 
  19. Now the profile has been created, you need to copy it off of your Raspberry Pi. There are multiple ways to do this, but the way I prefer (and is the easiest) is to use Filezilla. This can be downloaded from here and installed on any PC running Windows, MacOS or Linux. 
  20. Once Filezilla is installed, enter the IP address of your Pi into the Host box, the username of your Pi into the next box, that user's password into the last box, and 22 into the Port box. Then hit Quickconnect.
  21. Navigate to the folder called "ovpns" and double click it
  22. This folder should contain your client ovpn files. To download them, open the folder you want to save it in on the left and then double click the file on the right. It will then download to the folder on the left automatically. 
  23. If this file is for a phone, you can now email it or transfer it to your phone however suits you. 
  24. To use the icon file, download the OpenVPN Connect, OpenVPN for Android or OpenVPN desktop client programs and import the file. 
  25. Now we have a config file on our client device, we need to configure the server itself. To do this we need to enter this command:
    sudo nano /etc/openvpn/server.conf
    This will open the server configuration file.
  26. Remove all the lines which include "dhcp-option" and replace them with one line:
    push "dhcp-option DNS [Pi Local IP Address]
    This now makes your PiHole the DNS server for you PiVPN. 
  27. Click Ctrl+X, followed by Y and Enter to exit the editor and save the changes.
  28. To restart the VPN server and activate the changes, enter this command:
    sudo systemctl restart openvpn
  29. The VPN server will still not work as there are 2 more steps:
    1. Go to your Router and find the Port Forwarding settings. In here, we need to forward the port we used for the VPN server to the Raspberry Pi with UDP. This is most likely in the Advanced settings. This is different for every router so a quick manual read or Google search should show you how to do it on your setup.
    2. We need to change the listening settings on the PiHole. This done by navigating to the PiHole Admin Console, going to Settings, then the DNS tab. There is a section labelled 'Interface Listening Behaviour". In here, we need to select "Listen on all interfaces, permit all origins". PLEASE NOTE: Only do this if your Raspberry Pi is not accessible to the internet and is secured inside your WiFi network. If not, anyone could exploit your Raspberry Pi. 
  30. If you have ticked the box, scroll down to the bottom and click Save. 
If you try to connect to your PiVPN, the client should be able to connect and go to websites. If everything is working, congratulations! If not, check your ISP doesn't use CG-NAT or block the port you are using. 
If it still doesn't work, leave a comment below. 

The current setup is forwarding all traffic through the VPN. If this is what you want, you are done. If you want only DNS queries, or only DNS and local IP addresses to be forwarded, read on.

Setup 1: DNS queries only:
  1. Insert a "#" at the start of the line from the config file from step 23 that reads:
    push "redirect-gateway def1"This line forwards all traffic through the VPN. 
Now only DNS queries will go through the VPN! To apply these changes, enter the command from step 26 above. 

Setup 2: DNS queries and local IP addresses only:
  1. Follow the step from Setup 1.
  2. Add a line into the file that reads:
    push "route 192.168.x.x 255.255.x.x"
    The first number is the IP range of your local network. If devices use the IPs - 255, enter If it uses - 255, use
    For others, follow the pattern.
    The second set of numbers is the subnet mask. It begins with 255.255 but can end differently. Mine is "" but some peoples is "". To find yours, go to your router setup and it will say the subnet mask. Alternatively, find a device connected to the network and you will find the subnet mask in the network configuration settings. 
Now only local IPs and DNS should go through the VPN! Once again, to apply these changes, follow Step 26 from above. 

Optional: Installing and configuring Cloudflare DNS-Over-HTTPS:

This step is only necessary if you want your DNS queries to be encrypted once they have passed through the PiHole. If you don't need this, ignore this section, as your setup will still function as intended. 
Instructions source: link
Download link source: link
The download link above is unofficial, as the official one from the GitHub has a Segmentation Fault on most Raspberry pi's. I have used the download above and had no issues. 
  1. Go to this link, scroll down to the very bottom and find the latest version. Click on that
  2. Find the file that ends in ".tar.gz". Right click it and click "Copy Link Address" (Chrome), or a similar button in your browser. 
  3. Go to your ssh session with the PiHole and paste it onto the end of this command:
    wget [paste URL here]
  4. Once that is complete, copy this command, substituting in the name of the downloaded file:
    tar -xvzf [downloaded-file-name].tar.gz
  5. Copy the following commands, one after the other (no substitution is required):
    sudo cp ./cloudflared /usr/local/bin
    sudo chmod +x /usr/local/bin/cloudflared
  6. Enter this command:
    cloudflared -v
    If everything is working correctly, it should return something like this:
    cloudflared version 2019.11.3 (built 2019-11-21-0625 UTC)
  7. To create the cloudflared user to run the daemon, run this command:
    sudo useradd -s /usr/sbin/nologin -r -M cloudflared
  8. Next, you need to create a config in the file /etc/default/cloudflared. This is the command cloudflared uses on startup. It can be created by entering:
    sudo nano /etc/default/cloudflared
  9. Enter in file:CLOUDFLARED_OPTS=--port 5053 --upstream --upstream
  10. To exit and save changes, press Ctrl+X, followed by Y, followed by Enter. 
  11. Change the file permissions so cloudflared can access it:
    sudo chown cloudflared:cloudflared /etc/default/cloudflared
    sudo chown cloudflared:cloudflared /usr/local/bin/cloudflared
  12. Next you need to create the systemd script to allow you to control cloudflared. This is done by creating the file /etc/systemd/cloudflared.service and entering some text:
    sudo nano /etc/systemd/system/cloudflared.service
    Enter in the file:[Unit]
    Description=cloudflared DNS over HTTPS proxy

    ExecStart=/usr/local/bin/cloudflared proxy-dns $CLOUDFLARED_OPTS

  13. Follow step 10 to exit nano
  14. To enable cloudflared, enter these 3 commands:
    sudo systemctl enable cloudflared
    sudo systemctl start cloudflared
    sudo systemctl status cloudflared
  15. Cloudflared should now be working. It is functioning if the third command above doesn't show any errors. If it does:1. Enter this command:
    sudo systemctl restart cloudflared
    Once this has completed, enter the status command from the last step. If errors still appear, try a few more times. 
    2. Make sure your time is set correctly in raspi-config under "Localisation Options".
    3. According to this issue report, this behaviour can be caused by the internet dropping out. If you have unstable/unreliable internet, that might be your problem.
    If it still doesn't work, leave a comment below. 
  16. To set the PiHole DNS to cloudflared, go to the PiHole Admin Console, click on 'Settings" on the left, go the the "DNS" tab and enter this into the custom DNS 1 box:
    Then untick all the other boxes and tick the custom one. 
  17. Scroll down to the very bottom and hit Save.
Cloudflared should now be working with PiHole clients! You can test it by going to this site. It should show a green tick unless you are running DNSSEC as well, which it will show a yellow question mark. 

Hopefully this tutorial has helped you setup your PiHole, PiVPN and optionally DNS-Over-HTTPS.

Please leave a comment if you have any feedback or questions.
Once I create more tutorials, you check them out here

Saturday, 23 November 2019

DIY Drone Update #1 - Starting from the Very Beginning

I have always been interested in aviation and Remote Control technology, and when I recently visited the World Science Week festival in Brisbane and saw the racing drones military personnel use, I was instantly intrigued.
Over the last couple of months, I have been attempting to build an FPV (First person view) racing drone for myself. I have not completed it yet, after almost 3 months, due to slow shipping and broken parts. I should have posted this a while ago, but here is what I have done so far:

After a few weeks of researching, I came up with my final parts list:
Frame: Link
Flight Controller: Link
Motors: Link
Electronic Speed Controllers (ESCs): Link
Video Transmitter (VTX): Link
Camera: Link
Video Receiver/ Headset: Link
Transmitter and receiver: Link
Battery: Link

This is most of the stuff I needed to get started. I also needed a battery charger (Link) and a power supply for the charger, which I made out of an old desktop power supply (PSU). To plug the battery into the charger, I needed a special cable (Link). I also needed a cable to plug the battery into the flight controller (Link)
The DIY Power Supply and Charger (not as dangerous as you think)

I first received the flight controller, frame, VTX and camera, which I assembled by soldering the wires to the flight controller and VTX. I then plugged it into my laptop, turned on my headset and checked to see if it was transmitting video. Once I found the right channel, I got an image. Then, I opened Betaflight Configurator (Link) and added some more information to the On Screen Display (OSD), which allowed me to see altitude, speed, direction and battery voltage.
Betaflight Configurator
As of writing, I have received all the parts except for the replacement for my broken motor.

New posts will be written as parts arrive and are assembled.

Please leave a comment if you have any feedback or questions.
My other personal updates can be found here, and DIY Drone updates can be found here.

Sunday, 4 August 2019

Personal Update #1 - 3D Printer Repairs and Upgrades

I recently finished repairing and upgrading my Anet A8 3D printer, and thought I'd share some in-depth information about the build here.
The assembled printer
The process has taken around 6 months and nearly everything has been upgraded. This includes:
  1. The hotend was upgraded from the Anet stock to the Trianglelab V6,
  2. The extruder type has been changed to a bowden, which means the motor is mounted to the frame and not the hotend carriage, allowing faster and finer movements, as well as less strain on the X axis motor,
  3. The extruder motor has been upgraded to a Trianglelab NEMA17 48mm stepper motor with a 0.9 degree step, which allows for even finer control over extrusion,
  4. The extruder gears have been upgraded to the Trianglelab BMG clone, which has easier filament insertion, higher quality gears and a great gear ratio,
  5. Heatbed glass was dropped and then replaced with a magnetic bed, which allows the print bed to be removed and flexed to easily un-stick prints.
It is a long list, but that is still not everything. Something had to go wrong when I was replacing this many parts. The main issue was the power supply. Anet stock power supplies are notorious for being dangerous, as there is only a thin piece of plastic between pins and the metal housing. It finally decided to die, and go out with a bang, literally.
I turned it on a few months ago to nothing. Thinking the mainboard was dead, I bought a new one, going from version 1.5 to 1.7 of the stock Anet board. Once this arrived, I wired everything up and it still didn't turn on at first, only this time it eventually came to life. The only problem was that the power supply also began to start throwing large sparks. I instantly turned it off, and ordered a replacement, which ended up being a HP DPS-600PB 12V server power supply. Once it arrived, I had a great guide which showed me which pins to connect to force it to power on. Once I soldered the right pins, it worked flawlessly, albeit loudly.

Once I had all the parts, it took me an entire weekend to assemble.

The final issue I encountered was not having long enough screws to account for the higher nozzle because of the new bracket. I ended up getting some 50mm screws which worked perfectly, except for that they were so long they hit the frame and prevented the bed from moving properly. To overcome this, I raised the extruder even higher and used some nuts to allow the springs to be 'long enough', by putting a gap between the bed and the spring. This worked great, and I now have even better adjustablility for levelling the bed. 
The spring and bolt bed height setup.
Once I had the hardware set up, I needed to configure the software. I uploaded marlin to the new mainboard and then read that I should calibrate the esteps, which is how many steps of the stepper motor represents 1mm. Mine ended up being around 800.

Now that everything was configured, I ran a test print using my existing slicer settings, albeit a lot slower. It was a total failure at first. The first print didn't stick and the second one didn't seem to extrude. Third time luck I was, as I successfully printed 3/4 of a calibration cube until the software on my laptop crashed and cancelled the print, but what was printed was in acceptable quality for a first successful print. 
The first print
This is a long post, but I wanted to leave all the details here if anyone else was doing a similar upgrade and so I have a record of what I did.

Please leave a comment if you have any feedback or questions.
My other personal updates can be found here

Saturday, 15 June 2019

Crankshaft Technology Update #5 - Micro:Bit sessions now available!

A local student recently asked me for some assistance with his Micro:Bit code for an assessment. I was able to help him, and I also learned how useful Micro:Bit's can be in education. They're cheap, easy to code and scalable for any ability. This is why I have purchased one, and sessions are now available these holidays and next term!
The Micro:Bit board
The benefits of these boards are that they have physical outputs and inputs, including LED's and buttons. I have found that, even with myself, hardware that you code is more interesting than text or shapes on a screen.

Another benefit of the Micro:Bit is that it has many different ways of programming it. These include MakeCode, a Scratch-style block-based language, MicroPython, a text-based language that is based on Python, a powerful scripting language used throughout the technology industry, and Arduino. This allows the board to be used with many age levels and it can be scaled to suit the ability of the student.
MicroPython editor
MakeCode editor

All of the code editors and tutorials are web-based, and work on any computer that you can connect the Micro:Bit to and has a web browser (all modern computers), so code can be worked on at home!

If this is popular, I would like to buy another, which allows even cooler programs to be made, including having the boards communicate and control one-another.

To reflect these additions to the program, I have updated the website with some more information about the board. The page can be found here.

Please leave a comment if you have any feedback or questions.
The other updates for Crankshaft Technology can be found here

Monday, 15 April 2019

Crankshaft Technology Update #4 - Another new website is live!

Over the past day, I have been working on finishing the home-made Up until now, was built using Google Sites, but I wanted to build on the success of the other I have programmed this new site in HTML and CSS using a similar style to the other site.
The new
This new site includes all the content from the old site, but I have added information about Small Basic, a programming language that I am now using with select students who have advanced past Scratch.

It has taken me a while to finish this as I was experiencing problems with the scaling that allows the site to look good on all screen sizes. The old menu was a list of links down the side, that didn't scale. I have now included a drop down menu for easy cross-platform navigation.
The old layout
This change now means I have transitioned away from Google Sites and have now created all my own websites except for this blog, which is hosted using Blogger.

The new website can be accessed here.

Please leave a comment if you have any feedback or questions.
The other updates for Crankshaft Technology can be found here

Monday, 25 March 2019

Crankshaft Technology Update #3 - Celebrating 1 year!

As I was looking through my Scratch files today, I noticed one from April last year. I then realised, "It's nearly been a year since I started!" I then looked into it further, and realised that the first class was on the 22nd of February! So it's a bit late, but it has been over a year since I started teaching programming to local students. It has been a huge success, lots of fun, and I couldn't have done it without the lovely local parents who allowed me to teach their children an important skill.

Please leave a comment if you have any feedback or questions.
The other updates for Crankshaft Technology can be found here

Sunday, 10 March 2019

Crankshaft Technology Update #2 - The new website is live!

Over the past few weeks, as I started learning HTML again, I decided to use one of the tutorials from school to make a new custom website for
I started from scratch and coded the entire website, from the content to the layout. This has taken many hours to complete, and will take many more to perfect.
The main features of the website include:
  • A live Facebook feed of posts
  • Links to the blog and the coding site
  • An email us button
  • Adaptive layout and size relative to screen size
Using what I have learned from this site, I am now working on a similar solution for, but it is still in active development.
The framework is complete, but with all the extra elements, it is much harder to make it adaptive and look good on both mobile and desktop browsers.
If you would like to check out the beta version of the site, it can be accessed at

Please leave a comment if you have any feedback or questions.
The other updates for Crankshaft Technology can be found here

Monday, 4 February 2019

Raspberry Pi Alarm Clock Update #4 - Internet Radio and Open-Source!

School has been kind on homework, so I have had time to make some HUGE advancements in the project.

Firstly, I have setup the PiClock switcher script with a day and night theme.
Night Theme (Above) and Day Theme (Below). They are green and blue respectively
Also, it has now replaced my Google Home Mini as my alarm clock. It has been setup for a few days and has worked well except for the alarms being strangely quiet, but still audible. I attempted a fix but it kept crashing. Despite this, I did notice that it keeps alarms between reboots, which is handy.  

Just this weekend I setup the coolest and most time-consuming feature, internet radio. I have currently setup one radio station which plays when you say 'start action 1', which when used with routines, can be changed to something like 'custom radio', which is what I use. 
It is currently setup to play until it hears the hotword again. It requires a custom action in the Actions Console and code on the Pi (instructions: ) for when it receives the command, which then executes the VLC library (python-vlc) which plays the stream. It could also be utilised to play local music files, but I have not tested and implemented this. I hope to set it up in the future to play until I send it the stop command, even after queries, but I ran out of time and concentration and it kept crashing. It will only take another weekend. 😉

Finally, I have setup a GitHub repository which I will upload my code and more detailed instructions to for this project. It can be accessed here:

If you have any feedback, questions or answers to my problems, please leave a comment.

Check out all the posts for this project here.

Sunday, 3 February 2019

Crankshaft Technology Update #1 - Classes have begun!

Today was the first lesson for the term, and was a huge success. The class ran smoothly and was very productive, with a maze being created and working by the end.

If you are interested in signing up and are located in or near Moggill, Queensland, Australia, check out the website at and fill out the form on the Contact Us page.

Tuesday, 29 January 2019

Raspberry Pi Alarm Clock Update #3 - Troubleshooting and Returning to School

I am writing this update as I am returning to school and won't be as focused on this project Future updates will be posted, but here is a summary of everything that has occurred since the last update.

All of the parts have arrived except for the screen which has allowed me to setup and test the "final" hardware, including the microphone, speakers with amp, and all of the code.
The amplifier makes the speaker REALLY loud, and the microphone is adequate, but I hope to upgrade to a MEMS microphone.
The (almost) complete hardware, including Amp (top), Microphone (right), USB DAC (Left), Raspberry Pi (Far Left) and Stereo Speakers (Bottom)
The first problem I encountered was the microphone being used by another unknown process that took me a few hours to find and stop, which has not started again even after reboots. Once this was fixed, I was able to successfully start the Assistant script.
After that, the speakers gave out a persistent buzzing sound that was very annoying. I first looked into how to stop it, but couldn't figure it out. The next method I discovered to combat this was to use a standby pin built into the Amp which when grounded mutes it, and when not it plays audio. Using this idea, I found a file in the OS (thanks to stack exchange) that states whether or not audio is being sent to the speakers, which I then used in a script which constantly reads this file and mutes the amp unless there is audio being sent. Success! The buzzing still occurs in the background when audio is playing, but this will do until I figure out to fix it.
The standby pin used to prevent buzzing (Labelled SD)
A final note is that I clogged my 3D printer while printing a part for someone else which prevented the extruder motor from rotating which in the end killed it. This means I can not print the top of the casing until I can replace the whole extruder. This will delay the final product.

The list of future software additions to this project include playing a sound when the Assistant is listening and thinking, and eventually getting the Assistant's response as a visual text output on the clock face. Also, I hope to be able to adjust the screen brightness according to time of day and if the assistant is interacting with the user or not. This is all for another update.

If you have any feedback, questions or answers to my problems, please leave a comment.

Check out all the posts for this project here.

Friday, 18 January 2019

Raspberry Pi Alarm Clock Update #2 - Modelling the Casing

This is a quick update about the progress I made today on the casing.

I have finished modelling the casing to the best accuracy I can get without having all of the components to measure. It took many hours to model the top portion that will house the speakers, microphone and screen as well as cover the Raspberry Pi. It wasn't made easier by the many weird changes and "glitches" (aka occurrences I didn't understand or want) that occurred when I changed some dimensions, including sections of the models disappearing.
The current state of the entire casing, represented as a wire frame. (Above)
The top (above) and base (below) of the casing
This is all I was able to do today, as the rest of the components haven't arrived as of posting. I will release more updates as more parts arrive and changes are made to the model.

Check out all the posts for this project here.

Thursday, 17 January 2019

Raspberry Pi Alarm Clock Update #1 - Starting Software

This post is the first in a series over the next few weeks (maybe months) where I will document my current project of building a Raspberry Pi powered Alarm Clock with PiClock and the Google Assistant.

Because I have had the Raspberry Pi for a while, I started by connecting it to my computer and setting up the software. I started by setting up PiClock, which was a breeze as it had clear instructions on installation and setup. The Google Assistant was the hard part.
PiClock running on my Computer (Screen 1 & 2)
Both PiClock and the Google Assistant run in Python, so it will be easy to (later on) add the transcript from the Assistant to the alarm clock screen, as well as raise screen brightness when listening/ responding, etc.

Over the past few weeks I have been ordering and experimenting with the different components I will need to finish this project. In the beginning, I thought all I would need is a Raspberry Pi, a screen, a set of DIY speakers, and a DIY microphone. The first 2 parts have been as simple as they sound, but the speaker and the microphone have taken lots of time, as I have learned more than I could have imagined about them. Mainly, that speakers and microphones need amplifiers.
DIY Microphone (Left) and DIY Speakers (Right)
They both worked, it's just that the microphone was so quiet i would not hear it at even the highest volume, and I could hear the speakers at full volume, but they were still not the advertised 79db.

While I'm waiting for the screen, speaker amplifier board and microphone to arrive, I have begun modelling the case I am going to print in my wood filament to make it look like an alarm clock. This will save me time when the parts arrive as I'll only have to change dimensions, not create the entire object model.
Unfinished base of casing
I will post updates whenever I work on aspects of this project, but it will take time to complete. The thig with DIY electronics though, is that when it works in the end, you have gained 3 things. Knowledge, experience and a useful device. 😉

Check out all the posts for this project here.