In this tutorial, we’ll work through setting up a Raspberry Pi 4 to boot from a USB connected SSD or other USB storage media. There is quite a bit of information on this online already, but I’ve had a lot of questions recently about how to do this, so I thought I’d share my method.
I’m going to be doing this on my latest plywood Pi case build with an M.2 NVME drive, but the process is the same for any USB attached solid-state, flash or disk drive. It also doesn’t matter what type of SSD you’ve got, as long as you’ve got an adaptor to convert the SSD interface to a USB interface, then you should be able to get your Raspberry Pi 4 to boot off of it.
To make it easier for beginners to follow, I’m going to assume that we’re starting from scratch. If you’ve already got your Pi running on a microSD card then skip past this first section.
I’m using a 32GB SanDisk Extreme microSD card, but you can use a smaller 16GB card if that’s what you have available.
We’re going to start out by using Raspberry Pi Imager to flash the Raspberry Pi OS image to our SD card. This is done by selecting the operating system, which in our case is going to be the 32bit version of Raspberry Pi OS. We’ll then choose our target, which is our SD card, and then click on write. This will then download the operating image and flash it to your SD card. So, depending on your internet speed, this may take around 5 to 20 minutes to complete.
When it is complete, plug the SD card into your Pi. Don’t close up any covers on your case yet as you’ll want to remove it again once your Pi is booting from the SSD.
Format Your SSD
The next step may or may not be required, depending on what filesystem your SSD has been formatted in. If you’re unsure, try plugging the drive into your Pi when it has booted up and see if the drive icon appears on your desktop.
If it doesn’t appear, you’ll need to reformat the drive to use the FAT32 file system. This is easily done in windows by right-clicking on the drive and selecting format, or on a Mac by using the disk utility and selecting MS-DOS (FAT) and the default scheme.
Once this is done, you can plug in your SSD and boot up your Pi if you haven’t done so already. Remember to plug the SSD into one of your USB 3.0 ports, which are the blue ones in the middle.
Your SSD should then appear on your desktop after a few seconds. If it doesn’t appear then it is likely using an incompatible filesystem and should be reformatted to FAT32. If you have done this and it still isn’t showing up then check your USB adaptor and ensure that the drive is properly inserted into the holder/plug.
Configuring Your Pi To Boot From The SSD
Now that you’ve got your Pi booting off your SD card and your SSD is being seen by your Pi, we can move on to configuring the Pi to rather boot from the SSD.
First, open up a new terminal window and, as usual, it is best to start out by making sure that your Pi’s software is up to date. Do this by entering the following commands:
sudo apt update
sudo apt full-upgrade
Once this is done, run the following command to update your Pi’s firmware.
sudo rpi-update
Enter y when prompted.
Once the firmware update has been completed, you’ll need to reboot your Pi.
sudo reboot now
When you’re back on your desktop, go to your menu, then accessories and then SD Card Copier. This will open a simple window with a from and a to dropdown list. Select your SD card as the “from” target and your SSD as your “to” target. Then click on Start and Yes to continue.
This will partition your SSD and copy the contents of your SD card to each partition.
Now we just have to tell the Pi to boot from the SSD instead of the SD card.
Open up a new terminal window and enter the following command to make sure that you’ve got the latest boot loader.
sudo rpi-eeprom-update -d -a
Mine looks like it is already up to date.
Next, open up the configuration tool by entering the following command:
sudo raspi-config
Then go to 6 Advanced Options and then A7 Bootloader Version. Select the first option E1 Latest Use the latest version boot ROM software to use the latest software, then select Ok and then No so that it doesn’t revert to defaults.
Next, go back to 6 Advanced Options and select A6 Boot Order. Select the second option B2 USB Boot Boot from USB if available, otherwise boot from SD card.
You can then Finish and then select No when asked if you would like to reboot. Then rather shutdown your Pi.
Once your Pi has shut down. Remove the power cable and then the SD card.
Our Pi should now boot up from the SSD, so let’s power it up and see.
You’ll notice right at the top when booting that it says that the boot mode is now USB-MSD and that no SD card is detected.
When your desktop loads, you’ll also notice that you no longer have the SSD mounted as an external drive, so you won’t have an icon for it on the desktop anymore.
Running A Quick Speed Test On Our SSD
We can do a quick and basic write test by opening up our terminal and entering the following command to write a 100mb file:
This takes a little under half a second, with a read speed of 215 megabytes per second.
This is a very basic indication of the speed increase you get from an SSD. There is a lot more to the speed of a drive than simply writing or reading a single large file. Here are two good drive speed comparisons, one by Jeff Geerling and one by leepspvideo
Let me know in the comments section below if you’ve got your Pi booting from an SSD and if there is anything you do differently when setting it up.
If you’re interested in putting together your own plywood Pi case like mine, you can buy a kit from my Etsy store.
In this project, we’re going to be building a wireless robot car that uses mecanum wheels to enable omnidirectional movement. If you haven’t heard of mecanum wheels before, they’re tireless wheels with a series of rubberized rollers around the circumference.
These rollers are typically at an angle of 45 degrees to the wheel’s axle line and opposing wheels are of the opposite hand. This enables the usual forward, backward and turning movements of standard wheels, but also allow unique translational movements horizontally and diagonally depending on which direction the wheels are turned.
We’re going to be using the Quantum Integration system to take inputs from a joystick controller and drive the motors. We’ll be using two Builder bases, one as a transmitter on the controller and one as a receiver on the robot car, so the starter bundle is perfect for this project.
We’re also going to use three of their DIY PCB kits – the power supply, the four motor driver and the joystick controller.
Here is my project video, read on for the full written instructions:
I’m going to use the same car that I’ve used for my previous obstacle avoiding robot and object tracking robot projects, but this time I’ll replace the Arduino with a Quantum Integration Builder Base.
If you’d like to 3D print the same chassis that I’ve used, use the below link to download the files. I printed them in black PLA with a 15% infill.
Let’s start out by assembling the power supply module. This module just takes a DC input of 7-12V provided through a 2.1mm barrel jack and converts it to 3.3V or 5V to be used by the Builder Base and Motor Driver.
I’m going to be using a 3 cell LiPo battery to supply power to the car, but you can use three 18650 lithium-ion cells or 4 AA cells to power yours. It’s worth mentioning that 9V block batteries typically can’t produce enough current to drive four motors, so you’ll need something more substantial.
Next we’re going to assemble the Four Motor Driver kit. This kit features two L293D motor drivers along with a PWM expander and the supporting components required to independently drive up to four small DC motors, so it’s perfect for four-wheel drive robots.
Once the motor driver is complete, we’re going to connect the motors to the driver and the driver to the builder base. This is done as per the project notes on the Quantum Integrate wiki, so it’s easy to follow.
If you’ve 3D printed your own robot chassis parts from my previous project, you’ll need to assemble your chassis and install the motors before you add the driver.
Connect the two wires from each motor to each of the motor terminal blocks as follows:
Front Left – M1
Front Right – M2
Back Left – M3
Back Right – M4
Then connect the motor driver to your builder base using the following pins:
XLAT – GP1
GSCLK – GP0
BLANK – GP2
SIN – GP3
SCLK – GP4
GND – GND
5V – 5V
I’m going to put the original wheels back on for the first part of the project and we’ll then look at expanding the functionality for the mecanum wheel movements.
Assembling The Joystick Controller
We’ve got our robot car built, now let’s assemble the joystick controller to control it with.
The joystick controller is the last PCB kit to assemble, and it features two two-axis joysticks with pushbuttons as well as a third pushbutton in the centre. It’s also got an onboard voltage regulator, so it can be powered directly using a 9V battery.
To add our builder base, we need to remove it from the plastic housing and screw it onto the brass standoffs provided on the joystick PCB.
One thing to be aware of is that the battery holder is right up against the terminals on the builder base, and so is the joystick cover on the other side. So you need to use some flexible or 90-degree terminals to fit in alongside them.
Quantum provide a 3D printable housing for the joystick as well. I’ve printed that out in white PLA to put the PCB, builder base and battery into. The screws for this housing are also included with the joystick PCB kit.
The back cover is then held in place with two more screws. The controller can be switched on and off using the slide switch at the bottom and the green LED is illuminated when the controller is on.
Programming The Robot Car
Our robot car and joystick are now complete, so we can move on to programming them.
I’m going to start by testing that the system is receiving all of the inputs from the Joystick controller correctly. To do this I created a basic app that takes the three hardware objects, the two joysticks and the centre pushbutton, and displays their outputs on our app dashboard.
I also created the controller’s firmware and mapped the hardware objects to the pins that they are connected to on our controller’s builder base.
Quantum Integration have a similar project where they map the outputs to some analogue sliders if you’d like to try this as well.
With the app running, it looks like all of the axis are working correctly. We’re also able to see when each of the three buttons are pushed.
So now we can add our robot car to the app so that the joystick controller’s outputs drive the car.
I’m going to use Quantum Integrations base app for their robot car as a starting point, you can download the app and the firmware from their project page and this can then be imported into your server.
You should then see the following app.
This app takes the Y-axis of each of the two joysticks and maps the output to drive the left and right sets of wheels in pairs. So the left joystick drives the left two wheels and the right joystick drives the right two wheels.
There are also three dashboard buttons, drive left, drive right and drive forward which enable the car to be controlled from the dashboard.
We’ll also need to upload the firmware to our robot car’s builder base, again this can be downloaded from the Quantum Integration project page.
We don’t need to worry about the joystick as we did this for the test we ran previously. We can then run the app and try out our robot car.
Lastly, we’ll need to assign the hardware objects that our app is going to use.
Controlling The Robot Car
Now that our app is running, we can switch on the controller and the car’s power supply and try it out.
Pushing forward or backward on the left joystick drives the left wheels forward or backward and similarly for the right joystick and the right wheels.
To drive forward in a straight line, push both joysticks forward. To turn slightly push one forward at a time, and to turn on the spot push one forward and one backward.
We can also use the buttons on the dashboard, which we can access through our phone, to control the car rather than the joystick. These buttons don’t give you as much control as the joysticks do as they’re just on and off signals, not analogue signals, but you get the idea.
Adding The Mecanum Wheels & Omnidirectional Movements
Now that we’ve got the basic robot car working, we’re going to look at adding the mecanum wheels. I’m going to replace the wheels on the robot car each with a mecanum wheel.
There are two different wheels, they are a mirror image of each other. They’re usually labelled with an LH or an RH on the inside of one of the hubs. You need to make sure that the wheels on the front and back are opposite hands so that they create a sideways reaction force when the rotate in opposite directions.
This is how I’ve installed them into my car.
You might need to use an adaptor to connect your wheels to your motor shafts. I used a 3D printable one by Pro Know.
Next we need to add some logic to the app to drive the wheels on one side in opposite directions when we want the car to move sideways. We could use the x-axis on one of our joysticks but I thought that it would be easier to use the joystick pushbuttons. So you push the left joystick to move left and the right joystick to move right.
I wrote a custom function block to produce a forward and backward signal when a button input is triggered. I connected the input to the left joystick button output and the forward and reverse outputs to our four motors. I then duplicated the function block for the right side as well.
Let’s save and run the app and see if it works. We don’t need to worry about the firmware as we’re using the same hardware that we used previously. Just make sure that the functions are mapped correctly and then run the app.
Our car is now able to move forward and backward, turn in either direction and move sideways without turning.
Let me know what you think of the mecanum wheels and this mecanum car in the comments section. Are you going to try to build your own mecanum car?
I recently reviewed the Ortur Laser Master 2 Pro, but rather than just engrave and cut a range of test pieces, I thought I could use the laser to make something useful. I decided to make up a Plywood Raspberry Pi Case, which is loosely based on my 3D printable Raspberry Pi Desktop Case.
Here is my video of the unboxing and setup of the laser along with the build of the case. Read on for the full written instructions.
What You Need To Make Your Own Plywood Raspberry Pi Case
I started out by drawing up an interlocking case, similar to my other desktop cases in Inkscape. This one is designed to hold my Raspberry Pi with an Argon case port adaptor to direct the ports to the rear of the case and hold two 40mm fans on the front.
If you’ve got your own laser cutter, you can download the files to cut your own case, or you can buy a pre-cut kit that includes the plywood sides and screws as well as the acrylic cover panel.
I loaded the files into LaserGRBL and tried cutting them with the recommended settings for 3mm plywood.
Cutting on the Laser Master 2 Pro took a bit of experimenting to get right. I had to play around with speeds and the number of passes until I found something that worked well with my 3mm plywood. In the end, I found that two passes at 250mm/minute seemed to work the best.
Once the parts were cut, we need to glue them together with some PVA wood glue. You could also use epoxy adhesive, but wood glue works best and leaves the best finish.
I’ve tried to make the design as easy as possible to assemble, so the top and bottom are interchangeable and these two, along with the front panel can also be installed with either side facing inside or outside.
To start, lay the large side with the 5 holes in it down on a flat surface. Glue the four side panels into place as shown below, remembering to glue the edges to the large section and to the adjacent sections as well.
Once the four sides are in place, glue the second large section into place on top of the four sides.
If you’ve got some large clamps handy then clamp the sides to keep them in place while the glue dries. Don’t clamp them too tightly or the wood will bend/distort and may dry this way.
Once the glue has dried, glue in the two small pieces to close up the gaps along the top and bottom front edges.
Allow the last bit of glue to dry and we can then start installing the components. I’m using a 2GB Raspberry Pi 4B with a low-profile Ice Tower for cooling.
If you’d like to protect the plywood and not leave it bare, now is a good time to give it a coat of clear lacquer or varnish. You could also paint or stain it in a colour of your choice if you’d prefer that to the bare wood look.
I’ve also added a 1TB M.2 NVME drive with a USB adaptor, two 40mm fans for the front to pull air into the case, and an adaptor from an Argon case to move the ports to the back of the case. If you don’t have an Argon case adaptor, try looking on eBay for someone selling a spare or use a 90-degree micro HDMI cable for your display.
Start off by pushing five standoffs through the case and hold them in place with a nut on the back of each. The standoffs and the nuts are all included in the Ice Tower kit.
We then need to add our USB power cable while the port cutouts are still open. I trimmed one side of a USB C cable down to fit into the Pi alongside the Argon adaptor as the adaptor comes very close to the USB C port. Push it through the HDMI port cutout before installing the Pi.
We can push the Argon adaptor onto the ports on the Pi and then position the Pi on the standoffs. The Pi is then held in place with a second brass standoff on each. Tighten these gently using needle-nose pliers.
If you haven’t remembered to install your SD card (if you haven’t already set up your Pi to boot from your SSD), the SD card can be inserted through the fan hole. We won’t need to remove or replace the SD card afterward as we’re going to be booting off the SSD once it is set up.
I then installed the Ice Tower and held it in place with the 4 included screws. A fifth screw holds the Argon adaptor in place using the 5th standoff. This is not critical, but provides a bit of extra support when plugging in and removing the HDMI cables.
We can then plug in the USB power cable.
Once that is done, we can install the fans. I pushed M3 nuts into each of the pockets in the fans to screw into. This is easiest done by placing a nut on a hard surface and then pushing the fan pocket down onto the nut. The nuts go on the wood side of the fan, so the screws do not extend all the way through the fan and each fan is supported by the press-fit of the four nuts.
When you install the fans, pay attention to which side the cable is on. Make sure that you have got enough length to reach your Pi’s GPIO pins. The fans are then secured with eight M3x8mm screws.
We can then plug the fans into the power pins on the Pi. I used 5V pins for the front two fans and a 3.3V pin for the Ice Tower fan.
Source: RaspberryPi.org
Next, we’ll install the NVME drive into the USB adaptor and then into our case. Your USB adaptor may vary, this is one that I found on eBay, but they are generally similarly sized though.
I used a strip of thick double-sided tape to hold it in place on the underside.
Now we can install the clear side panel. It’s worth mentioning that I had to cut this on my CO2 laser cutter as diode lasers can’t cut clear acrylic. Acrylic can also just be cut by hand using a fine tooth saw or jigsaw.
The cover is held in place with some M3x8mm screws.
With that done, the case finished. So let’s power it on and try it out.
With three fans, the case is quite noisy, but it looks pretty cool as a mini desktop computer. I also noticed that one of the LEDs on my bottom front fan is faulty, which is a bit disappointing. But I don’t have another one spare at the moment.
I really like the RGB legs in the fans and the clear side panel to see the internals. Let me know what you think of it in the comments section below.
Today we’re going to be taking a look at the Ortur Laser Master 2 Pro which the guys at Ortur have sent through to me to try out and review.
Ortur are a popular CNC laser engraver manufacturer and have been around for a number of years. They are one of the most reputable brands in the space and have shifted their focus towards making better quality and safer laser cutting and engraving systems that are centred around diode lasers, with their core products being these gantry-style engravers.
The Laser Master 2 Pro is their latest upgrade to their popular Laser Master 2 and is available for purchase from the web store, Made The Best, for around $460 at the time of this review.
They also sell a number of accessories and upgrades for the Laser Master 2 Pro, including an offline controller, full metal enclosure, Z-axis height adjuster, and even a Y-axis roller for engraving on cylindrical objects.
Here is my video review, read on for the full written review.
Laser Master 2 Pro Specifications
Laser Module
LU2-4 24V/2A (Electric Power 20W, Optical Power 5W)
Wood, Paper, Black Acrylic, Leather, Food, Stainless Steel, Powder Coated Metal
Cutting Materials
Wood, Paper, Black Acrylic, Leather, Felt, Dark Plastic
Unboxing The Laser Master 2 Pro
Shipping from Ortur is really fast. The kit arrived after about 6 days in a relatively large box as it is partially assembled – which is not often the case with cheaper gantry style engravers. Inside the box, the components are really well packed and protected using formed foam inserts. The components are also individually wrapped in plastic for additional protection.
It comes with everything you need to assemble it, including zip ties for cable management, a small tool kit and even some sample pieces of wood and acrylic to experiment with. The x-axis gantry is pre-assembled and the drag chain is also pre-wired with connectors on each end.
Also included in the box is an assembly manual, power adaptor, USB cable, focus gauge, and some safety glasses.
Some nice features that you’ll notice right away are the measurement scales on the aluminium extrusion and the all-metal gantry construction. In fact, aside from the components that really need to be other materials (like belts, clear covers, wheels etc.), almost everything on this laser engraver is metal. You’ll also notice that the metals have been painted or anodized after being drilled, which is also great for a good quality look and feel.
Safety Features
Before we get into the assembly of the Laser Master 2 Pro, let’s have a look at its safety features. The control board is where the Laser Master 2 Pro really stands out from the competition. It’s got a number of safety features built-in, which most others don’t have.
It’s got built-in flame sensing, which stops the laser if it detects that the material has caught on fire and sounds an alarm.
It’s got a tilt sensor to detect if the laser has been bumped or knocked off the desk. It’ll also stop the laser if it has been burning in the same spot without movement for over a minute and it’s got a prominent e-stop on the top.
There is also a protective shroud around the laser beam to prevent the beam from reflecting onto the other surfaces and to protect objects (and fingers) from getting in its path.
Assembling The Laser Master 2 Pro
When it comes time to assemble your kit, it’s definitely worth heading over to their technical documentation link to download the pdf version of their manual. It’s much better quality than the included one and is more up to date with better pictures. I put mine together with the included manual and the images are a bit small to really see what is going on. There are a couple of changes that have been made to the construction that haven’t been updated in this printed manual – like the wiring to the limit switches being incorrect.
In any case, it is relatively easy to put together.
While assembling your laser engraver, you’ll again notice a few extras like these additional L-brackets in the corners – which really go to show that they’re determined to give you a good quality product.
One thing I don’t really like is the belt tensioning on the y axis. You pull the belts through slots in the legs and secure them with a screw and washer. It works fine, but you really need to pull on them to get them tight. They also don’t look good when finished off and you can’t make adjustments to the belt tension very easily. They would have been fine for an anchor point at the back, but it would be nice to have some sort of screw tensioning mechanism on the front ends.
The diode module is mounted onto a dovetail slider and is secured with a thumbscrew on either side. If you land up engraving different thickness materials quite often then you’ll want to get the adjustable z-axis as it can be quite cumbersome to hold the module at a precise height while tightening the two thumbscrews.
The drag chain is great for cable management to the motors and laser module. Most of these style laser engravers just leave the cables hanging free on one side, which obviously opens up to the risk of getting them caught in the gantry or running the laser over them and melting the insulation.
There isn’t really much to say about the actual assembly process. It is about as simple as it can be made (without arrival completely assembled) and the online manual is really helpful with the more complex parts.
As I mentioned earlier, the only issue I had was with the wiring to the switches – but I have worked with these on numerous 3d printers, I knew they were incorrect and fixed them up before turning it on.
Testing Engraving and Cutting
With the laser engraver assembled, I downloaded LaserGRBL and tried a couple of test engraves and cuts. Having never used LaserGRBL before, I had to do a bit of playing around first in order to familiarize myself with it. LaserGRBL is quite a simple package, which I like, but if you’d like more functionality then you’ll probably want to rather use Lightburn – which you need to pay for. I tend to use Inkscape for all of my 2d design work, so only having the laser functionality without the drawing tools is fine for me.
To start off, I drew up a cutting area grid with some dimensional markings along the two axis and The DIY Life logo in the centre.
This came out really well with the sample speeds and powers that Ortur suggests in the software.
I didn’t have any issues with engraving during my first few tests, although I did accidentally stop the laser while engraving the grid when I was familiarising myself with the software. When I restarted it, the laser homed to a slightly different position so you’ll notice some of the squares engraved in the second half are off by a few millimetres along the x-axis. But for the most part I was really impressed with the results.
I then also tried engraving on some metal. You can’t actually etch the surface of metals, but I’ve used this product called CerMark to engrave on metals. You spray it onto the surface to be engraved, then engrave over it, and then wash it off with water. It leaves a durable black marking that works on a range of metals and glass.
This worked quite well on a stainless steel ruler and even on a dog tag. It’s worth mentioning that CerMark is quite sensitive to using the correct laser power and speed. If you don’t use enough then the marking washes off afterward or wears out quickly and if you use too much then you lose resolution. The ruler engraving was probably a little overdone.
The dog tag below is gold plated, so it can’t just be engraved like painted ones.
I then tried cutting some 3mm plywood and that worked quite well too. I’ve seen a lot of complaints about diode lasers not being powerful enough to cut wood, but this laser had no trouble cutting through 3mm plywood in just two passes. As with the engraving, it took a bit of experimenting to get right, but once the settings were dialed in it cut effortlessly.
You can’t really see in the photos or video, but cutting produces a lot of smoke. You’ll definitely need to use an extractor or ventilation fan to remove it or cut in a covered outdoor area. Just be careful outdoors as the flame sensor can be set off by the sun’s UV rays which will then stop the laser and potentially ruin your cut.
I then decided to try to make up a new plywood case for my Raspberry Pi, so if you’re interested in following that project, head over to the build post – Plywood Raspberry Pi Case.
Final Thoughts On The Ortur Laser Master 2 Pro
Being around as long as they have, Ortur have had the time and resources to put a lot of effort into making a good quality and reliable product. They have taken a lot of the safety concerns people have had with diode laser engravers and have tried to address them. I say tried because there are still inherent safety risks with using a laser that is not entirely enclosed. It doesn’t take much to not tighten one of the thumbscrews properly and have the laser module fall off the gantry during a burn and you’ve got a rogue laser traveling around your workshop. If you’re looking to do a lot of work with your laser then I’d definitely recommend buying or building an enclosure for it. At the very least you’ll want to always use your safety glasses when working with the Laser Master 2 Pro.
This brings me to a point about the glasses that I raised in my video. I haven’t done a lot of research on these (so I might be completely wrong), but I suspect that they’re not the correct ones for this particular laser. In order to block certain wavelengths, the colour of the lenses is usually the complementary colour of the laser. This is a blue laser, so the complementary colour is orange. This explains why the shroud around the laser is orange. The glasses included with the kit are green, so are actually best for red light. They’re probably better than nothing, but I’d be looking to replace them with some better-quality ones quite soon.
At $460, the Laser Master 2 Pro is certainly not cheap, but you do get what you pay for. This engraver is a substantial upgrade over the cheaper ones available online, and the power 20W diode laser has no trouble engraving and cutting a wide range of materials. That being said, if you do intend to do more cutting than engraving then you’ll probably want to look at getting a CO2 laser rather than a diode laser – they’re just better suited to the application.
Overall I think the Laser Master 2 Pro is about as good as it gets for a diode laser setup. There are a couple of areas that could still be improved upon, like belt tensioners and the included manual, but these are really looking for faults. I have no doubt that you’d be happy with your purchase of the Laser Master 2 Pro
Today we’re going to be taking a look at the RasPad 3, an all-in-one tablet-style device designed around the Raspberry Pi 4B that Sunfounder have sent me to review and share with you.
The RasPad 3 was brought to life through a successful Kickstarter campaign in October 2020 which saw almost 2000 backers pledge over $300,000, so it definitely gathered a lot of early interest.
Watch my unboxing and review video below, or read on for my write-up.
Where To Get Your Own RasPad 3
The RasPad 3 sells for around $250 on Amazon or $220 from their web store, each often having discounts of $10 to $40. I’ll talk about the price a bit more once we’ve had a look at what is included and what it does.
In addition to the RasPad, you’ll also need to get yourself a Raspberry Pi 4B and an SD card to complete the build. I’m going to be using an 8GB version in this review as this is one that I’ve got available at the moment, but you can use a 2GB or 4GB version as well.
Sunfounder doesn’t really have a specification list or table on their product page for the RasPad, so I’ve summarized some of the key information below:
Dimensions
260 x 170 x 50mm
Weight
890g
Display
10.1″ Touch Display – 1280 x 800 Pixels 16:10 Aspect Ratio
Ethernet, 3 x USB 3.0, HDMI, 3.5mm Headphone Jack 5.5mm Barrel Power Jack, MicroSD Card Slot
Functions
Power, Volume, Brightness, Auto-rotate Display
Built-In Sensors
Accelerometer Gyroscope
Unboxing The RasPad 3
Let’s open it up and take a look at what’s included in the box.
First up is the user manual.
It’s is one of the better ones I’ve seen for these types of kits. It is very well presented, with illustrations for each step, and I’m pretty sure that even a child of around 10 years old wouldn’t have much trouble following the instructions to put it together. The English is also pretty good for the most part, but there are a few gems along the way.
Underneath the sponge protector, we’ve got the RasPad in a plastic sleeve.
And under that, we’ve got a compartment with the power cable, internal cables, and accessories and even a screwdriver to put it together with.
So the RasPad includes everything you need to get it running, even the heatsinks for your Pi. You literally just need to your Raspberry Pi and an SD card.
From the manual (on flashing the image) it looks like there is a version available with a pre-flashed microSD card included but I couldn’t find an option for this on their website or on Amazon, so this is possibly a carryover from a previous version.
So that’s what’s included in the box, now let’s take a look at the device.
RasPad 3 First Impressions
Taking a look at the RasPad device, on the front we’ve got the large 10.1” touch display. It’s surrounded by a prominent black bezel, similar to other 10″ tablets. There are no additional buttons, no camera lens, or mic or speaker holes on the front.
On the left side, we’ve got an Ethernet port, 3 x USB 3.0 ports, a full-size HMDI port, a 3.5mm headphone jack, and a 5.5mm barrel power socket. You’ll notice side-on that the tablet is much thicker on the back than it is on the front and that it sits on the table with the display tilted at an angle.
On the back is just a thin slot to pass a GPIO ribbon cable through so that you can access the Pi’s GPIO pins.
And on the right side, we’ve got a battery indicator, buttons to control the volume and brightness, a power button, and a microSD card slot.
There isn’t really much on the bottom. We’ve just got 5 screw holes which hold the bottom cover in place as well as some ventilation holes and speaker grills. It’s also got rubber feet on each corner to rest on to elevate it slightly for ventilation.
The RasPad is roughly the same size as the 10.2” iPad although it is obviously quite a bit thicker, especially along the back edge.
Overall, the RasPad feels like a reasonably well-built, good-quality product. The glass touch display looks and feels like a higher-end tablet and the plastic case is sturdy and sits perfectly flat on the desk. There is a prominent join line around the edge between the bottom and top halves, but this is to be expected on a device that is intended to be taken apart and re-assembled.
Assembling The RasPad and Raspberry Pi 4
Now that we’ve had a look at the outside, let’s use the included screwdriver and put the Raspad together.
Underneath the back cover, you’ll see the relatively large breakout board on the right side, a pair of speakers on the bottom, a second smaller breakout board on the left side, and a 3-cell 3200mAh battery pack along the top.
The main breakout board on the right is responsible for power management, sound, control of the fan, management of the touch display, and the control buttons.
We start off by plugging the USB and Ethernet cables into the Pi, then add the HDMI and power cables. These fit really well between the Pi and the control board and there are even small tabs for cable management to prevent the cables from covering the center screw hole. We then add the SD card adapter and screw the Pi down.
The SD card adaptor plugs into the Pi’s SD card slot and brings the slot out to the side of the case so that you can change or modify the operating system without having to take the back cover off.
We then stick the three heatsinks onto the Pi.
There is also an accelerometer shim to push onto the GPIO pins to auto rotate the display. I’m not sure why they don’t have proper female header pins on the shim, it’s just supposed to be pushed onto the exposed pins as shown below. I don’t really like this design as it feels like the shim can just fall off if the pad is bumped and you aren’t sure that all of the pins are actually making contact with the pins. The centre pins for example could be exactly in the centre of their holes and would then be making very poor contact with the pins if any at all.
Lastly, we need to add the fan to the back cover. This is mounted directly onto the cover and pushes the air out of the case rather than pulling air in. When the case is closed, the fan is positioned directly above the Pis heatsink.
Once we’ve got everything installed, we can close it up.
Flashing RasPad OS To The SD Card
Next, we need to burn the operating system image to our SD card. They have their own operating system, RasPad OS, which I’m going to try first. This can just be downloaded from the RasPad website and is then flashed with a utility like Balena Etcher.
Once the SD card has been flashed, we can insert it into the microSD card slot and plug in the power adaptor. The power adapter is a bit bulky, but it needs to provide quite a lot of power to the Raspad to power the Pi, the display, and charge the battery when empty.
The first boot takes about a minute to complete and you’ve then got a couple of settings to get through. It would have been nice if this step included setting up a WiFi network as well, but you can just head over to the WiFi menu in the taskbar to set that up afterward.
Subsequent boots take a little under 30 seconds on RasPad OS and they do have an option to just turn off the display with a short press of the power button if you’re going to be away briefly. This obviously doesn’t turn the Pi off though, so you won’t want to do this if you’re not using it for longer than about 10-15 minutes.
Using The RasPad 3
Their operating system looks quite similar to Raspberry Pi OS, but it does have a custom menu, which they call RasPad Launcher. This launcher suits a tablet-style interface a bit better and makes it easier to open applications on the touch display.
They’ve tried to make their operating system reasonably touch-friendly and you are able to get through tasks like using a spreadsheet or word processing app using the onscreen keyboard, but the keys are quite small and it’s just not anywhere near as easy as just using a keyboard and mouse.
This isn’t a fault with the hardware, the touchscreen on the Raspad is pretty good, it’s responsive and fairly accurate. These apps are just inherently designed to be used with a keyboard and mouse and so there are things that can’t be done easily with the touch screen, like a right click, and the small icons are difficult to press accurately.
Their documentation does guide you through installing a script to allow a long press to register as a right-click, but this needs to be installed as an extra on most operating systems.
Take an app like Minecraft for example, if you attempt to do anything on the touchscreen, it just results in downward digging. You’re also unable to close the app as clicking on or around the window just results in further downward digging.
It does work well with some games and I think the tablet would be well suited to education where students do drag and drop programming. It would also work well or for home automation apps with a touch interface or other purpose-built touch screen apps. I’m thinking of registration systems for buildings/businesses, point of sale systems, questionnaires, and surveys – the ones with tick boxes and yes/no answers.
I think you’d have a hard time using the tablet for apps that require regular text input without using an external keyboard. Fortunately, this is quite easy to add and works just like a regular keyboard and mouse on a Raspberry Pi.
The speaker quality is also not bad if you’re using it to play or stream music or videos.
I tried connecting an external display to the Raspad and while this works well, it does disable the touchscreen. I’m not sure why they have done this as it would still be useful to use touch inputs with an external display, but that’s just something to be aware of if you’re planning on using it in this way.
The specs claim 3-5 hours of battery life. I managed to get a little under 4 hours, but this obviously depends on how you use it. If you’re running apps that don’t require much processing and you’ve dimmed the display then you’ll get better battery life.
I then tried the auto-rotate function and that didn’t seem to work. There isn’t anything mentioned in the manual about setup or use conditions, so I assume that this should just work when using their operating system.
I wondered if the shim that I was initially concerned about wasn’t connected properly, so I opened it up and added my own header pins to it. I then closed it all up again and this didn’t work either, so I think my auto-rotation shim is just faulty.
Running Different Operating Systems on the RasPad
Another great feature of the RasPad is that you have the option to run different operating systems or flavours of operating systems on it quite quickly and easily. They have listed a couple of options on their product page, but I would imagine that any operating system that runs on a Raspberry Pi would run on the RasPad as well.
I tried booting up Raspberry Pi OS and that worked perfectly, including with the touchscreen input, without any additional setup.
I also tried running RetroPie and that worked well too. It’s actually quite a nice package for a RetroPie system as you’ve got a portable battery-powered display and speakers all in one unit. Just plug in a controller and you’ve got a portable console that’s ready to go.
Suggestions For Future Versions Of The RasPad
After using the RasPad for a couple of days, I got to thinking of a couple of things that I would like to see on future versions.
One of the first that came to mind was battery level feedback to the operating system. There is a battery level indicator on the side and the device overlays a low battery level warning on the display when it gets low, but if you don’t actually turn the Raspad off then it just eventually dies. I would like to see a low-power shutdown script integrated into the operating system.
Next would be an option to add an internal SSD. There is a lot of free space inside the Raspad, and there is even a free USB 3.0 port. It would have been pretty easy to add a space or adaptor to add a small SSD, a slot built into the control board for an NVME drive would be even better.
Although there is a slot on the top for a GPIO ribbon cable to pass through, you either have to open up the case up every time you want to connect something to the GPIO pins or have a ribbon cable dangling out the back permanently. I would have preferred to see a set of GPIO pins (male or female would work) brought out to the side of the case, like the M5 Stack Modules, which can then be plugged into and removed easily.
My last suggestion is not so much a change to the Raspad but perhaps a future variant, and that would be to create a CM4 version. I get why they have designed the Raspad around the much more common Raspberry Pi 4B board, but given that it’s mounted inside and has a number of cables connected to it, it would be a lot simpler to just plug in a CM4 module. It could just be an easy option for those who want a Raspberry Pi tablet and intend on leaving their Pi inside the tablet permanently.
Final Thoughts On The RasPad 3
Getting back to the price point I mentioned earlier. At around $220 to $250, once you’ve added a Pi to it you’re pretty close to $300. This does seem quite high if you consider that you can get other tablets for around $200, but I think you need to take into account the use cases for the RasPad. There are definitely better options if you’re looking for a cheap tablet, but the RasPad offers makers the same level of flexibility and adaptability that a Raspberry Pi comes with. Being centered around a Raspberry Pi, you have a world of possibilities for operating systems, peripherals, sensors, adaptors, and input devices, which typically don’t exist on other platforms. How many tablets do you know of that have GPIO pins available to directly connect a moisture sensor to or drive a servo with?
With the RasPad, you’re paying for the convenience of the Raspberry Pi platform in a compact, all-in-one form factor, and that’s pretty cool!
Let me know what you think of the RasPad in the comments section below.
In this project, we’re going to be building an automated IoT indoor hydroponic farm using the Quantum Integration system. We’re going to try to automate the grow house so that the flood cycles and grow light timing happen automatically, all we’ll need to do is keep an eye on the nutrient solution level.
Here’s my video of the build, read on for the detailed written instructions:
What Is The Quantum Integration System?
The guys at Quantum Integration sent me their starter kit and some additional builder bases to share with you. You can buy your own bundle through their Quantum Integration web store or through Amazon.
The Quantum Integration system is a wireless electronics platform that enables you to build IoT devices and apps quickly and easily thanks to an easy-to-use set of hardware and a drag and drop programming interface.
The heart of the system is a central server, this is where all your apps are stored and run. You can also access your apps and their control dashboards from any device on your network with a web browser.
You use these Q-client builder bases on your projects and devices to bring them to life. Each builder base has 7 GPIO pins as well as a dedicated I2C interface. They’re also designed to be able to be used in low power applications, so are able to run for months on a single small battery.
You can currently connect up to 5 builder bases to your server at once and these can then be used on the same project or on different projects.
One of the strengths of the Quantum Integration system is its seamless wireless connectivity. You can easily build projects that communicate wirelessly between builder bases or between one or more builder bases and a customised web dashboard through your browser on a laptop, tablet, or phone.
What You Need To Build Your Own Indoor Hydroponic Farm
There are quite a few parts to this hydroponic project and a number of them may vary, depending on what you have available locally. I’ve put together this parts list that matches what I bought as closely as possible.
I started out by assembling the grow house. Mine is just a generic 60x40x60cm tent-style grow house which is quite commonly available online. You might not be able to find the exact same size as mine, but any similar size will do. I chose this smaller one because I intend growing lettuce and other small leafy vegetables that don’t need a lot of headroom.
I bought three containers to use to hold the grow pots. Two smaller ones that could each hold six small hydroponic grow pots and one larger one for two larger grow pots. You can use any individual containers or combination of containers with the same volume as the nutrient solution will be pumped from one to the next. My large one holds 6 litres and my two smaller ones 3 litres each. I connected the smaller ones together with a couple of sections of tubing, so when one fills the other does too.
I measured the rim of my pots and then used a laser cutter to cut the lids of the containers to hold them.
I just used two plastic cups for the larger grow pots and used a soldering iron to make some holes in them for the nutrient solution to fill and drain from.
Attempting To Make Float Switches
My initial intention (and probably still my long-term goal) was to use float switches to control the levels in the containers. This would ensure that each container was properly filled and that the pumps wouldn’t run dry.
I looked at some local stores for small float switches but couldn’t find anything small enough for my containers, so I decided to try to make my own using some syringes, magnets and reed switches.
The basic idea was to use the syringe without the rubber seal as a guide for the float and to stick a magnet onto the end of the plunger to close the reed switch at a certain limit.
So I took the rubber part out of some small syringes I found and added a magnet to the end of the plungers.
I then glued a cork float onto the bottom of each plunger.
I then also glued a reed switch onto the side of the syringe to pick up on the position of the magnet and close the circuit when the water level gets to a certain point. This setup can be adjusted by moving the reed switch up and down on the syringe.
This worked pretty well for my cup test, but once installed on my containers I noticed that if the small magnets were rotated to a certain point, the magnetic field was no longer strong enough to close the reed switch. I also couldn’t use larger magnets as these were as big as could fit into the syringe already.
Preparing The Hydroponic Flood System
Now that the containers are prepared, we need a way to move the nutrient solution from the reservoir to container one, from container one to container two, and then back from container two to the reservoir. To do this, we’re going to use three small 5V pumps.
I just used a 3-litre milk bottle as my reservoir. You need to use a container that isn’t too tall or you put extra pressure on the small pumps and reduce the flow rate.
Put a pump into each of the containers and then connect them up with some flexible tubing. The ends of each tube should be pushed through the lids of the containers, but shouldn’t protrude too far as they might then siphon the solution back into the original container when the pumps are turned off. You want them each to pull in air when the solution runs back through the tube to the container it’s being pumped from.
I cut the USB connectors off the ends of my pumps and replaced them with some Dupont connectors which can then be screwed into the terminals on the relay board.
Connecting The Builder Base Control System
Now we need to automate the flood cycle using one of our builder bases and the relay board. The pumps are connected to individual relays and the builder base then drives the relays to turn each pump on and off.
I have connected all of the negative terminals of the pumps to GND and the positives to the relay terminals which in turn then go to 5V. The relays act as a switch to turn the 5V on and off to each pump.
The builder base is connected to the input side of the relay board as follows:
VCC to 5V
GND to GND
Relay 1 to GP0
Relay 2 to GP1
Relay 3 to GP2
Relay 4 to GP3
I then made up a quick demo app to test each pump and the grow light relay using a button on the web dashboard.
There was one minor complication that I found during this step. My relay board energises each relay by grounding the input pin, which is the inverse of my individual relay boards. So they are off with a 5V signal and on with a 0V signal. This requires the logic in the code to be flipped as well, so you’ll see a NOT gate ahead of each relay output in the app.
Automating The Hydroponic Grow Cycle
Once the pumps were working, I started working on the automated app.
The app consists of three sections:
An environment tab, which displays the current temperature and humidity using the DHT11 sensor, as well as creates a notification alert if the temperature exceeds 30 degrees.
A pump tab, which has manual controls for each of the three pumps, similar to the test example, but also includes controls for the automated cycle. This runs each pump in sequence for the flood cycle and then waits for a period of time before executing the next flood cycle. From what I’ve seen online it looks like a good starting point is to flood your beds for around 5-10 minutes at a time and to repeat this every 2-3 hours.
Lastly, there is a grow light tab. The grow light tab has a slide switch to turn the grow light on or off and also has an automated cycle that turns the grow light on for a 10 hour period and then off for a 14 hour period.
There is a bit more to do than just create the app, you also need to generate and upload the firmware for each builder base, but this is quite straightforward and in essence just tells the builder bases what is connected to which pins.
You can download the app and firmware to import into your Quantum Cloud here.
Once this is done, the dashboard can be accessed through the server and we can start using the controls.
The environment tab has the temperature and humidity readings from our DHT11 sensor.
The water cycle tab has the three manual pump control buttons as well as the buttons to start and stop the automatic flood cycle. It’s worth mentioning here that if you push stop midway through the flood cycle, it’ll still complete that cycle before stopping.
The grow light tab has a slider to turn the light on and off as well as buttons to start and stop the automatic light cycle.
You can see a clip of the automatic flood cycle running in my video at the beginning of the post.
As mentioned earlier, after a lot of trial and error, I couldn’t get the float switches to operate reliably. There wasn’t enough space in the small syringes to put a large magnet and the small magnets only triggered the reed switch when they were in a particular orientation. This was fine 90% of the time, but on the odd occasion when the switch didn’t close properly, it either flooded my desk or left one pump running dry. I did eventually found some small float switches online, but they’re on a long delivery, so I’ll only be able to put them in in a couple of weeks’ time. So the system runs on a time-based cycle at the moment. This works well for about two to three days and then needs a couple of minutes of adjustment using the manual pump controls, which is alright as a temporary solution.
Installing The Grow Light
The final part of our system is the grow light. We’ve already got the controls on our dashboard and the relay wired up to our builder base to turn the light on and off.
I hung the light in the grow tent using the included wire hanging loops.
Both the light and the light’s built-in switch operate at 220V. I made up a new power lead to replace the included one which had a branch off to the relay to enable it to be switched on and off remotely.
Note: Check your local regulations before modifying any cables or appliances, this often requires qualifications and/or permits. Also, do not attempt to do work on 110V or 220V AC supplies if you are not qualified or competent to do so, you run the risk of electric shock, which may result in injury or death, and you risk starting an electrical fire.
Making Up The Control System Housing
To support and protect the electronics, I made up some laser-cut acrylic panels to mount them onto. This panel could then be installed on the side of the grow tent.
There is a back panel to mount the components onto and then a front cover plate to protect the wiring. The cover plate will be mounted onto 6 nylon standoffs.
You could use a similar setup for a range of home automation projects as well. You’ve got a temperature and humidity sensor and also a relay board with up to 8 usable relays on it – although you’d need to use some relays together as you’ve only got 6 free pins on the builder base after the DHT11 sensor is connected.
Adding A Remote LCD Display Panel
The last thing I’m going to do is to add a remote LCD display panel that can be used to keep an eye on the temperature and humidity in the grow tent from a different location. This will also be useful once my level sensors are installed.
This is as easy as dragging two LCD blocks into the app and dragging the sensor outputs to them.
We can then connect the display to another builder base’s I2C interface and it’s ready to go.
SDA to SDA
SCL to SCL
VCC to 3.3V
GND to GND
Finishing Off The Hydroponic System
I connected the board to the pumps and grow light and then mounted it in the back of the grow tent.
I then started up the server and tested the pumps again, this time from my phone.
Once I was happy with the way the hydroponic system was working, I added the plants. As mentioned earlier, I’m going to be starting off by growing a few different types of lettuce. I’m pretty new to hydroponics as well, so I expect that it’s going to take some experimenting to see what works and what doesn’t. But I think the basics are all here and this will be a good start to indoor farming.
I hope you enjoyed this project. Let me know what you think of it in the comments section below and have a look at the Quantum Integration system if you’re looking at getting into building wireless or IoT projects.
Today we’re going to be building a wireless outdoor weather station that takes temperature, humidity, barometric pressure, light and wind speed readings. The data is then posted to the cloud and can be accessed through a Thingspeak dashboard on an internet-connected computer, tablet, or mobile phone.
I’m going to use a development board from DF Robot called a Firebeetle ESP32-E IoT. I’ve chosen this particular board because it is inherently designed for low-power applications and can be powered by a lithium-ion battery directly. It’s got an onboard battery plug and supports charging through the USB C port.
For the sensors, I’m going to be using grove sensors by Seeed Studios. They integrate all of the required supporting components onto the sensor, so you just need to make the connections between each sensor and your microcontroller. They use 4-wire grove cables to plug into supported hats and boards, like the Arduino MKR IoT Carrier board. I’m going to modify one end of each cable to make up a harness that plugs into the pins on the Firebeetle board.
Update: I’ve made some upgrades to this weather station since building it, you can have a look at these on my follow up guide.
Here’s a video of my build, read on for the full step by step instructions:
What You Need To Build Your Own Weather Station
Firebeetle ESP32-E IoT Development Board – Buy Here
Grove Sensors & Cables (Beginner Kit I Used) – Buy Here
Dremel Versatip Heat Gun / Soldering Iron – Buy Here
Some of the above parts are affiliate links. By purchasing products through the above links, you’ll be supporting my projects, with no additional cost to you.
How To Make Your IoT Weather Station
Prepare Your Components
Lets start by removing the grove sensors we’re going to be using from the Grove Beginner Kit. You’ll need to cut through the tabs that join the sensors to the surrounding board. I used a sharp craft knife to cut each side and I then pushed the sensors out.
We’re going to use the pressure sensor that uses I2C communication, the DHT11 sensor that uses a digital pin and the light sensor that uses an analogue pin. You can leave the other sensors in place as we’re not going to be using them in this project.
We’re also going to make up an anemometer or wind speed sensor on top of the weather station that uses a reed switch to trigger an interrupt routine for each rotation.
Next, we need to prepare the Firebeetle board. It has a small jumper on it which DF Robot recommend breaking if you’re going to be using the board for low power applications. I couldn’t find any information in the documentation on exactly what this does or disables but I presume it disables things like the on-board power led in order to save power.
Assemble The Components On A Breadboard
This step is not required, but it is helpful to check that your sensors and connections are working properly before soldering the wiring harness. So let’s assemble the components on a breadboard to test the connections to each sensor and to get the code working.
I’ve connected each of the sensors as follows:
Pressure Sensor to I2C Interface
VCC – 5V
GND – GND
SCL – SCL
SDA – SDA
DHT11 Temperature & Humidity Sensor to Pin 14
VCC – 5V
GND – GND
Sig – Pin 14
Light Sensor to Pin 36
VCC – 5V
GND – GND
Sig – Pin 36
Reed Switch to Pin 0
Side 1 – GND
Side 2 – Pin 0
You should be able to push the end of a male jumper into the grove connectors to pick up on each required wire. Make sure that you pick up the correct wires by tracing the wire colours back to the sensors.
Program The Firebeetle Board
Now that the sensors are connected to our board, we can write up a sketch to take readings from the sensors and post the data to Thingspeak. Between readings, we’ll put the ESP32 into deep sleep mode in order to save power. This shuts down the WiFi and Bluetooth communication modules as well as the CPU.
The Firebeetle board can be programmed in the Arduino IDE by adding the Firebeetle series of boards as an additional board type through the boards manager tool.
Here is the sketch:
//Weather Station
//The DIY Life by Michael Klements
//11 August 2021
#include <Wire.h> //Import the required libraries
#include "DHT.h"
#include "Seeed_BMP280.h"
#include <WiFi.h>
#include "ThingSpeak.h"
#define lightSen 36 //Define pin numbers
#define windSen 0
#define uS_TO_S_FACTOR 1000000ULL //Conversion factor for micro seconds to seconds
#define TIME_TO_SLEEP 570 //Time ESP32 will go to sleep (in seconds) - 9.5 minutes
DHT dht(14,DHT11); //DHT and bMP sensor parameters
BMP280 bmp280;
WiFiClient client; //WiFi connection details
char ssid[] = "WIFI SSID"; //WiFi Name
char pass[] = "WIFI PASSWORD"; //WiFi Password
unsigned long myChannelNumber = YOUR CHANNEL ID; //Thingspeak channel number
const char * myWriteAPIKey = "YOUR WRITE API KEY"; //Thingspeak API write key
int light = 0; //Variables to store sensor readings
int temp = 0;
int humid = 0;
int pressure = 0;
int wind = 0;
unsigned long firstMillis = 0; //Timers for the wind speed calculation
unsigned long lastMillis = 0;
unsigned long lastIntTime = 0;
int counter = 0; //Counter to keep track of the number of wind speed revolutions
void IRAM_ATTR isr () //Interrupt routine, run with each reed switch interrupt
{
unsigned long intTime = millis();
if(intTime - lastIntTime > 150) //Debounce the reed switch input
{
if (counter == 0)
firstMillis = millis();
counter++; //Count each revolution
lastMillis = millis();
Serial.println(counter);
}
lastIntTime = intTime; //Capture the first and last revolution time
}
void setup() //Setup function - only function that is run in deep sleep mode
{
Serial.begin(9600);
if(!bmp280.init()) //Connect to pressure sensor
{
Serial.println("bmp280 init error!");
}
pinMode(lightSen, INPUT); //Define pin functions
pinMode(windSen, INPUT_PULLUP);
attachInterrupt(windSen, isr, FALLING); //Define interrupt pin
WiFi.begin(ssid, pass); //Connect to WiFi network
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR); //Initialise deep sleep mode parameters
ThingSpeak.begin(client); //Initialise ThingSpeak
delay(10000); //Wait for wind speed readings to be taken
recLight (); //Take readings from other sensors
recTempHumid ();
recPress ();
calcWind ();
counter = 0;
Serial.print("Light: "); //Display readings on serial monitor
Serial.println(light);
Serial.print("Temp: ");
Serial.println(temp);
Serial.print("Humidity: ");
Serial.println(humid);
Serial.print("Pressure: ");
Serial.println(pressure);
Serial.print("Wind: ");
Serial.println(wind);
updateThingSpeak (); //Post the data to Thingspeak
Serial.println("Going to sleep now");
Serial.flush();
esp_deep_sleep_start(); //Enter sleep mode
}
void loop() //Loop function - unused
{
}
void recLight () //Function to record the light level
{
light = analogRead(lightSen);
}
void recTempHumid () //Function to record the temperature and humidity
{
temp = dht.readTemperature();
humid = dht.readHumidity();
}
void recPress () //Function to record the pressure
{
pressure = bmp280.getPressure()/100;
}
void calcWind () //Function to calculate the wind speed
{
int ave = 5000;
if(counter != 0)
ave = (lastMillis - firstMillis)/counter;
Serial.print("Average Tick Time: ");
Serial.println(ave);
if (ave < 200)
{
ave = 200;
wind = map (ave,200, 4000, 16, 3);
}
else if (ave > 4000)
wind = 0;
else
{
wind = map (ave,200, 4000, 16, 3);
}
}
void updateThingSpeak () //Function to post data to Thingspeak
{
ThingSpeak.setField(1, light);
ThingSpeak.setField(2, temp);
ThingSpeak.setField(3, humid);
ThingSpeak.setField(4, pressure);
ThingSpeak.setField(5, wind);
int x = ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);
if(x == 200)
{
Serial.println("Channel update successful.");
}
else
{
Serial.println("Problem updating channel. HTTP error code " + String(x));
}
}
Before uploading the code to your Firebeetle, you’ll need to add your network and Thingspeak channel details.
Your network name (SSID) and password need to be added to the fields in lines 20 and 21.
You’ll also need to create an account on Thingspeak and then create a channel for your data. You’ll then be able to generate a write API key for your channel. The API key is effectively the password your ESP32 uses to be able to post data to your Thingspeak channel, so that Thingspeak knows that the data is coming from the correct source. Add your channel name to line 23 and your write API key to line 24.
On my Thingspeak account, I’ve created a weather station channel and then made a dashboard to view the channel data which I’ve put a gauge and a trend chart onto for each field.
It’s important to keep track of which fields are receiving which data sets from your weather station, they are posted to a field number in your code (lines 136 to 140) and you’ll need to use the field number to display data on your charts and gauges on your dashboard.
You’ll notice that all of the code is in the setup() function and that the loop() function is left empty. This is because the ESP32 only runs the setup() function when operating in deep sleep mode, so only the code in this function is executed each time it wakes up.
In the setup function, connections are made to the sensors and the pin modes are defined. The board then connects to the WiFi network and starts a new Thingspeak client. There is then a 10 second delay to allow the anemometer to increment the reed switch counter in order to calculate the current wind speed. The board then takes readings from all of the other sensors, calculates the wind speed based on the number of revolutions and the time, then posts the data to Thingspeak and enters deep sleep mode. I’ve added some output lines to the Serial monitor to assist with debugging while you’ve got your board connected to your computer.
The entire wakeup cycle takes about 20-30 seconds to complete including the 10 seconds that the ESP32 waits to measure the wind speed data.
Soldering The Wiring Harness
To make the weather station a bit more resilient, it’s a good idea to make up a permanent wiring harness to connect the sensors to the Firebeetle board.
I cut the ends off of one side of the grove cables and soldered these along with two female jumpers for the reed switch onto some male header pins.
The grove plugs are still on the other end of the grove leads, so they can be plugged in or removed as needed.
I also marked the plugs with a TH, P, and L to keep track of which sensor they plug into.
Designing and 3D Printing The Weather Station Housing
Next, we need to design a housing to protect the components when they’re mounted outdoors. The sensors can’t be completely enclosed as this will interfere with their accuracy, but they need to be protected from direct sun and rain. I wanted the weather station to be as compact as possible, so I wanted to integrate the sensors and the anemometer into a single assembly.
The design I came up with housed the ESP32 and battery in the base, with the sensors in a vented centre compartment and the anemometer on top. I used Fusion 360 to model the four components that make up the housing.
I wanted to 3D print the components in resin so that I could print the sensor housing as a single piece and I wouldn’t have to build it up with each ring as an individual print. You can experiment with printing the components on an FDM printer as well, you’ll just need to play around with the orientation and print speeds to get right.
I’m not yet sure how well resin prints will hold up in the sun. I’ve done a bit of research on it and most articles I’ve found say that it’s a bad idea, listing brittling and UV damage as likely to lead to failures, but I’ve also seen a couple of tests where people have actually left prints outside through sun, rain, and snow and they didn’t seem to have any visible damage. So I thought I’d give it a try and see how long it lasts.
I printed them in regular pla style white resin, then cleaned them up and removed the supports. I printed the base and sensor holder vertically and the sensor housing at a 45 degree angle with supports.
I allowed the parts to cure in the sun for a day as I don’t yet have a UV curing chamber.
I’ve recently reviewed the Voxelab Proxima 6 sla printer that I used for these prints. It’s a really good quality entry-level resin printer. If you’re looking at getting into sla printing I’d definitely recommend checking it out.
Now that all of the housing components are ready, we can start assembling the weather station.
Installing The Components In The Weather Station Housing
We’ll start out by mounting the temperature and humidity sensor on one side of the sensor stand. I’ve already added the mounting holes into the 3D print, so each sensor just needs to be screwed into place. I just used some small screws that I had lying around my workshop from some servos.
We can then mount the pressure and light sensors onto the other side of the stand.
Next, let’s install the reed switch on top of the sensor housing. You’ll need to bend the legs 90 degrees to fit into the premade holes through to the inside of the housing. I added some print resin to fill up the void and seal the holes through the top and then cured it will a small UV light.
The anemometer is mounted onto the top of the weather station using an M5x20mm screw, two nuts and two small bearings.
Push the screw through the hole in the top (from the inside), then secure it with the first nut. Place the two bearings onto the screw and the second nut then holds them in place, but shouldn’t squash them.
We need to add a small stack of magnets into the anemometer to activate the reed switch on each turn. Push a couple (4-5) into one of the gaps so that they sit flush with the base of the anemometer.
The anemometer is then just pushed onto the bearings. If your bearings are tight, put a drop of thin oil on them first and make sure that they’re not being clamped too firmly by the top nut. They should turn freely.
We can then plug the wiring harness onto the legs of the reed switch for the wind speed sensor.
Finally, connect the sensors to the Firebeetle board.
There is one last thing we need to check before putting the sensor housing on over the sensors, the power consumption.
How Long Will The Battery Last?
Since this project is battery-powered, we’d obviously like to know how long the battery is going to last. So, I measured the power consumption for the whole setup using a multimeter.
The board and sensors use about 30-60mA when running and this momentarily spikes to just over 120mA when connecting and posting data over WiFi.
When in deep sleep, this goes down to about 1.2mA.
This is still higher than I was hoping for but seems to be related to the power being drawn by the components on the sensors in addition to the Firebeetle board. I’ll be looking into a way to use an optocoupler to turn the sensors on only when the board is awake.
With this setup, the weather station should run on a single 2500mAh battery for a little under 2 months. This is not too bad but is still a hassle to remember to charge. I could also get around this by adding a small solar panel to the weather station to charge it every day.
With that done, we can close up the base with three M3x8mm screws.
Testing The IoT Weather Station
The weather station can be mounted with some screws or cable ties through the feet in the base. Screws are a better long-term solution if you’ve got a suitable material to mount it onto.
Now I just need to leave it out and see how well it records the weather.
After a couple of hours, it all looked like it was working well. As luck would have it, this was the most still weekend we’ve had in months, so there was no wind to test. There was a light breeze once or twice that got it turning, and it did register a reading, but this reading was way higher than the actual wind speed, so it needs some adjusting.
I’ll need to do some further testing on the actual wind speed to calibrate the anemometer, but for now it registers each revolution and is able to turn in a light breeze, which is a good start.
I then left it overnight.
I got some consistent results overnight and the light sensor picked up the sunrise quite sharply. Again, there were one or two wind spikes in the morning, way higher than the actual wind speed would have been.
Overall I’m really happy with how it came out. I’ll post an update on how the resin print is holding up in a month or two’s time – if it doesn’t break before then. Hopefully, we’ll have a few windy days soon and I’ll then be able to adjust the timing to get reliable wind speed results too!
Let me know what you think of the weather station and what you would add or do differently in the comments section below. Enjoy the project!
Today I’m going to be unboxing and reviewing the Voxelab Proxima 6.0, which Voxelab sent to me to share with you.
The Proxima 6.0 is their mid-range of three SLA 3D printers that they currently have available and retails (at the time of writing) for $189 to $219 on their website, depending on your shipping location. Within the SLA printer range, they also have the smaller 2K Polaris model and a larger 4K Proma 8.9.
The printer arrived really well packaged in a sturdy cardboard box with no sign of loose or rattling components inside.
When you open the top of the box you’ve got a compartment that contains the Quick Start Guide, and some other components, including:
Two spatulas – one plastic and one steel
A set of rubber gloves
A set of hex keys and some spare screws
The power supply and power cable
A resin filter
A USB flash drive
Within the box, the entire printer is surrounded by a fitted foam shell that is split roughly in the same spot as the transparent orange cover within it.
Underneath the foam, the lid of the printer is held in place with removable tape and is covered in a protective film.
There is another set of foam inserts underneath the orange cover. This supports and protects the linear rail system and contains the build plate and resin vat.
One thing that stood out for me right out of the box is that it just feels like a really good quality product. Almost everything that you unpack is metal, the printer base, the linear rail support, the overhanging support arm, the whole build plate assembly, the resin vat, even the included USB flash drive is metal.
Given that this is one of the cheapest SLA 3D printers that is currently available on Amazon, it’s quite impressive that they haven’t cut down on building a quality product. This really looks and feels like it is a high-end, albeit small, resin 3D printer.
Voxelab Proxima 6.0 Specifications
Now that we’ve got the printer unpacked, let’s have a look at its specifications.
Printer Size: 230mm x 200mm x 410mm
Printer Weight: 6.8kg
Build Volume: 130mm x 82mm 155mm
Print Speed: 17-22mm/h
2K Monochrome LCD Screen (2560 x 1620) with a pixel size of 50 microns
405nm LED Light Source
Layer Height: 0.025-0.1mm
Linear Rail Z-Axis
Ball Joint Easy Bed Levelling
Colour Touchscreen Display
The specifications are fairly typical for this size resin printer. Some standout items would be the monochrome LCD screen which results in faster and better quality prints and also a longer display life, the linear rail system instead of rollers which improves print quality, the colour touch display to display printing status and change parameters or settings and the ball joint on the print bed which makes levelling a lot easier and faster.
First Print on the Proxima 6.0
Before printing anything, we have to level the build plate. This is a pretty easy process and is well described in the quick start guide. Essentially you need to loosen the build plate screws, then lower the build plate onto a sheet of paper between the display and the bottom of the plate (with the resin vat removed) and then put some light pressure on it and tighten the screws. There’s also a video included on the USB flash drive to help you.
This is where the ball joint on the print bed makes things easier. Instead of having to adjust the bed along two axes individually, you just loosen the two screws and you can then adjust both axes at the same time at a single point.
If you’re new to 3D printing or you’re struggling with the information in the Quick Start Guide, there is a lot more information on the included USB drive. Plug that into your computer and have a look at what’s on there. There are some links to really useful videos on using the slicing software, levelling the build plate, removing prints from the build plate and even replacing the resin vat film.
I’m going to be using two different colour resins for my test prints. They’re both E-Sun Water Washable Resins.
I got these water washable resins because they simplify the clean-up process quite a bit as you then don’t have to worry about different containers of alcohol for cleanup.
Just a word of caution on water-washable resins. They’re still toxic, so you should still wear gloves with them and you shouldn’t pour the resin or the water that you’ve used for washing parts down the drain. The best thing to do is put water you’ve used out in the sun on a tray to evaporate. This will also cure any resin in the water and allow you to safely dispose of the residue that is left over.
The first print I’m going to be trying is one that comes on the USB drive and is already sliced with the manufacturers recommended settings. So we just need to plug the drive into the printer and select the file to print.
The display can be a bit small to navigate, particularly with the text for the filenames, but the menu options are intuitive and the graphics illustrate each function quite well too. I also like that the display shows a small rendered image of each 3D print as an icon above the filename.
The test print is a detailed deer and I printed this the clear resin. It took a little over three and a half hours to complete.
Once the print was finished, I removed it from the build plate and cleaned it up in an ultrasonic cleaner. You can clean it up in a jar or bucket, an ultrasonic cleaner just helps to agitate the water on the surface of the print and “scrub” the resin off it.
I dried the print with a heat gun on a very low setting and finally cured it under a small UV nail lamp. You can just leave the print out in the sun to dry and cure or use a purpose-built resin curing chamber.
The test print came out pretty much perfectly on the first attempt and with no supports that required removal. I’m quite impressed by the level of detail that the printer is able to achieve on a fairly small print.
Trying Out Some Other Test Prints
I then printed out a couple of additional files that I found on MyMiniFactory and Thingiverse, I’ll include their links as well.
To start, you’ll need to install the Chitubox slicing software that is included on the USB flash drive. Voxelab have also included a profile for the Proxima 6.0 that can be imported into Chitubox. Chitubox is a generic slicing tool that can be used with a number of different 3D printers from a range of manufacturers. This profile loads the settings specific to the Proxima 6.0 so that you can start slicing your model right away.
I moved on to trying out the black water washable resin for these test prints. Cleaning out the resin vat was pretty easy, I just poured the unused resin through the filter and back into the container and then washed the vat out in some water in a small bucket.
I printed the left and right hand threaded bolt and nut first.
It was quite mesmerizing to see the bolt thread slowly emerge from the resin vat.
I then printed out the components for the gear cube. I printed these all out in a single print, so I had to scale the model down to 60% of the original size in order to fit.
Finally, I printed out the ford engine block model. I also had to scale this down a bit to fit onto the build plate.
After printing each of the models, I washed them off in the ultrasonic cleaner, then dried them off and cured them under the nail lamp. The nail lamp is not ideal as it only lights up one side of the model at a time, so you have to keep rotating them. I cured them for about 5 minutes a side and about 30 minutes in total.
One thing you’ll notice, or rather not notice, is that there are almost no visible layer lines on the prints. On the larger angled edges on the engine block you can make a couple out, but for the most part, they’re almost non-existent, which is great.
Final Thoughts on the Proxima 6.0
After using the printer for the couple of test prints I’ve done so far, these are my thoughts on it.
The Proxima 6.0 is a really good value for money printer. You’re getting an almost all-metal construction printer with a great print resolution on a monochrome display and linear rail system for an entry level price. It produces fantastic quality prints right out of the box, which you’ll really appreciate if you’ve had an FDM printer and have spent countless hours trying to get your first few prints to come out correctly.
The design focuses on ease of use. You have a ball joint for easy levelling and the resin vat just slides out from underneath two thumbscrews for emptying and cleaning. A lot of other SLA printers require the screws to be removed entirely in order to remove the resin vat, which is not a big deal until you accidentally drop one into the resin.
The printer is quite noisy. I’ve got a couple of Creality Ender 3 V2s and an Ender 3 Pro that I’ve upgraded to use silent stepper motor drivers and the use of these drivers makes a substantial difference to the noise that the motors produce. The Ender 3 Pro is almost completely silent when the fans aren’t running. I’m not sure if it’s possible to use a silent driver on a SLA printer, but making it a bit quieter would definitely be beneficial if it’s running in an area where you’re spending a significant amount of time.
The only thing that I found a bit cumbersome was having to manually travel the build plate more than 10mm. In order to fill the resin vat or remove it (after levelling or a failed print), you need to first move the arm and build plate out of the way. The manual controls only have options to move a maximum of 10mm, which you have to do a number of times to get the build plate moved up enough to clear the vat nicely. It would be much easier to have a single button that did this automatically. This could move the build plate up halfway or at least enough to clear the vat.
With all that said, I’d definitely recommend this printer to anyone looking to get started with resin 3D printing. It’s affordable, includes everything you need to get started (excluding your resin) and produces prints that you’ll be proud of. As with most resin printers, they’re better suited to producing small models with intricate details. So the Proxima 6.0 is best suited for figurines, game pieces and small display objects. If you’re looking to print larger components then you’d probably want to have a look at one of Voxelab’s FDM printers.
Today we’re going to be building a mini Raspberry Pi server with a built-in UPS and OLED stats display. A Raspberry Pi makes a great server for a NAS or for media streaming, home automation, or even a home security hub for your cameras. All of these projects would benefit from having a built-in UPS to ensure that the Pi is kept running in the event of a power interruption.
Here’s a video of the build and the UPS running, read on for the full write-up. You can also buy a case kit, which includes all of the components you need to assemble your own mini server.
What You Need To Build Your Own Mini Server With UPS
Some of the above parts are affiliate links. By purchasing products through the above links, you’ll be supporting my projects, with no additional cost to you.
Unboxing The GeeekPi UPS Plus Module
The UPS we’re going to be using is this UPS module that GeeekPi sent to me to share with you.
It looks like a relatively simple board, with a prominent battery holder on one side, but it actually has a number of great features, including power management circuits and I2C communication, enabling low voltage safe shutdown and automatic restarts.
Power is supplied to the UPS through either USB C or a micro-USB port, with the board taking advantage of the USB 3.1 protocol to allow a higher input power through a higher charging voltage.
The board also has three USB ports on the front, two full-size ports and one USB C port, that allow a combined output of up to 4A including the Pi’s consumption. There is also a battery monitor in the form of four blue LEDs that light up and/or flash to indicate the current battery level. And lastly, it has a function button on the side.
This is the most recent 5th revision of this board, which was completed in December of last year.
The UPS is mounted onto the PI using some supplied brass standoffs and nuts. Unlike most Raspberry Pi hats, the UPS is designed to mount underneath the PI and has these little spring-loaded gold contacts that make contact with the underside of the header pins. This is a really nice feature as it keeps all of your GPIO pins available for other connections.
The board takes two 18650 cells that are connected in parallel, so the UPS boosts the voltage of the cells to the 5V required by the Pi. I’m going to be using some 2500mAh cells that I have left over from a previous project.
You may have also noticed in the video that the UPS turned on as soon as the first battery was inserted. You can then turn it on or off using the function button.
The UPS also includes an acrylic base plate to mount it onto. We’re not going to use this as we’re going to be building the Pi and UPS into a custom case.
Building The Mini Raspberry Pi Server
To build the mini server, I’m going to use a low-profile Ice Tower to provide cooling to the Pi and I’m going to add an I2C OLED display to the front of the case to display some performance stats for the Pi as well as stats for the UPS.
I used my previous Ice Tower Pi case as a starting point and then modified it to accommodate the UPS underneath the Pi. I had to move the OLED display up a bit to clear the top of the Pi’s USB ports.
I then 3D printed the case on my Creality Ender 3 V2 in grey PLA with a 15% infill.
I then also had to make some modifications to the clear acrylic side panels. I moved the Pi ports higher up and added the additional cutouts for the UPS underneath them. I also added a couple of vent holes along the bottom so that air would be forced around the Pi to cool the UPS and batteries.
With the case and side panels made up we can start installing the components into the case.
Assembling The Server With UPS
I started by screwing the longer brass standoffs into the base of the case. These are quite tight initially, but need to be so that they don’t move when plugging or unplugging peripherals into the Pi’s ports.
I then put the batteries into the holder and mounted the UPS. You need to be careful from this point as there isn’t any way to physically isolate the batteries, so some parts of the UPS are powered and you risk shorting and potentially damaging the board if it touches the metal standoffs in any area it’s not supposed to.
The smaller brass standoffs then hold the UPS in place and we can then mount the PI onto them, making sure that the terminals are properly seated on the GPIO pins.
The Pi is then held in place with the standoffs from the Ice Tower.
Before installing the Ice Tower, I’m going to install the OLED display.
This just pushes into the holder in the case and I’ll connect a ribbon cable to the pins on the back to plug it into the Raspberry Pi. These provide power to the display and connect to the Pi’s I2C pins.
Now we can install the Ice Tower. I removed the fan from the heat sink as I’m going to move this onto the side panel to push air into the entire case. I’m going to use the RGB fan that was supplied with the Ice Tower as an alternative to the plain black one.
Screw the Ice Tower onto the Pi, again making sure that you don’t touch the metal bracket onto any of the components on the Pi or the GPIO pins. Although the Pi may look like it is still off, rather be cautious.
Installing The Side Panels
I mounted the fan onto the side panel by pressing some M3 nuts into the pockets on the fan and then screwing the fan into place with some M3x8mm button head screws.
I then tried to fit the side panel. It was at this point that I saw that the Ice Tower is wider than the standard Ice Tower and clashed with the back of the fan. So I had to redesign the side panels to move the fan to the other side.
I then mounted the fan onto the modified side panel, again using the M3x8mm button hex head screws.
I screwed the two side panels onto the case using some more M3x8mm screws.
The last thing to do was to put the SD card into the Pi and power it up. I’m using a fresh install of Raspberry Pi OS.
Programming The Raspberry Pi
With the mini server all assembled, we now need to program the Raspberry Pi so that the automatic shutdown works and to get the UPS stats to show up on the OLED display.
The Pi booted up as soon as the power cable was plugged in, so it looks like the UPS was working correctly so far.
I’m going to go over to the UPS Plus Wiki to see how to install the script that allows automatic shutdown and see what other UPS information is available on the Pi.
You can see all of the information that is available to be read by the Pi on the Register Mapping chart. It’s a pretty comprehensive list. All of these metrics can be accessed by the Pi through the I2C interface, we can then display the ones we’d like to on the OLED display.
It’s a pretty straightforward process to download the example script that allows you to make changes to the general settings and access the available data on the UPS.
First, ensure that I2C communication is enabled in your preferences menu. Then install the smbus2 library by entering the following command in a new terminal window:
pip install smbus2
You can then download the GitHub repository by entering:
git clone https://github.com/geeekpi/upsplus.git
Installing The UPS Automatic Shutdown Script
The install the automatic shutdown protection that signals the Pi to shutdown when the battery level becomes critically low, we just run a single line.
Next, we’ll have a look at the example script and the script that I used previously to display the Pi’s performance stats and integrate the two to produce a second stats display for the UPS that will show us some key UPS information. I’ll also add some code to switch between the two display screens every few seconds.
If we run the example script in the GitHub repository that we downloaded earlier, we get a printout of almost all of the stats available on the UPS.
The information I’m going to put on the UPS display is the Pi’s voltage and current being drawn, the battery voltage and capacity, and lastly the charging current and power and charging status. This will allow us to keep an eye on how much power the Pi is using, the state of the UPS battery, and whether we’re charging or discharging the battery.
You can download my script below. You’ll need to also download the font PixelOperator.ttf from https://www.dafont.com/pixel-operator.font and then unzip the contents of the download and paste the font into the same folder as the stats.py script.
Dan has made some tweaks to the script to improve stability and has documented the automatic startup of the script on boot, you can find these in his Github repository – danb35/raspi-ups-stats.
Let’s try and run the script and see what we get on the display.
Next let’s test the UPS by pulling out the power cable and make sure that the Pi keeps running and that the display shows us the battery level and correct charging status.
So it looks like that’s all working correctly.
Further Testing The UPS Plus Module
I was able to get just under an hour and a half of runtime from a fully charged set of batteries. This would obviously depend on the capacity of your batteries. For most people, this would be long enough to ride out a short power interruption and your Pi would be safely shut down if the interruption lasted longer than this.
I also wanted to see if I could plug the display’s power cable into the UPS as well, powering my whole setup from the UPS.
The display came on and it looked like the UPS had enough capacity to power the display as well, although this is pretty close to its 4A limit.
There were two issues that I found with the UPS through my testing. Both of them probably won’t affect you if you plan to run the UPS continuously, like most people do, but would also have a common and fairly simple solution.
The first is isolating the batteries. If I designed that case a bit better I’d be able to install the batteries after installing the UPS, but it would be nice to have a physical switch to isolate the batteries from the board when you didn’t want any power on the board. At the moment, when the batteries are in the UPS, you need to be careful not to touch any of the components or PCB traces or you might damage it.
The second is a physical means to turn off the UPS, which could be done with the same isolation switch. The board has a function button on the side, but I haven’t been able to find any information on what it is actually supposed to do.
The board does turn off or on if you push the button, but on two occasions I’ve turned the board off using this switch and come back after 10-15 minutes and the board has come back on again and powered the Pi up.
If the UPS does startup accidentally while the batteries are low then there might be a situation where the Pi hasn’t finished booting up and the batteries die completely. This interruption during booting might result in corrupting the SD card. A physical switch would just provide that extra level of protection against an accidental startup.
Other than the isolation of the batteries this UPS is a really neat and compact solution to provide a reliable battery backup to your Pi with automatic safe shutdown and stats available.
Let me know what you think of it in the comments section below.
Today we’re going to be building a Tic Tac Toe or Noughts and Crosses shield for an Arduino. The game board is made up of a 3×3 grid of RGB LEDs that light up green or blue to indicate the naughts or crosses. A keypad at the bottom of the shield, that corresponds to the game board positions allows you to input each move. A status LED underneath the gameboard shows you which player’s turn it is and allows you to select one of the three game modes using the start button alongside it.
The game has 3 selectable game modes, the first is a turn-by-turn two-player mode that allows you to play against another person, the second is an easy level AI opponent and the third is an expert level AI opponent that is impossible to beat.
You can watch my video of the build below, or read on for the full instructions to make your own Tic Tac Toe game shield.
How The AI Algorithm Works
The AI works on a minimax algorithm, which is a recursive algorithm aimed at minimising the possible loss for a worst-case scenario. The algorithm calculates the value of each state of the game by looking at all of the possible outcomes following each move.
For example, the top game board below represents the current state of the game, with the green player to play next. The second line indicates the three possible moves that the green player can make. Two of these states result in the green player winning, these are awarded a score of 10. The third state allows the game to continue, with blue taking their turn. There are two possible spots for blue to play, the first does nothing (nothing in this move, although we can see that in the next move green would win) and then second results in blue winning. So, a score of -10 is given as this is against the green player who is currently playing. A state which results in an eventual draw is given 0. The algorithm would therefore favour one of the first two game moves, and work against playing the third move which allowed the opportunity for the blue player to win.
This is an old algorithm which was been around since the early 1900s and can be applied to many two-player, turn-based games. It’s commonly used in computer-based chess games to this day.
With the AI running the minimax algorithm on the Arduino, it’ll always play the best possible move, so regardless of who starts, you won’t be able to beat it.
To make the game a bit more fun, as it’s not much fun losing or drawing games all the time, I’ve added a second mode that plays random moves for the first two plays before allowing the AI algorithm to finish off the game. This drastically reduces the AI’s ability to win and you’re left with the possibility of winning most games that you start and a fair number of games that the AI starts.
There are ways to use addressable LEDs to condense the IO to fit onto an Arduino Uno, but I already had a bunch of these RGB LEDs and an Arduino Mega lying around, so that’s what I used for this project. The shield makes use of 21 digital outputs for the LEDs and 10 digital inputs for the pushbuttons.
It is important that you get common cathode RGB LEDs as the PCB design incorporates a common GND and the IO switches high to turn them on. You can use common anode LEDs if you’ve got them already but you’ll need to modify the PCB to suit.
Designing The PCB
I sketched the circuit in Easy EDA and then designed a PCB as a shield that clips onto an Arduino Mega.
Each pushbutton has a corresponding 10-20K resistor and each LED has a 220-500 ohm resistor in series with it. I usually use slightly higher value resistors for the green legs of the LEDs as I find these are usually brighter than the blue and red legs. I didn’t connect the red legs of the LEDs on the gameboard as you only need to indicate two on states for each position.
You can download my PCB gerber files to have your own PCBs made up:
I got the PCBs made up by PCB Way. They have a really easy-to-use instant quote and ordering system and you can get simple PCBs under 100mmx100mm made up from just $5 for 5 pieces.
Soldering The Components Onto The PCB
Once the PCBs arrived, I got to assembling them.
I used 15K resistors for the switches, 390-ohm resistors for the blue and red LEDs, and 470-ohm resistors for the green LEDs.
I soldered all of the resistors in place first and then trimmed the legs off the back of the PCB.
I then soldered the RGB LEDs into place. Make sure that the cathode (long leg) on the LEDs is placed into the hole with the small arrow underneath it.
Check all of the solder joints on the LEDs afterwards to make sure that there are no bridges across the pads or legs, they are really close together.
I also added some header strips to plug into all of the pins on the Arduino so that the shield is held in place firmly.
Lastly, you need to solder the tactile pushbuttons into place. Make sure that you’ve got the orientation correct before you solder them.
Programming The Arduino
With the PCB done, we can get started with the programming.
I started out by getting a game board set up in a 3×3 array and adding some logic to get the two player mode working. This allowed alternating green and blue inputs until the board was full or one player had won across the rows, columns or two diagonals.
I used the number 0 to indicate a blank space, 1 to indicate player 1’s moves and 2 to indicate player 2’s moves. I set up the board to be displayed in the serial monitor for debugging.
Once this was working I got started on the AI’s minimax algorithm. If you’ve ever used this algorithm before then you’ll probably know that it’s not that easy to debug. It took me a couple of hours to get it working, and it finally started producing meaningful results.
I had to add some simple logic to the first AI move in order to reduce the first move’s processing time. The Arduino, being a relatively slow computer, was taking a significant amount of time to work through all 255,168 possible game outcomes if it was to play the first move and also took a consiberable amout of time if it was playing the second move.
With my modification, the AI essentially now plays a corner as its first move unless it goes second and the human player has already played a corner, in which case it plays the center position. This logic reduces the number of possible game plays to a couple of thousand, which the Arduino has no problem calculating in a few milliseconds. You’ll notice in my video of the gameplay that the Arduino takes a bit longer to play its second move than it does to play subsequent moves. This is the Arduino “thinking” through all possible moves.
Once the AI player was working, I added the final game mode that just chooses random board positions for its first two moves and then allows the AI to take over. This results in a game in which you can quite easily win if you play first and still allows the AI to occasionally win if it goes first or you make a silly mistake. You could add a fourth mode that only randomly places the first AI move. This would increase the difficulty quite a lot but still allow you some chance of winning if the AI got unlucky with the placement of this move.
I then added a start animation and code to highlight or flash the winning lines and the programming was then complete.
You can download the final version of the code here:
You can now select a game mode when the Arduino is powered up by using the center top and bottom buttons on the gamepad to scroll up and down through the three modes and pressing the start game button to confirm the mode. The current mode is indicated by the RGB status LED:
Easy AI Mode – Green
Expert AI Mode – Red
Two Player Mode – Blue
Once in a game mode, the Arduino stays in the mode and just keeps refreshing the game board after each play. You can then keep playing in this mode until you reset it again.
Once a game mode is selected, the RGB status LED indicates which player’s turn it is. This is randomly generated for each game so that you don’t always have one player starting.
You can then play out your game and the Arduino will highlight a winning line once it is reached or flash the whole game board if it is a draw.
Let me know what you think of the game and what you would do differently in the comments section below. Enjoy making your own one!