Parallels is a worldwide leader in virtualization and automation software that optimizes computing for consumers, businesses, and service providers across all major hardware, operating system, and virtualization platforms. Founded in 1999, Parallels is a fast-growing company with 900 employees in North America, Europe, and Asia. Its most popular software, Parallels Desktop for Mac, enables users to run Windows, Linux, and more on a single Intel-powered Mac without rebooting. The first non-Apple product ever to be named “Product of the Year” by MacWorld readers, Parallels Desktop was also awarded the #6 spot on PC World’s “Best 100 Products of 2007” list. Already deployed to over half a million users worldwide, Parallels’ popularity continues to grow as it revolutionizes the way the world works with computers. With the release of the highly anticipated Parallels Desktop 134 for Mac, there’s never been a better time to join the Parallels Affiliate Program! • Absolutely FREE to join!
Launched in 2002, BullGuard is one of the fastest growing antivirus and internet security brands. Our award-winning products provide comprehensive protection from all online risks and secure our users valuable data effectively. BullGuard's philosophy has remained the same over the years: combining technical excellence with genuine understanding of consumers’ needs.
New DIY projects and creative ideas on electronics, arduino etc for you
Title: PET Bottle Recycler Part 1 – Using An Arduino Uno R4 To Control A 3D Printer’s Hotend
Date: Wed, 19 Jul 2023 11:18:13 +0000
Desc:
Today we’re going to be using the new Arduino Uno R4 WiFi to build a controller for a PET bottle recycler. I’m doing this as the first part of a project, working towards building my own version of a PET bottle recycler to produce filament for my 3D printer. I already have an idea of […]
Today we’re going to be using the new Arduino Uno R4 WiFi to build a controller for a PET bottle recycler. I’m doing this as the first part of a project, working towards building my own version of a PET bottle recycler to produce filament for my 3D printer. I already have an idea of what I want the machine to look like mechanically, so for Part 1 I’m going to focus on building the electronics to provide temperature control of the 3D printer hot-end and to drive the extruder motor.
I have now completed the PET Bottle Recycler, you can find Part 2 here.
Here’s my video of the build, read on for the written guide;
Some of the above parts are affiliate links. By purchasing products through the above links, you’ll be supporting my blog, at no additional cost to you.
Arduino Uno R4 Minima & WiFi
I’m going to start the project by using an Arduino Uno R4 for prototyping. The Uno 4 comes in two versions, the minima which is the more basic version and then the WiFi version which has WiFi and an integrated LED matrix.
They both have a new more powerful 32-bit processor as well as significantly increased SRAM and flash memory, allowing you to build more complex projects.
The LED matrix on the WiFi board is really useful for quickly displaying a status or mode, and you can even run some animations and games on it.
For prototyping, I’m going to use it as a rolling graph of the hot-end temperature so that we can see how it is tracking towards the setpoint.
Recycler Controller Components
To turn a PET bottle (a standard soda bottle, like Pepsi, Coke or Mountain Dew) into filament, we need a way to melt the plastic. To do that, I’m going to be using a hot-end from an old 3D printer. This one is from an old Creality Ender 3 Pro.
An Arduino obviously can’t pass through enough power to heat the hot end by itself, so for that we’re going to be using an IRFZ44N Power MOSFET.
This will take a PWM signal from the Arduino and use it to control the power supplied through to the hot end so that we can maintain a set temperature. I’m also going to add an I2C OLED display to display the exact temperature and allow us to make changes to the temperature and the extruder motor speed.
A temperature sensing element, or thermistor, is also built into the hot end and we’ll use the signal from this to tell the Arduino what the actual temperature of the hot end is so that it knows whether to turn the heating element on or off.
Breadboard Test Circuit
As a starting point, I have made up the basic circuit on a breadboard to test that we’re actually able to control the hot end. I’ve also set up a thermal camera to watch the hot end so that we can visualise it heating up.
There are two main circuits here, one with the power Mosfet and some resistors to control the heating element and a second with a capacitor and resistor to read in the temperature.
As I said earlier, I’m going to be using the LED matrix on the Arduino as a means of indicating how the temperature of the hot end is tracking towards the setpoint, but I’ve also added an I2C OLED display which will give us an exact temperature readout, the temperature setpoint that we’re working towards and for now an indication of the PWM value being applied to the hot end.
I have also included a potentiometer to adjust the temperature setpoint between an upper and lower limit.
So let’s put power onto the circuit and we’ll hopefully be able to see how it heats up on the thermal camera. After about 30 seconds, we can already see the hot end head heating up.
I’ve used the last column of the LED matrix on the Arduino to indicate the current setpoint that the hot end is heating up to. The graph loops around, increasing as the temperature increases. It is quite slow as I’m only using a supply voltage of 12V where the hot end is rated at 24V.
On the OLED display, we can see the temperature setpoint, the current temperature and then the PWM output to the hot end. This stays at the maximum of while heating up and then as the temperature approaches the setpoint, it starts tapering off.
I’m using a PID control function to control the temperature of the hot end, so I’ve tuned the proportional, integral and derivative gain values to provide reasonably good tracking of the setpoint.
After a minute or so, we can now see that the hot end has heated up on the thermal camera.
Now that we’ve got the system working on the breadboard, let’s turn it into something a bit more permanent and reliable for the project.
Designing The Recycler Controller PCB
I drew up a schematic and designed a PCB for the recycler controller in the form of a shield to fit on top of the Arduino.
This shield has the heating element circuit, the thermistor circuit and a TMC2208 stepper motor driver to drive the extruder. It’s also got an I2C OLED display and a rotary pushbutton to make changes to the settings.
PCBWay then made them up for me. They have a really easy-to-use one-page order form to upload your files to and choose from a range of manufacturing options, with defaults preselected.
They’ll then make them up for you in 24hrs for just $5 for five, two-layer PCBs. They also offer a range of shipping options to fit your timing and budget. If you haven’t tried making your own PCBs for a project, I’d definitely recommend trying PCBWay out to really take your projects to the next really.
They arrive a few days later, I choose a white PCB with a black silkscreen, just because I haven’t tried this colour scheme before.
The PCB is designed to interface with the Arduino through some header pins which we’ll add to the underside.
Now we just need to get the components soldered onto the board.
Assembling The Controller PCB
I soldered the components to the board starting with the smaller components and moving on to the larger ones.
Because this first one is still a prototype board, I’m going to solder some female header strips onto the stepper motor driver and display pads so that I can remove the display and driver to use on the final board. I also soldered the header pins for the Arduino into place while plugged into the Arduino as this keeps them lined up properly.
And with the soldering done, it’s time for the moment of truth – to see if my board design and soldering is good. I plugged in the motor driver, jumper and display. I then screwed the heating element and thermistor into the terminals and plugged it in for programming.
Programming The Arduino Uno R4
I’ve put the sketch up in my Github repository. It’s just a simple Arduino sketch that runs a PID control loop to control the temperature of the hot end and pulses the stepper motor driver to control the motor. There is also some supporting code to drive the display and manage the input from the rotary push button.
Now let’s get it uploaded to the board and see how it works.
Testing The PET Recycler Controller
The board will run on the USB power from the computer, but won’t drive the motor or heat up the element, we need to add a 12V supply to the shield’s input to power those, so let’s get that plugged in.
And now the board is running. The actual temperature is shown in the first line and we can adjust the temperature setpoint using the rotary pushbutton.
The line below allows us to change the motor speed on the extruder and the bottom line lets us turn the extruder motor on, either running forward or in reverse. Once again I’m really impressed with how quiet the TMC2208 stepper motor driver is.
I’m really happy with how this has come out. For the final version, I might try and make the PCB a bit more compact, perhaps using a smaller form factor Arduino like the Pro Mini. For now, this will be great to get started building the mechanical parts for the PET bottle recycler.
If you’re interested in seeing the project progress, be sure to subscribe to my newsletter or YouTube channel. I’ve got a geared stepper motor and pulleys coming to try out and some cool ideas for a removable spool on the recycler that I can easily move across to my printer when the filament has been extruded.
I’m also really interested to see how a recycled PET version of my 3D printable Raspberry Pi case turns out. I have now completed the PET Bottle Recycler, you can find Part 2 here.
Let me know in the comments if you’ve got any suggestions for improvements that I can make to the final version which I’ll use on the recycler.
Title: I Turned The New LattePanda 3 Delta Into A Rugged Cyberdeck
Date: Wed, 17 Aug 2022 12:04:46 +0000
Desc:
Today we’re going to be using the new LattePanda 3 Delta from DF Robot to build a cyberdeck that packs up into a rugged, waterproof case that you can take with you almost anywhere. The LattePand 3 Delta is a pocket-sized single board computer with a powerful processor and a great combination of IO. It […]
Today we’re going to be using the new LattePanda 3 Delta from DF Robot to build a cyberdeck that packs up into a rugged, waterproof case that you can take with you almost anywhere.
The LattePand 3 Delta is a pocket-sized single board computer with a powerful processor and a great combination of IO. It can run a range of operating systems, like Windows 10 or 11 and distributions of Linux and it even has an onboard Arduino that provides 12 Analogue inputs, and 23 digital IO pins.
As the name suggests, this is the 3rd generation of LattePanda board and it features a few upgrades, the most significant being the new quad-core Intel N5105 processor running at 2.0Ghz, with a burst frequency of up to 2.9Ghz. It provides double the CPU performance of the previous LattePanda and three times the GPU performance.
Here’s my video on unboxing the LattePanda 3 Delta and building the cyberdeck, read on for the write-up:
The LattePanda 3 Delta comes in a black branded box with the board’s PCB and large heatsink and cooling fan as the main feature. It’s also got its specifications and contents listed on the side panels.
First up when we open the box is the LattePanda in a clear plastic case. In addition to the board, this case also includes a quick start guide and a small packet with the Bluetooth and WiFi antennas.
Beneath it are two power cables for different outlets (American and European), a set of nylon standoffs to mount it on and then the power adaptor.
The power adaptor is a branded 45W USB-C adaptor that supports power delivery up to 20V at 2.25A, so there is plenty of power for the LattePanda to work with. I like that the adaptor has a removable cable so you can replace it to suit your country’s power outlets. Or if it gets damaged.
In addition to the upgraded CPU, the LattePanda 3 Delta also has 8GB of LPDDR4 RAM, 64GB of eMMC storage, dual-band WiFi 6 and Bluetooth 5.2.
On the bottom of the board, we’ve got an M.2 B-Key port for a mobile network module or SATA SSD and an M.2 M-Key port for an add-on graphics card or NVME SSD. There’s also a sim and microSD card slot.
There are three ways to hook it up to a display, you can use the obvious HDMI port on the side or the eDP connectors on the bottom or drive a display through the USB type C port that’s also used for power. So you’ve got support for dual 4K monitors through the HDMI and USB C ports.
There are three USB 3 ports on the side, one USB3.2 Gen 2 port (on the left) that supports data transfer up to 10Gb/s and two USB3.2 Gen 1 ports (on the right).
On the opposite side is the USB type C port for power input, a 3.5mm audio jack, a gigabit Ethernet port and the HDMI port.
My favourite feature of the LattePanda 3 Delta is the onboard Arduino which gives you a lot of options for IO for your electronics projects. These pins along with a range of other interfacing pins are broken out on headers on either side of the cooling fan. The board has been designed with makers in mind, so it’s also got some additional features like a watchdog timer that’ll reboot your system if it detects that it is no longer responding or has crashed.
Booting It Up For The First Time
Now let’s install the antennas and get it booted up. The Bluetooth and WiFi antennas are physically identical and need to be installed on the pins alongside the small silver Intel adaptor on the bottom of the board.
Another nice feature of the LattePanda is that it can be powered via USB C or through the 12V JST PH2.0 4 Pin connector next to it. Their documentation also says that you can switch between the two while powered without interruption, which is pretty cool. The board will automatically switch to the supply that provides the highest voltage.
The onboard fan is impressively quiet. It’s PWM controlled so it ramps up when the CPU is loaded, but with low-intensity tasks, you can barely hear it.
Turning The LattePanda 3 Delta Into A Cyberdeck
Since the LattePanda 3 Delta is aimed at being a powerful mobile computer, I thought it would be great to turn it into a cyberdeck. So I’m going to do that by installing it in a Pelican case along with an HD touch display, a fold-up keyboard and a low-profile mouse.
As the brains of the cyberdeck, I wanted the LattePanda to be visible, rather than hidden behind the display or keyboard. I also want to provide a path for adequate airflow and I want to be able to access the IO pins for hooking up sensors and other external devices if I need them.
I want to maintain the Pelican case’s waterproof design, so I don’t want to drill holes in the sides for cables or ports. I’m going to rather reroute the ports on the board to ports on the main deck to plug into.
Making Up The Custom Components
I sketched up some parts to hold all of the components in Inkscape, these consist of the bottom deck with a holder for the LattePanda and divisions for the keyboard and mouse, and then the top deck to hold the display.
I then laser-cut the components from a sheet of 3mm mdf. You’ll need a sheet of about 400mm x 400mm to cut all of the components from. I laser cut the acrylic cover from some 3mm clear acrylic, 2mm acrylic will also work.
I glued the pieces together using some PVA wood glue, clamping them together while the glue dried. I first glued the port frames and magnet holder into place, then the edges of the keyboard and mouse holder and then finally glued the support box together.
Once the glue was dry, I gave the parts a coat of general purpose primer and then a few coats of satin black spray paint. I allowed the parts to dry for a few hours in the sun before moving on to assembling the cyberdeck.
Installing The Components In The Case
Now we can start putting the Cyberdeck together. I’m going to start by installing the display in the top holder.
To hold the display in place, I’m going to use some M3 x 12mm button head screws and nuts. I pushed a screw through the front panel and held it in place with a nut on the back. I then used a second nut as a spacer before the display and then held the display in place with another nut. I did this so that I could accurately control the depth of the display behind the front panel/frame so that it was flush.
We need two cables for the display panel, one HDMI cable for the display input and one micro-USB cable for power and the touch input.
These can be fed through the cutout at the bottom which will then run into the bottom of the case where the LattePanda is.
To mount the LattePanda, I’m going to use some 6mm high M3 nylon standoffs. I’m not using the ones that came with the LattePanda as I want to mount it close to the base board so that there is more room underneath the compartment for cables.
I bought a couple of extension cables so that I can reroute the ports to the surface of the cyberdeck rather than having to reach the sides of the LattePanda to plug cables in. These press into the cutouts in the MDF so that the front of the port is flush with the deck surface. The press fit is quite tight so that they’re doing most of the support work for the port.
We can then use a bit of hot glue on the back as an extra measure to hold them in place.
I cabled tied the extension leads together to neaten up the wiring and to make it easier to install into the base of the pelican case.
Now get them installed in our Pelican case.
The display panel fits into the top and we can then secure it with some hot glue. I tried to put the glue behind the panel as far as possible so that it’s less visible.
I fed the HDMI and USB cables through to the LattePanda and again cable tied these to some of the existing cables to hold them in place. We can then glue the bottom into place in the Pelican case as well.
To finish it off, let’s add the clear acrylic cover over the board. This has a cutout for the fan and I’m going to install four magnets in the corners to hold it in place on four magnets on the MDF panel. I’ve held all of these magnets in place with some UV glue.
That’s it, our Cyberdeck is now complete and ready to use.
Final Thoughts
The onboard Arduino allows you to hook up sensors, servos and displays directly to the IO pins, so it’s great for tinkering with electronics or deploying as a project solution. By adding some of DF Robots hats to the Arduino pins, you can easily hook up grove sensors, I2C displays and even use industrial communication protocols like RS232 or RS485.
The touch display is a little small to work with comfortably, but it’s a nice addition if you’re working in an area where the mouse is not practical to use.
I’ve hooked up the USB3.2 Gen 2 port to the top panel, so we’ve got a port that is perfect for use with high-speed devices, something like an SSD or a high-speed network adaptor would be ideal.
For additional IO you can also use a power delivery adaptor like this on the USB C port. This one adds an SD card reader, two more USB ports and an HDMI port while still allowing you to power the LattePanda through the same USB C port.
Overall I think the new LattePanda 3 Delta is an awesome little single-board computer. It has enough power to be used as a standalone computing device and, with the addition of the onboard Arduino, it’s perfect for makers to use for their electronics projects.
Let me know what you think of the new LattePanda Delta 3 in the comments section below. Also, let me know what you think of my cyberdeck and if there is anything you’d add or do differently.
Title: What Makes TMC2208 Stepper Motor Drivers Silent
Date: Thu, 30 Jun 2022 02:38:20 +0000
Desc:
A while ago I did a bit of an experiment to compare the sound level between TMC2208 and A4988 stepper motor drivers. At the time, A4988 drivers were more commonly used on 3D printers and other hobby CNC devices. Since then, most 3D printer and CNC laser manufacturers have moved towards replacing at least the […]
A while ago I did a bit of an experiment to compare the sound level between TMC2208 and A4988 stepper motor drivers. At the time, A4988 drivers were more commonly used on 3D printers and other hobby CNC devices. Since then, most 3D printer and CNC laser manufacturers have moved towards replacing at least the X and Y axis motors with the silent TMC2208 stepper motor driver or some other variant of silent motor driver. A question that has come up quite a lot in the video’s comments was how these drivers manage to drive the motors with such a significant sound reduction and if there was any trade-off.
So rather than just show you some diagrams, I thought I’d set the motor and drivers up again and try to show you through actual measurements.
Here’s my video of the test – read on for the write-up, although the video is the best way to hear the sound difference for yourself.
What You Need To Set Your Own Test Up
To set up your own test like I’ve done, you’ll need a few basic components:
I’m going to be using a Pokit multimeter to take current measurements using the oscilloscope function. You don’t need one of these if you just want to hear the sound difference or tinker with controlling the motors.
Understanding How Stepper Motors Work
There are some really good resources online to explain how stepper motors work, so I’m not going to go into too much detail. The simple explanation is that stepper motors have a number of poles and the driver energises the coils in the motor to align the rotor with these poles in a sequence to rotate it.
The simplest way to do this is to turn one pole on and the other off, causing the rotor to jump from one pole to another. This is simple to do electrically but causes the most noise as it induces a lot of vibration within the motor.
We can reduce the noise by rather slowly energising the one coil while de-energising the second coil so that we gently pass the rotor from one step to the next. The most optimal way to do this without producing any vibration is by producing a sinusoidal wave.
The better the stepper motor driver can replicate a sinusoidal waveform, the quieter it’s going to be able to run the motor. But replicating a sine wave perfectly requires more expensive electronics, so there is a bit of a tradeoff.
There are a few other sources of noise or humming in a stepper motor caused by things like magnetic fields, current ripple and chopper frequency. But their contribution is generally significantly less than this is.
So let’s have a look at the current waveform that the two drivers produce.
The TMC2208 Driver Test Setup and Code
I’ve got a similar setup to the last test with the two drivers hooked up in the same way to an Arduino.
The drivers are both connected to digital outputs 3 and 4 on the Arduino for step and direction control respectively. So we just need to plug our motor into the one we want to test. I’ve also added a 10K potentiometer, connected to analogue pin A0, to adjust the time delay between step pulses, which in turn will control the motor speed.
The Arduino sketch is very basic, just assigning the pin modes in the setup function and then looping through reading in the potentiometer position and stepping the motor with the measured time delay.
//The DIY Life
//Michael Klements
//30 April 2020
int stepPin = 3; //Define travel stepper motor step pin
int dirPin = 4; //Define travel stepper motor direction pin
int motSpeed = 5; //Initial motor speed (delay between pules, so a smaller delay is faster)
void setup()
{
pinMode(stepPin, OUTPUT); //Define pins and set direction
pinMode(dirPin, OUTPUT);
digitalWrite(dirPin, HIGH);
}
void loop()
{
motSpeed = map(analogRead(A0),0,1023,50,1); //Read in potentiometer value from A0, map to a delay between 1 and 50 milliseconds
digitalWrite(stepPin, HIGH); //Step the motor with the set delay
delay(motSpeed);
digitalWrite(stepPin, LOW);
delay(motSpeed);
}
Testing the Waveforms from the A4988 and TMC2208 Stepper Motor Drivers
We’re going to start with the A4988 driver by first taking a look at the sound level at different speeds.
The sound level throughout the range of speeds was an average of around 50-60dB. The sound was obviously being amplified by the wooden desk and wouldn’t be that loud with a proper vibration damping mount, but this way you get a good idea of the improvement.
To measure the waveform I’m going to use this Pokit multimeter and oscilloscope and I’m going to connect it in series with one of the motor coils to measure the current flowing through the motor coil.
In the video, you may notice that the motor sounds a bit weird when it’s connected and the oscilloscope isn’t measuring anything. This is because the oscilloscope opens the circuit when it isn’t taking readings. So the motor effectively only has one coil connected to the drive. You’ll see the shaft isn’t turning any more and is just sort of jumping in the same spot. So we’re only interested in the sound the motor makes during readings after I’ve pushed the red record button.
A4988 in Full Step Mode
With the A4988 driver running in standard full-step mode, you can quite clearly see that the driver is producing a very square wave.
It also doesn’t matter if we increase the motor speed, we still get a similar square wave that just repeats more often in the same timeframe. So this waveform is obviously quite far from a sine wave and therefore produces the most vibration within the motor, leading to the most noise being generated.
That’s not the end of the road for the A4988 driver, it can actually produce somewhat of a sine wave through microstepping.
Microstepping is essentially the ability for the driver to partially energise the coils to position the rotor in positions between the two poles, and it does so in a way that resembles a sine wave. So the most positions (microsteps) you can do between each pole, the better your sine wave is going to look.
The A4988 can do half, quarter, eighth or sixteenth step microstepping by pulling a combination of three pins high. So let’s see what those look like – we’ll start with half step mode.
A4988 in Half Step Mode
With the A4988 driver running in half step mode, we now got something that is starting to look a bit like a sine wave – but there is obviously still a lot of room for improvement.
The motor also sounded like it was running a little smoother than in full step mode. Looking at the waveform produced, you can clearly see two steps on our sine wave above and below 0.
A4988 in Eighth Step Mode
Now let’s try and improve upon our results with eighth step mode. So in this test, we should now have eight increments between the zero and the maximum on our sine wave.
The first thing you’ll notice is that the sine wave doesn’t fit into our timeframe anymore. That’s because the driver now only moves 1 micro step for each pulse, so our motor is effectively moving 8 times slower than it was in full step mode. So, for example, a motor with 200 steps per revolution running in eighth step mode will now have 1600 steps per revolution.
If we adjust the time scale, we can see our full sine wave and we’ll also notice that our motor is again moving smoother, and slower than it was when in half step mode.
A4988 in Sixteenth Step Mode
Lastly lets try sixteenth step mode, which is the most that this A4988 driver can do.
You’ll again notice that the motor is moving half as fast as eight step mode and we’re getting a wave that’s now looking a lot like a sine wave.
That’s now the end of the road for our A4988 driver. The micro stepping has made it run much smoother and a bit quieter, but it’s still quite noisy. So let’s swap over to our TMC2208 driver now.
TMC2208 Running In Legacy Mode
For compatibility with the A4988 driver’s code, we’re going to be running the TMC2208 driver in Legacy Mode. This mode essentially allows the driver to act as a drop-in replacement for the A4988 driver.
If you watched the video, at this stage you probably hadn’t noticed that the motor was running. That’s obviously a significant improvement over the A4988 drivers that produced around 50-60dB. The TMC2208 driver operates nearly silently, even when you change the speed.
A big part of how it does this is that the TMC drivers produce 256 microsteps, so sixteen times more than what the A4988 drivers do.
Let’s now hook up the oscilloscope and see what the waveform look like.
As with the previous test, the motor makes a bit of noise when the oscilloscope isn’t taking measurements as its only got a single pole connected, so it’s jumping back and fourth around the same pole. It does however go silent again when the oscilloscope is running.
As with the A4988 driver, if we change up the speed we still get the same smooth sine wave, it just repeats more often in the same time interval.
So you can see that’s a significantly improved sine wave over even the best one that the A4988 driver was able to produce.
Finals Thoughts on the TMC2208 Motor Driver Test
So now you have a basic understanding of what the TMC2208 drivers do differently to run almost silently.
As for any drawbacks. There are two primary ones.
One is a slight reduction in incremental torque, which is not usually an issue unless you’re operating near the motors torque limitations.
The second is not so much to do with the motor but to do with the microcontroller telling the driver what to do. As I’ve mentioned earlier, microstepping requires more pulses from the microcontroller to move the motor a full step. So, running in sixteenth step mode requires your microcontroller to output 16 times more pulses than it would need to in full-step mode. If you’re doing this across multiple motors or while doing other tasks, your controller quickly gets bogged down just keeping the motors running and may not be able to keep up.
Out of interest, during the tests, I was running the drivers with a 12V supply to the motor.
That’s it for today, I hope you’ve learned something and found this explanation useful. Let me know in the comments section what you’ve used these drivers for and check out some of my other projects for ideas.
Title: Meet Bittle, an Advanced Open-Source Robot Dog by Petoi
Date: Thu, 26 May 2022 11:41:52 +0000
Desc:
This is Bittle, a ready-to-run advanced open-source robot dog by Petoi that is based on the OpenCat robotic pet framework. If you’ve ever wanted to explore building your own robotic quadruped, but have felt overwhelmed by the amount of information and options available or have been at a loss with where to start, then Bittle […]
This is Bittle, a ready-to-run advanced open-source robot dog by Petoi that is based on the OpenCat robotic pet framework.
If you’ve ever wanted to explore building your own robotic quadruped, but have felt overwhelmed by the amount of information and options available or have been at a loss with where to start, then Bittle is the perfect product for you. So in this review, we’ll take a look at what Bittle is, how it works and what it can be used for.
Have a look at my video review to see Bittle in action, or read on for the written review:
Where To Get Bittle
Bittle is primarily available for purchase online through Petoi’s website or their Amazon store and comes in three packages:
Base Kit – Includes all of the parts required to assemble your own robot dog
Pre-assembled Kit – All of the components included in the base kit, but pre-assembled and ready-to-run
Developer Kit – The pre-assembled kit with 10 replacement servos and an extra battery pack
Petoi have sent me the pre-assembled kit to try out and share with you, so that’s the kit that we’ll be taking a look at in this review.
What’s Included In The Box
The base kit comes in a branded box with clear protective inserts to hold the included components in place.
Included is Bittle, along with a battery pack with an integrated charging circuit, and then an accessories kit.
The accessory kit includes an infrared remote, a spare servo and some screws, a calibration tool, a small screwdriver and a pack of modules that allow communication with Bittle. These modules include a USB programming module, a Bluetooth module and a WiFi module.
Assembling Bittle
If you’ve bought the base kit then you’ll need to do some assembly work before you can start using Bittle, including making up the legs, mounting the servos in place at the joints and connecting the wiring through to the control board that makes up Bittle’s body.
If you’ve got the pre-assembled kit, like I do, then you’ll just need to snap the head into place and plug in the battery. You’ll also need to move the servos to the correct starting position as they’re packed with the joints bent in the opposite direction to make Bittle more compact.
The body and components feel like they’re well made and are good quality. Part of what makes this robot dog look great and function so well is that they’ve taken the time to design and manufacture custom parts – like the servo arms that have been specifically designed to join the leg components with the inclusion of a spring to provide a bit of shock absorption.
Controlling Bittle With The Infrared Remote
Once assembled, the included 21 button IR (infrared) remote allows you to start playing around with some of the core functions of Bittle right away. It’ll allow you to walk, run, turn and do a couple of pre-programmed skills right out of the box using a small infrared receiver on Bittle’s back.
The arrow keys control Bittl’s walking/movement directions along with speed settings and 11 skill buttons allow you to execute some of the pre-programmed skills.
Getting the first movement out of Bittle is as easy as plugging in the battery pack and then aiming the remote at his back when you press one of the buttons.
Here’s Bittle waving hello…
Exploring Bittle’s Control Board
Once you’ve tried out Bittle using the IR remote, you can either dive right in to coding your own skills or you can download the mobile app (for iOS or Android) to unlock some additional functionality, including calibration and customized commands. Either way, you’ll need to remove the black cover on the top to get to the control board to plug in one of the communication modules.
Under the cover is a custom-designed controller called NyBoard with an integrated Atmega328P chip, PCA9685 PWM servo driver, MPU6050 motion sensor, an infrared sensor and a number of ports and interfaces to add sensors and devices to.
There appears to have been some revisions made to this board as some of the versions I’ve seen online have a row of RGB LEDs along one side. The core functionality however seems to be largely the same.
I really like that they haven’t trimmed this board down to only suit the functionality and IO that the standard Bittle configuration requires. Leaving additional servo outputs, I2C interfaces and digital IO ports gives you a lot of options to build upon the basic design and make your own modifications and additions to the robot dog. This along with the open-source software means that you’re getting a development platform to learn on, build upon and explore, rather than just a finished product that you’ll probably get bored with after a couple of weeks. Part of the fun in building your own quadruped or robotic pet is that you never really finish it, there is always something else you can add, tune or modify and Bittle retains this – being a platform to build upon rather than just being a finished product.
Coding Routines, Skills And Features
Coding is best done through the Arduino IDE, and you’ll need to use the included communication module to allow your computer to program Bittle. This allows you to plug Bittle into your computer using the included micro-USB cable.
If you’re not comfortable with the Arduino IDE, you can use Python as an alternative. They even have a drag-and-drop coding interface for beginners. So there really is something for every level of experience.
Their documentation is really good and covers everything you may need to do to use and maintain Bittle as well as documentation and instructions for adding your own sensors, skills and features.
Calibrating Bittle’s Leg Positions
In Petoi’s documentation, they mention that the pre-assembled kit is only coarsely tuned. So they recommend running through the calibration process for best results. I’m going to run through the calibration sequence using their iOS app. To use the app, I need to plug in the Bluetooth communication module to allow my phone to communicate with Bittle.
To help out with the calibration process, I also 3D printed their stand with the calibration arms built into it.
We can then open up the app to pair Bittle to the phone and start the calibration process. If you head over to calibration mode, the legs will move to their calibration positions and you can then make adjustments to their positions.
Course adjustment is made by removing the arm from the servo and aligning it as best you can. You’ll need to remove the screw that holds the servo arm to the servo in order to remove it.
Fine adjustment is then done in the app until Bittle’s legs are at perfect 90-degree angles, by aligning the legs with the stand or with the included calibration tool.
You can select each join in the image at the top of the screen and then make adjustments to it using the + and – signs. It’ll only let you just the servo between an upper and lower limit before asking you to rather make a course adjustment.
The stand is also useful for trying out new movements and testing commands without having to worry about where Bittle is going or if it’s going to fall off your desk.
Working On Or Repairing Bittle
All of Bittle’s components either screw or snap into place. So it’s super easy to take apart if you need to swap out a servo, change a spring or make changes to the wiring or control board. You just need a screwdriver and you’re good to go.
If you’re doing a lot of work on it then you’ll want to get a better screwdriver than what’s included with the kit as it’s a bit small and cumbersome to work with.
The wiring is also all held in place and partially hidden by snap-on covers over the legs. These help ensure that they don’t interfere with the joint movements and also keep Bittle looking neat.
Using The iOS App To Control Bittle
We’ve already paired the app with Bittle in the calibration process, so now let’s try some customized commands. Bittle has a number of controls and skills that are preprogrammed, these can be set up to run individually or as part of routines using text inputs through the app or the Arduino IDE.
So let’s try one of them. The code to look or check around is ck, so we type in kck to run the command and we can give the quick command a name “Look Around”.
We now have a quick button to look around, which he’ll do each time we push the button.
We can try commands that aren’t available through the infrared remote, like play dead, or march on the spot. We can also string commands together to create routines and behaviour sequences.
The onboard IMU knows the orientation of Bittle, so if he stumbles or falls over, it will automatically activate a routine to flip him back over and onto his feet.
Bittle seems to manage quite well on most flat surfaces. It walks best on surfaces that are a little bit rough, like wood or concrete, but struggles on very uneven or loose surfaces like stones, sand or pebbles.
You can also use the IMU to allow Bittle to balance on uneven surfaces or when pushed or bumped.
Final Thoughts on Bittle
Petoi have clearly put a lot of time and effort into creating a good quality product that is great for a range of experience levels. If you’ve never programmed anything in your life, you’ll still be able to get started with the basic drag-and-drop interface, and the open-source code allows experienced programmers to make any changes they’d like to build upon and improve Bittle.
They also have a number of external sensors already available and are working on some additional ones to add functionality to Bittle.
These include sensors like obstacle avoidance and object tracking through a smart camera. So definitely check out the sensors if you’ve already got your own Bittle, and visit their web store if you’d like to get your own robot dog or cat.
Let me know what you think of Bittle in the comments section below and let me know if you have any project ideas that you’d like to see me try out with him.
Title: 3D Printed Wireless Joystick Controlled Animatronic Eyes
Date: Tue, 12 Apr 2022 12:03:43 +0000
Desc:
In this project, we’re going to be making a set of wirelessly controlled animatronic eyes. I’ve been wanting to do this project for a while, so when Quantum Integration launched their new Motor & Servo Driver board, this project immediately came to mind. Their new board is based on the PCA9685 driver chip, so you […]
In this project, we’re going to be making a set of wirelessly controlled animatronic eyes. I’ve been wanting to do this project for a while, so when Quantum Integration launched their new Motor & Servo Driver board, this project immediately came to mind. Their new board is based on the PCA9685 driver chip, so you can also build a similar setup using an ESP32 or Arduino if you’d like.
Here’s my video of the build, read on for the write-up:
Some of the above parts are affiliate links. By purchasing products through the above links, you’ll be supporting this channel, with no additional cost to you.
Designing & Printing The Animatronic Eye Components
I started out by drawing up a 3D model in Fusion 360. I knew roughly what I wanted the final set of eyes to look like, but naturally had to make a few tweaks along the way.
I wanted the eyes to be able to move left and right as well as up and down, so I needed two servos for each of them. I also wanted to have eyelids that could blink, and in future maybe wink independently, so I needed another two servos for those movements as well. At the centre of each eyeball is a small brass universal joint and I’m going to use some cotton thread to connect each eyeball to the servos rather than using solid pushrods.
I had to go through a couple of trial prints to see what tolerances and clearances worked well. My first set of eyeballs was too big and got caught on the eyelids, but making them too small also left large weird looking gaps between the eyes and the eyelids, so that was also no good.
I also had to split the base to allow the screws that hold the eyelids to be installed so close together.
But eventually, I had a set of 3D prints that could be assembled into a working set of eyes.
If you’d like to 3D print your own eyes, the 3D model files for my projects are now available to my Patrons on Patreon or on my Etsy store.
Assembling The Eye Components
To assemble the eyes, we just need two small universal joints for 3mm shafts and some M2 screws and nuts.
These are the ones that were locally available for me. I’ve linked very similar ones in the parts list, but you might need to make some minor adjustments to fit the ones that are available to you. You’ll also some cotton thread or thin string to connect the eyeballs to the servos.
Let’s start by adding the thread to the eyeballs. We just need to glue a 10cm length of thread to four opposing inside edges of each eyeball. The eyeballs are round and don’t have any holes in them, so it doesn’t matter which four locations you choose, as long as they are equally spaced. I used a drop of superglue on the end of each length of thread.
We can then press the universal joints into the 3D printed bases. Mine are a tight fit, but if yours are a bit loose you can secure them with a little bit of glue as well. Just make sure that you don’t get glue in the universal joint’s pins or it’ll lock up.
Then we can push each of the eyeballs onto the universal joints as well.
Now let’s add our eyelids. These pivot around some M2 screws in the holder on either side of each eye. Prepare the base by screwing these M2 screws into each side, with just one or two turns of thread exposed on the inside.
A 3D printed pushrod is then going to be connected between each eyelid and the servo behind it to open and close it. The top pushrod is the longer one with a small extension on it to connect to the bottom pushrod.
The screws need to be adjusted a bit, you want them tight enough that they hold the components in place, but still allow free movement. You might need to iteratively tighten or loosen them to get them right.
Place the set of eyelids between the screws on the base and slowly tighten them until the eyelids are held in place. Make sure that the screws don’t protrude too far on the inside of the eyelids and touch the eyeballs.
The pushrod should be free and easy to gently push and pull to open and close the eyelids.
Once we have our eyes and eyelids assembled, we can add our servos. I’m using 6 micro servos, three for each eye.
These are just glued into place on their supporting faces as they’re shown in the model. Install the servos on both base assemblies with the second eye being a mirror image of the first.
Lastly, tie the cotton thread to your two front servos. This was quite a fiddly job – make sure that you tie them off so that there is a bit of tension on the eye to stop it from wobbling. Also, don’t screw the white control arms onto the servos yet as you might need to adjust them once the servos are powered and centred.
With that done, the eyes are now complete and are ready to add the electronics to.
Connecting The Electronics
As I’m using the Quantum Integration system, I need a build base to wirelessly control the eyes and I’m going to use one of their four new DIY kits, the Motor and Servo Driver to drive the servos.
The Motor & Servo driver board allows you to control up to 8 servos and 4 motors with the I2C interface on your builder base, so it’s perfect for the 6 servos used in our project. The boards come as a kit with all of the surface-mounted components pre-soldered, you just need to add the through-hole ones.
Once the board is assembled, we can pair up the driver and builder base and plug in our servos. As I mentioned earlier, the driver uses the I2C interface, so we just need to make connections between the 5V, GND, SCL and SDA pins on each. The builder base is going to get its power through the servo driver board, so we only need to supply power to the driver board, which we do through the 5V and GND pins on the left of the board.
Note: You don’t actually need the jumper between 5V and VM that I’ve used as the servos are powered through the 5V supply. VM only supplies power for the DC motor outputs.
Then just plug the servos into the driver board and we can then move on to programming it. I’ve connected the servos on outputs 1-6 as below:
1 – Left Eye – Left Right
2 – Left Eye – Up Down
3 – Left Eye – Blink
4 – Right Eye – Left Right
5 – Right Eye – Up Down
6 – Right Eye – Blink
Creating The App and Firmware
Now let’s log into our Q-Server and have a look at the App to control the eyes.
We’d got two joystick inputs on the left, one for the left stick and one for the right stick. The x and y axis on the left stick will control the eye movement and the button on the right stick will control the blinking.
These then feed into the three controls on our web dashboard, so that we can control the eyes from the web interface as well. We have two analogue sliders, one for the left and right movement and one for the up and down movement, and then a button to blink.
The web controls then feed into some ranging blocks which set directions and travel limits for the servos and then finally feed into each of the six servos on the right. So we have the left and right movement servos at the top, the up and down movement servos in the middle and the blinking servos at the bottom.
Lastly, before we run the app, we need to create our builder base firmware to tell the builder base which servo is connected to which driver output. These are identified by a channel number for each servo object as follows:
Servo 1 – Channel 3
Servo 2 – Channel 2
Servo 3 – Channel 1
Servo 4 – Channel 0
Servo 5 – Channel 15
Servo 6 – Channel 14
I started out by only enabling a single eye to test the App and firmware. It looked like the eye movement was set up nicely and the blinking worked well too.
We can now finish off the build by screwing the two bases together and marking the eyeballs with a pupil using a black Sharpie. If you’ve printed the eyeballs with the back surface on the print bed then the concentric circles of each layer can be used as a guide for marking the pupils.
The Completed Eyes & Final Thoughts
Overall I’m quite impressed with how well these animatronic eyes turned out. The blinking works better than I expected it, and the cotton thread to the eyes holds up really well as a cheaper alternative to solid pushrods. I definitely think that solid pushrods are a more robust solution, but these work perfectly for a short term solution.
Let me know what you think of them in the comments section below.
Title: All-In-One Indoor Air Quality Monitor With CO2 Sensor
Date: Thu, 10 Mar 2022 11:23:35 +0000
Desc:
In this project, we’re going to be making an all-in-one indoor air quality monitor with an IOT dashboard using an infrared CO2 sensor from DFRobot and a BME280 environment sensor. CO2 is a colourless and odourless gas that is a by-product of combustion, produced by gas heaters and stoves, and also by metabolic processes in […]
In this project, we’re going to be making an all-in-one indoor air quality monitor with an IOT dashboard using an infrared CO2 sensor from DFRobot and a BME280 environment sensor.
CO2 is a colourless and odourless gas that is a by-product of combustion, produced by gas heaters and stoves, and also by metabolic processes in humans and animals. It typically exists in a concentration of around 300-400 ppm (parts per million) outdoors, but when the average adult exhales, they can produce a concentration almost 100 times greater than this. With poor ventilation, the CO2 concentration in an indoor space can build up quite quickly. Early signs of increased concentrations of CO2 include the inability to concentrate and tiredness, while high concentrations of CO2 can lead to headaches, dizziness and even difficulty breathing, and eventually loss of consciousness.
Ideally, we’d like to keep the concentration of CO2 in an indoor environment below 1,000 ppm, anything above this starts to lead to drowsiness and impaired concentration and the upper limit for what is considered to be safe is 5,000 ppm – so that’s actually the upper limit for our infrared CO2 sensor – since it has been specifically designed for this sort of use.
Our CO2 sensor uses infrared light to measure the concentration of CO2 within the air and then produces a 0-2V analogue signal.
We’re going to read this signal using an ESP32 based microcontroller by DFRobot called a Firebeetle board. I’ve used one of these boards previously for my weather station because they have a great range of IO, integrated WiFi and Bluetooth connectivity and they’re designed to be power efficient. They even include a battery charging circuit and a JST connector plug for a lithium-ion or lithium-polymer battery.
I’m going to be using the board’s WiFi connectivity to send the measured data to Prometheus, which is an online time-series database, and I’ll then be creating a dashboard to view the data using Grafana. This dashboard will be able to be accessed on any internet-connected device with a browser and will allow time-based trends of the data to be created. I also want to include some local indication on the device so I’m going to be doing that with an I2C OLED display.
Finally, since I’ve already got a microcontroller and display, it would be good to measure some other environment metrics as well, so I’m going to also include a BME280 temperature, pressure and humidity sensor.
Watch my video of the build here, or read on for the full write-up:
What you Need For This Project
To complete this project, you’ll need the following main components in addition to basic wiring, header pins etc.:
My goal is to build all of the components into a single desktop or wall-mountable device that I can power using a USB outlet and move around the house if I want to.
I quite like the futuristic look of the CO2 sensor, so I’m going to make the front cover of the housing clear so that we can see into it, and see the microcontroller, display and sensors. So for this reason it would be good to mount the four boards in a flat, rectangular layout as shown below.
I designed the case in Fusion360, using a simple layout with 3D printed standoffs to mount each of the four components.
I then added a screw on a clear acrylic cover to the front. I also added some ventilation holes along the top and a cutout for the USB cable on the side.
I 3D printed the case in black PLA. It’s just a single print and I didn’t need to add any supports as the cutouts are relatively small and are rounded at the corners. This depends on your printer’s abilities but I think most printers would cope with these small overhangs without requiring any print supports.
I laser cut the front cover from 2mm clear acrylic.
The front cover is a basic rectangular shape with the same profile as the housing and I’ve added a cutout for the CO2 sensor and one for the BME280 sensor so that they’re both exposed to the outside air.
Making Up A Wiring Harness
Before I install all of the components into the case, I’m going to make up a wiring harness to connect them together. The display and BME280 sensor both use the I2C interface to send and receive data and the CO2 sensor just needs a power supply and a connection to one of the analogue inputs.
Here is a basic wiring diagram for the connections:
I initially used analogue input A4, shown in the subsequent photos, but I moved this to A0 as A4 doesn’t work when using WiFi on the Firebeetle board.
One important note is that the CO2 sensor requires a 5V supply. Its analogue output is compatible with 3.3V microcontrollers as it doesn’t go above 2.0V, but it still requires 5V to power it. For this reason, I’m going to be powering the sensor with 5V directly from the USB supply, while the display and BME280 sensor will be powered using 3.3V from the Firebeetle’s onboard regulator.
I made the wiring harness up using coloured ribbon cable as well as male and female header pins and I added some coloured heat shrink over the soldered connections.
Installing The Components In The Case
With the standoffs already 3D printed on the housing, it’s relatively simple to install all of the components in the case.
I’m going to start by using some M3 brass inserts to make the M3 screws that hold the lid in place a bit more durable. These are just melted into place in the printed pockets using a soldering iron which I’ve set to 200 degrees – which is about the same temperature as the PLA filament is printed at.
I’ll use a range of small screws to hold the boards in place, mostly M2.5 x 6mm screws, with the wiring running below the boards as far as possible. Make sure that you plug your connectors onto the correct pins and that they’re the right way around or your might damage your boards when you supply power to them.
With that all done, we can now close up the case using four M3x8mm button head screws and move on to programing our Firebeetle board.
Programming The Firebeetle ESP32-E Board
I’ve written up an Arduino sketch that takes readings from each of the sensors every minute and then updates the display and uploads the data to Prometheus.
You can download the code from my Indoor Air Quality Monitor Github repository.
The posting to Prometheus part of the code is largely based on the example provided on the Grafana Cloud information page, which is linked to a GitHub repository called IoT with Arduino and Grafana.
There is a bit of setup involved in the code as you’ll need to set up your WiFi details as well as your Prometheus configuration information. The IoT with Arduino and Grafana repository explains this all in detail with screenshots, so head over to their repository if you need some additional help. Essentially, you need to update the config.h file to include your WiFi network name and password as well as your Grafana Cloud Remote Write Endpoint address, your Username and your API Key.
Once that is all done, you can upload the sketch and you should then start seeing some information being displayed on the OLED display and on your serial monitor.
Using The Indoor Air Quality Monitor
The CO2 sensor needs around 3-5 minutes to pre-heat, during which time it’ll give a reading of about 0.2V and it’ll then start producing a voltage between 0.4V and 2.0V, which corresponds to a CO2 concentration of 0-5000ppm.
I’ve set up the code to recognize these voltages and to indicate that the CO2 sensor is preheating before a reading is displayed.
While preheating, we can still see that we’ve got readings from our BME280 sensor for the environment temperature, pressure and humidity.
After about 3 minutes, the CO2 concentration has now shown up on the display.
I’ve created a Grafana dashboard with an instantaneous gauge for each of the four metrics along the top and then a time-based trend below them.
The CO2 sensor hasn’t really picked up many spikes in CO2 concentration but it is currently being used in a fairly large living space and we tend to keep some windows or doors open during the day for fresh air.
You can read up a bit more on creating dashboards and visualisations in Grafana from my full Grafana tutorial.
So we’ve now got a portable indoor air quality monitor that we can leave in any room to monitor the air quality and we can access remote logs and trends of the data through any internet-connected browser.
Let me know what you think of my Air Quality Monitor in the comments section and let me know if there is anything you’d add to it or change.
Title: DIY 4G Air Quality and Environment Monitor – Record Data Anywhere
Date: Tue, 14 Dec 2021 12:20:22 +0000
Desc:
In this project, we’re going to use the Maduino Zero 4G by Makerfabs to make an air quality and environment monitor that transmits the recorded data wirelessly over a 4G mobile network to a Thingspeak dashboard. Watch my video of the build or read on for the step by step instructions: The Makerfabs Maduino Zero […]
In this project, we’re going to use the Maduino Zero 4G by Makerfabs to make an air quality and environment monitor that transmits the recorded data wirelessly over a 4G mobile network to a Thingspeak dashboard.
Watch my video of the build or read on for the step by step instructions:
The Makerfabs Maduino Zero 4G LTE
A couple of weeks ago, Makerfabs sent me their Open Wind Station to try out. It’s a compact Arduino compatible device that records temperature, humidity, pressure, wind speed and air quality information and uses a mobile network to transmit the data to a remote database or cloud service.
Unfortunately the built in A9G chip only works on a 2G mobile network, all of which have been decommissioned in Australia for a few years now.
But fortunately, they have been working on an alternative – the Maduino Zero 4G LTE. This new board uses a more modern SIM7600 chip which operates on a 4G network. They say can reach upload speeds of up to 50Mbps and download speeds of 150Mbps.
The best part about this board is that it is also a fully programmable Arduino compatible microcontroller with 12 digital IO pins, 6 analogue pins and an I2C interface. So it’s perfect for projects that require data to be sent to or from a remote location. You can set this up anywhere that you have 4G coverage and have full control over it from any internet connected device.
Some of the Maduino’s features include:
LTE Cat-4, with upload speed of up to 50 Mbps and download speed of up to 150 Mbps
GNSS positioning
Arduino IDE compatible
Dual USB type-C ports, one for MCU programming/UART, the 2nd for SIM7600 USB connection
Some of the above parts are affiliate links. By purchasing products through the above links, you’ll be supporting this blog, with no additional cost to you.
Testing The Maduino Zero 4G And Sensors
Now that we’ve taken a look at the Maduino Zero 4G, we’re going to use it to make an air quality and environment monitor. I thought it would be good to take the wind and air quality sensors from the Open Wind Station and integrate these with the new Maduino Zero 4G board.
I’m also going to add some additional grove DHT11 and BMP280 sensors to create a truly wireless air quality and environment monitor. These two sensors are just taken from the Grove Beginner Kit and already have the supporting electronics built into them so they just have a three or four wire interface to the Arduino.
We also need to add some pin headers to the Maduino board so that we can plug our sensors into them. The board comes with male pins but I’d prefer to use female pins so that there are fewer exposed pins within the case when it is complete.
I just cut these from some lengths of female header strips and soldered them into place on the top side of the board.
I’m going to do a trial assembly of the components on a breadboard to start with because the original sensors operate on 5V while the Maduino Zero 4G operates on 3.3V, so there is a chance that they won’t even work with it.
I’ve connected the sensors to the same pins that they were connected to on the Open Wind Station so that the original code doesn’t need to be completely re-written for the new system.
The sensor connections are:
Anemometer
5V – 3V3
GND – GND
Data – A0
DHT11
VCC – 3V3
GND – GND
Data – D13
BMP280
GND – GND
VCC – 3V3
SCL – SCL
SDA – SDA
PM2.5
Sens VCC – 3V3
Sens GND – GND
Sens Data – A1
LED VCC – 3V3
LED GND – GND
LED On/Off – D10
Now we just need to add the sim card to the tray at the back and plug the three antennas into the connectors on the front.
We’ve got it all assembled, now we just need to program it.
Programming The Maduino Zero 4G
I’ve created a sketch using two examples sets of code, one being the 4G example code that Makerfabs have put together for the Maduino Zero 4G and the other being the original code for the Open Wind Station.
Here is the code if you’d like to try it on your Maduino:
The original code has the calculations and settings for the sensors, although I suspect that I might need to re-calibrate these at some stage as my change in cycle time will change the wind speed calculation and the lower voltage probably affects the brightness of the air quality sensor’s LED and its analogue output.
In any case, running the sketch on the breadboard setup seems to work correctly and I’m able to see some values from the sensors, so that looks promising.
I have created a new Thingspeak channel with it’s own write API key which will need to be copied into the sketch. This key allows the Arduino to write the data to the Thingspeak channel and it can then be accessed through any internet connected browser.
I added a gauge and chart widget for each of the fields/sensors and scaled them according to the expected values.
If you’d like a more detailed look into how to publish data to Thingspeak, have a look at my 3D Printed Weather Station project. The sketch in this project uses a more user-friendly Thingspeak library.
3D Printing A Case To Hold The Components
Now that we’ve got the electronics working, we need something to mount it in. So, I’m going to use Tinkercad to design a case to hold the board and sensors in such a way that it can be mounted onto a 25mm pole.
The case consists of 3 parts, the main body, a cover plate and a bracket. I’ve also made up a bracket to mount the anemometer onto the end of the pole. The components were all printed in PLA on my Ender 3 V2.
Assembling The Air Quality & Environment Monitor
Let’s start by installing the bracket onto the back of the case. The bracket is held using two M4x8mm screws and nuts. The nuts fit snugly into the cavities in the bracket. A small M3x12mm screw is then used to lock the bracket into place on the pole by pressing against an M3 nut in the cavity on the inside of the bracket.
The board is then held in place with some M2 screws and the sensors and components then fit in around it.
I was initially going to add the original battery from the Open Winder Station, but it’s only 1,000mAh, and I suspect this 4G board is going to draw a lot more power than the original one, so this probably won’t provide much benefit. I’ll instead use a USB cable to power it from a 30,000mAh power bank.
I’m going to be using this in a partially covered area, so it doesn’t need to be rain proof, but I designed a couple of vent covers just in case it does get a bit wet if there is a lot of wind. I just stuck these on with some epoxy adhesive.
The anemometer is mounted onto the end of the pole using the 3D printed bracket, which is also held in place with an M3x12mm screw and nut.
We can then slide the main control board onto the pole underneath it and tighten the M3 screw to lock it in position.
The anemometer is then plugged in using the 4 pin connector.
Testing The Maduino Zero 4G Air Quality & Environment Monitor
I decided to first test the power consumption to see how long it would last on my power bank. My USB power meter showed that it used around half an amp fairly consistently.
So my 30,000mAh power bank should power it for about 40 hours. If you’re going to be using it for longer periods of time then you’ll probably need to use a mains adaptor or solar power to keep it running.
Now let’s get it mounted outside and start recording some data.
After a few hours it looks like we’re consistently getting data from all of the sensors.
The air quality reading definitely looks to be a bit higher than what I was expecting, so I’ll need to work on calibrating that.
The wind speeds looks about right when I compared it to my other anemometer after a couple of days of use.
Let me know what you think of the Maduino Zero 4G in the comments section below. Do you have any project ideas for a 4G Arduino?
Speaking of other ideas, you can actually also use this device to provide a 4G internet connection to your computer or Raspberry Pi and you can use it as a fully functional mobile phone to make calls. So there are a lot of options for it.
This is my dashboard for my 3D Printed IoT Weather Station project, you can build your own by following my build guide. You can also view the data on my public Thingspeak Channel. Temperature Humidity Barometric Pressure Wind Speed Light Level
Title: I Upgraded My 3D Printed Weather Station Using Your Suggestions
Date: Wed, 27 Oct 2021 10:52:33 +0000
Desc:
Today we’re going to be making some upgrades to my previously built IoT weather station using suggestions that you guys made in the comments section. We’ll see how well the weather station performs after the upgrades and I’ve included a link to the public Thingspeak channel, so you can have a look at the most […]
Today we’re going to be making some upgrades to my previously built IoT weather station using suggestions that you guys made in the comments section. We’ll see how well the weather station performs after the upgrades and I’ve included a link to the public Thingspeak channel, so you can have a look at the most recently recorded data.
Here’s my video of the upgrades I’ve made, read on for the written guide:
Upgrade Components Needed
In addition to the components that we’re going to re-use from the last project, you’ll need the following:
Let’s start off by taking a look at what hardware we’re going to be replacing within the original weather station.
The original build used a DHT11 temperature and humidity sensor. Quite a few people mentioned that this sensor isn’t particularly accurate and is quite slow.
Most suggested replacing it with a BME280 sensor, so that’s what we’re going to do. This sensor measures temperature, humidity and pressure, so I can also remove the separate pressure sensor from my original build. I’ll leave the light sensor at the top in place.
The next change that was suggested was again made by a number of people, and that was to replace the reed switch on the anemometer, or wind speed sensor, with a Hall Effect sensor. The reed switch, being a mechanical device, has a limited number of operating cycles before it wears out. Given that it could be switching up to 150,000 times a day, it probably won’t take too long to wear out either.
I haven’t used a Hall Effect sensor on a project before, and there are quite a few different options available, so the one I choose was an Allegro A3213. This sensor is polarity independent and has a latched digital output, so it’s quite a good fit as a replacement for a reed switch.
The final hardware change that I’m going to make is to replace the original 1850 lithium-ion cell with a higher capacity 3000mAh lithium polymer cell. This cell will give the station about 30-50% more energy storage capacity, so it’ll be able to run longer between charges. It also has built-in overcharge and over-discharge protection.
While we’re on the topic of powering the weather station, I’m going to be adding a solar panel and solar power management board nearby to re-charge the battery. This isn’t a modification to the actual weather station as such but is another useful addition.
Replacing The Weather Station’s Sensors & Battery
I’m going to install the BME280 module with the sensor facing towards the stand. This allows me to re-use the original sensor’s mounting holes and I won’t have to modify the sensor pints. This also shields it from any direct sunlight that manages to get into the housing and gives it a bit more protection from moisture. The sensor is still spaced slightly away from the stand, so there aren’t any pockets of air trapped around it.
Replacing the reed switch with the Hall Effect sensor is a bit more involved. I have to first remove the reed switch, which I moulded in place with resin because I didn’t intend to ever remove it. I also didn’t want to have to print a whole new housing just for the new sensor.
After a couple of failed attempts, a drill eventually worked to crack the switch’s glass tube and I could then pull out all of the pieces. I also cracked the top of the housing in the process, but fortunately, resin prints repair quite well with additional resin, so that’ll be an easy fix.
I soldered some wiring to the sensor before installing it in the housing so that I can again pour some resin around it to hold it in place and seal off the top of the sensor housing. It’s important to make a note of the wire colours connected to each leg of the sensor as you’ll need this when connecting them to your Firebeetle board.
I bent the legs of the Hall Effect sensor at 90 degrees about 3mm from the sensor so that they could be directed through the hole in the housing and the face of the sensor would then be facing towards the bottom of the anemometer.
I shouldn’t need to do anything with the magnets in the anemometer, if they worked for the reed switch then they should easily work with the Hall Effect sensor as well, as they’re typically a bit more sensitive.
I then filled the void and area around the sensor with some resin to hold it in place. I then left this outside in the sun for a few hours to cure before lighting sanding it with my Dremel for an even finish.
Now that the sensors are in place, we can make up a new wiring harness to connect them to the Firebeetle board. I also made some changes to the wiring to power the sensors. Rather than connect them directly to power and have the sensors stay on the whole time, a suggestion was made to turn the sensors on and off using the IO pins, as they don’t draw much current.
So I’ve got the BME280 sensor’s power pin (VIN) connected to digital pin 16 and the light and Hall Effect sensor’s power pins connected to digital pin 17. This means I can now turn the sensors on only when measurements are taken, so this should further extend the battery life.
The other connections remain as per the original design. The BME280 sensor is connected to the I2C pins, the light sensor to pin 36 and the Hall Effect sensor to pin 0 on the Firebeetle board.
Improvements Made To The Code
Now that we’ve got the sensors connected up to the board, we obviously need to make some changes to the code so that they can be used.
The first and probably most significant is a look-up table for the wind speed. Ian Finnimore had a number of ideas to improve this part of the code, pointing out that the relationship between the wind speed and the rotation time is not linear. He also included a formula to use as a starting point. I used this along with some measured data to eventually calibrate the sensor, and the code now uses this lookup table to find the actual wind speed based on the rotation time. This also allows calibration adjustments to be made to select individual speeds or the complete range.
I also reduced the cycle time to about 8 seconds, as this is all that is needed by the wind speed sensors. Even at the lowest measurable wind speed, the anemometer would rotate at least three times during this period, which is enough for the calculation.
Next I made the changes to the digital pins to turn the sensor on and off as they’re needed, rather than staying on all of the time. This just involved setting each sensor’s digital pin high a little before taking the reading from them and then turning them off again.
Lastly, I moved the WiFi connection right to the end of the cycle so that the WiFi connection isn’t active for the full cycle time, which saves power. I also added a timeout to the WiFi connection attempt routine. In my previous code, the board would stay on and keep attempting to connect to the WiFi network even if it was temporarily unavailable or there was an error. Getting stuck in this loop obviously dramatically drained the battery and resulted in the station dying in a day or two if it occurred. It’ll now try for only 10 seconds and if there is no connection available it’ll timeout and go to sleep anyway.
Testing The Weather Station’s New Power Consumption
We’ve made a few improvements to the hardware and software, which should result in lower power consumption, especially during the sleep period, so let’s test it.
I connected my multimeter to the supply and turned the board on.
The current draw spikes to a little over 100mA when starting up and then quickly settles around 45-55mA while it is taking readings, which is for the majority of the “on” period.
The most significant improvement was during the sleep period. It now goes down to just 0.01mA or 11µA, which is a large improvement over the last version. This is using almost 100 times less power during sleep mode than the previous version.
Note that the multimeter below is now in µA rather than mA shown above. So this is 11.3 thousandths of a mA.
So if we calculate the expected battery life using a 10 minutes cycle time, with 10 seconds of “on” time and 590 seconds of “sleep” time in each cycle, and an average draw of 60mA while on, with the new battery we should get a little under 3000 hours or 124 days of run time. So that’s around four months off a single charge, which is also a great improvement.
Mounting And Adding Solar Power
I previously mounted the weather station directly onto a flat surface using the three feet on the base. This time, I want to rather mount it onto a pole so that there are no flat surfaces around it to affect the wind speed and I want to add a solar panel mount onto the same pole.
So I designed and 3D printed a bracket to mount the weather station onto a 25mm pole, which is easy to then mount onto a railing or fence post.
Now I know that improving the battery life means that it hardly ever needs to be charged, but to make it a truly plug-in and forget weather station, I wanted to add a solar panel so that the battery is kept charged without me having to remember to charge it.
I’m using this 5V panel which I have from a previous project. It claims to be a 1A panel, but that seems a bit optimistic for its size. In any case, it’s way more than what we need to replace the 25 or so milliamp hours used each day. It’ll work well to provide some additional capacity for longer periods of overcast days and allow for a drop in efficiency over time.
I’m going to use a DF Robot solar power management board to control the charging of the battery. This board basically takes the power provided by the solar panel and uses it to charge the battery and provide a regulated supply to the Firebeetle board.
I’ve also made a 3D printed bracket and housing to hold the panel and the solar power management board and these will be installed on the same pole underneath the weather station.
The bracket for the solar panel and the holder for the solar power management board are glued onto the solar panel using some epoxy. I used four nylon standoffs to hold the board in place and provide supports for the cover.
The cover can then be held in place using four screws that came with the solar power management board.
I drilled an 8mm hole in the bottom of the weather station base to run the wiring to the battery and to the Firebeetle board. Be careful drilling through resin prints as they’re quite brittle. It doesn’t take much force to crack them entirely (like I did with the sensor housing).
The solar panel bracket is then mounted onto the pole and the weather station is mounted onto the 3D printed bracket on the end of the pole. An M3 screw and nut are used to hold each in place, the nut sits on the inside of each bracket and helps press the screw against the pole to secure them. The wiring is fed through the base and then plugged into the battery and the Firebeetle board.
Using The Modified Weather Station
I mounted the weather station’s pole outside and it has been running for about three weeks at the time of writing this post.
Since the weather station’s power consumption has gone down quite substantially, I’ve been thinking of trying to power it using some sort of supercapacitor arrangement rather than a battery.
Let me know if you’ve done this or if you’ve got any suggestions for this in the comments section.
Title: Make An Arduino Tic Tac Toe Game With An AI Opponent
Date: Mon, 21 Jun 2021 12:06:25 +0000
Desc:
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 […]
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!