Sunday, December 10, 2023

Project Quest

 Over the last 6 months, this blog has been sadly neglected. Some bits of work here and there were completed, but none of these bits reached any sort of satisfying conclusion, so writing about them hardly seemed worthwhile. Occasionally, someone does ask what I am working on these days though, so in this blog I will attempt a brief summary.

As the previous blog entry, written at the end of May alluded to, I attempted to create a new type of robotic joint that consisted of electromagnets constructed from soft iron rods and magnet wire, arranged orthogonally to each other, and driven with electric current to move a lightweight, plastic arm with a small permanent magnet fixed to its end. The idea was to have a two degrees of freedom joint, but without any relatively heavy conventional electronic motors to make it work. I had found some theoretical papers on this idea, but no practical implementations. The reason for this soon became apparent: When an electromagnet was activated with current, it would attract the permanent magnet at the end of the plastic rod, but only if the permanent magnet was fairly close to the end of the electromagnet. And once an attractive force was established, the permanent magnet would quickly swing over to the end of the electromagnet, and remain fixed there, even after the current was turned off. At this location, the permanent magnet would have been too far from any other electromagnet to allow it to produce enough attractive force to remove it from its current location. Possibly some different selection of larger diameter soft iron rods for the electromagnet(s) would have worked a bit better, but this would seem to defeat the original goal of making something more lightweight than a conventional electric motor. So the project was cast aside. 

Once summer started, the fine weather inspired me to make some sort of robot that could work outdoors in the sunshine. Robotic boats are fun to work on and test, but a bit time consuming to drive to and from water. Why not create a robot that could function in the backyard, and do something useful like pick up dog poop? There is already a robot that purportedly does this: although so far as I can tell, it is not commercially available yet. It seemed like it would be fun to develop something that uses visual AI to identify dog poop, scoop it up, and place it in a disposal bin of some sort. I figured it would make sense to get some sort of mechanical platform up and running as quickly as possible, so that I could then enjoy the fun part of developing visual AI algorithms. 

Of course, the mundane assembly work for creating a platform occupied the better part of the summer. I used a piece of plywood for the base, a scavenged wireless transmitter from an old AMOS prototype, an Arduino Uno microcontroller and stepper motor driver from an abandoned compass calibration apparatus, a couple of garage door motors and DC motor driver from a previous attempt at making a paddle robot boat, and a worm gear and stepper motor that was scavenged from a broken 3D printer. The wheels were 3D-printed. Here is the ugly result:

Testing it out in the basement wasn't too bad. It would drive around, and the scooper, although perhaps a bit on the small side for our Labrador retriever, could be driven up and down. On the grass however, the robot failed miserably. The large back wheels tended to spin uselessly in our long, wet grass. Possibly if the robot had more weight, and better wheels (lawnmower wheels?) it could have worked better, but by this point the summer was nearly over, and the initial appeal of the project had faded. 

I decided to switch projects again, although for some reason, stuck with a pet-related theme. We have an Apple AirTag for our orange tabby cat, Tiggy. It is very lightweight, and its small coin cell battery is able to power it for about a year before it needs changed. So long as Tiggy is within about 50 m of my phone, or 50 m of someone with an Apple-related product that has location tracking enabled, I can find his location on my phone. The problem however, is that when Tiggy ventures outdoors, he is seldom within range of anyone's Apple product. 

I was wondering if it would be possible to have a similarly sized device that has GPS capability, and the ability to transmit the GPS location to a base station, at distances up to 500 m (Tiggy's estimated maximum range). There is a somewhat bulky GPS device available on the market already, that has a cellular transceiver. You need to purchase a monthly plan for it though, and the battery only lasts a few days I think before it needs to be recharged. I was wondering if it might be possible to use a LoRa transceiver instead for wireless communications, with a small GPS chip. If position updates were relatively infrequent, or occurred only at times of interest (e.g. when it is time to bring Tiggy in for the evening) it might be able to last a couple of months I think on a single coin cell. There would be some challenges in power delivery however, which would likely require a super-capacitor of some sort to be able to source enough current for times when the device is active. 

I purchased a couple of LoRa evaluation boards, that feature the very small 1SJ chip from Murata. On one of them, I attached a small, flexible antenna, although I needed to re-solder an incredibly small 0-ohm resistor on the board to do it, and I'm afraid this connection is a bit less than ideal, since the wireless power level sent from the device tends to increase by about 5 to 10 dB whenever I push down on the resistor with my thumb. Nevertheless, I was able to hook up one evaluation board on the railing of our deck, with a short stubby antenna, and positioned the other evaluation board with the flexible antenna at various corners of our property, to see what kind of wireless power could be received on the deck. Here are the results:

The amount of wireless power received was disappointingly low, but I think the aforementioned issue with soldering the miniscule 0-ohm resistor could be to blame. I think using a better antenna on the base station, and elevating the base station somehow (maybe on top of our roof) would work a lot better. Trees, buildings, and other obstructions really wreck havoc with the wireless signal, so I think in some cases, there won't be much that can be done. Theoretically, the LoRa transceivers should be able to work over a distance of ~ 10 km, but that assumes both transmitter and receiver are mounted high up, well away from the ground, without any obstructions between them. 

So for now, I'll keep at it, try to improve the wireless power throughput, and start looking at how to collect the GPS data. Tiggy is remaining mostly indoors now that it is December and usually too cold outside, so I'll have a few months at least to come up with something he can try out. 😀

Wednesday, May 31, 2023

Stream Logger

 Last month I thought it would be cool to position AMOS in the stream in our backyard, where it could take still pictures during daylight hours to make a time lapse video of snow melting, leaves budding, and stuff turning green. It would also be a good opportunity to test out the long term resilience of the boat to the elements. I put it in the stream with an anchor, on April 15, so there wasn't much snow left by then. In fact, it melted in just a day or two, so wasn't too impressive as a video. Also, the first few weeks were fairly uniform in terms of foliage coming out (i.e. there wasn't any, spring comes late to New Brunswick!).

Here is a still picture taken by AMOS on May 07:

You can just barely make out that there are tiny red buds on the leaves. At this point, the SD card on AMOS had filled up, taking a picture every 5 minutes for 12 hours per day. I removed the pictures from the card, and set AMOS to just take a picture every hour for the next 3 weeks. I also configured AMOS to go to sleep between pictures, which saved a lot of power and prevented the occasional loss of battery charge when the weather was cloudy for 3 or 4 days in a row. 

The following video was created from just those 3 weeks:

Around May 20, Kelly noticed a mother bear and two cubs playing around in the stream in the vicinity of AMOS. I didn't check on the boat until the 28th, but noticed that it had moved (or been moved?) from the middle of the stream to sitting atop a small dam structure constructed last year by a beaver:

 It's possible that a few days of rain after the 20th floated the boat up onto the dam, but I prefer to think that the bears relocated it. Muddy streaks on the top of the solar panel seem to support that theory. Unfortunately, the AMOS camera was only configured to take a picture at the top of every hour, and no bear pictures got saved. 

Desiccant was placed in both AMOS electronics boxes, but over time, humidity within the boxes did increase, and the front electronics box contained a small quantity of water at the bottom of it when I opened it up on the 28th. The following graphs show the measured humidity levels in both boxes over the entire time that AMOS was out there:

When AMOS was powered continuously during daylight hours for the first 2 weeks, it probably had a beneficial effect on keeping humidity levels in check. 

I have recently ordered some soft iron rods, magnet wire, and small permanent magnets, to try some experiments on a novel type of robot joint. If it works, it will have two degrees of bend freedom, but won't require conventional electronic motors to work, so should be smaller and lighter than most other robotic arm joints. An evening spent searching the idea on the Internet revealed a number of theoretical papers on the subject, but little hard evidence (i.e. YouTube videos of real robots working), so it sounds like a pretty good challenge. :-) 

Sunday, March 5, 2023

The Pi4 Update

I still have a couple of Raspberry Pi 3B+ boards left that have been used on demo AMOS boats, but I picked up a used Raspberry Pi 4B board recently from eBay to see what would be involved in updating the main AMOS CPU. Unfortunately it is not really possible for individuals or small businesses to purchase new boards at a reasonable price. The worldwide chip shortage has meant that most new units getting produced are being sold in large batches to large customers.

The Pi board I got from eBay came with this nifty little case though:

Although it won't be possible to use the case with the AMOSWirelessHAT board attached, I have been using it while setting up the various drivers, libraries, and other software that are required to help AMOS run. I chose the latest Buster operating system for the board, which has required various library updates, and a few code changes to support those newer libraries. In all software projects, this seems to occupy a significant, and somewhat annoying chunk of time. To me at least, it seems that the amount of work required to support more recent libraries and operating systems often outweighs any advantages the more recent stuff might have to offer. Or maybe I'm just becoming an old curmudgeon. 

To help speed these tasks, I started using ChatGPT for the first time. It's refreshing to get answers to questions that are in well-written English, although I'm not sure that the accuracy of the ChatGPT answers is much better than what you could do with a regular Google search. For one thing, the information / database that ChatGPT uses to generate its answers, at the time of this writing uses information up to September 2021, which meant that the answers it gave to some of my questions about recent Raspberry Pi libraries were a bit dated, and in some cases incorrect. 

A few days ago I tried out the latest revision of the AMOSWirelessHat board, but found that the position of the board's camera-cable slot was too close to the edge of the board, so that the camera-cable would have to be twisted and strained a bit too much. So a revised board was made and ordered, and should hopefully be here in about a week or so. 

The pepper plants that were described in the previous blog post are all doing well. There are even a few new peppers (filius blue) that were given to me to try out, from a co-worker at Measurand: 

All of the various types of peppers have sprouted; the big ones in the above picture are the jalapeños. I'm going to have to move them down to a lower level soon, before they get too close to the grow light (maybe add a second grow light!). I added a second relay to control the heating lamp independently from the grow light, so now the daytime temperature is always between 25 and 28 degrees C. With all of the plants and soil in there, I've noticed that there is a lot more humidity in the small greenhouse. At night, when the light gets turned off, I have been undoing the zippers in the plastic cover to avoid getting condensation all over everything. 

Saturday, January 28, 2023

Hot Pepper Grow-Op

 About a month before Christmas, I bought myself this hot pepper seed kit from Oh! Canada Seeds in Halifax, NS:

The kit contains seeds from 3 types of peppers: jalapeno, habanero, and ghost. I enjoy eating fresh peppers with various types of food, and had experimented previously with growing some tiny hot red peppers before, which were quite enjoyable in limited quantities, so this was a bit of an experiment to see if I could grow and eat some much hotter varieties. According to the kit, jalapeno peppers are between 2500 and 8000 on the Scoville scale of spiciness. For me this is a comfortable level. I enjoy eating maybe one or two small jalapenos with a few slices of pizza or a plate of nachos. 
Habanero peppers are in a different league though: 100000 to 350000 Scoville heat units. I'm pretty sure I've never eaten anything that hot. And ghost peppers nearly top the chart: 850000 to 1041427 Scoville units (that's a lot of precision!). According to the seed kit, the only thing hotter is the Carolina Reaper pepper (1400000 to 2200000 Scoville units). 

Naturally, the peppers would need to be started indoors, in my small greenhouse. The greenhouse is constructed from metal tubing, and has an opaque plastic cover around it. It is maybe about 2 ft x 2 ft square by about 5 ft high and is kept in the laundry room of our house. To make sure the plants get enough sunlight and heat, in the past I have hooked up a UV grow light and incandescent bulb (for heat) to a light-timer circuit. This has generally worked OK, but the timer circuit sometimes needs to be adjusted if the power goes out for a significant length of time, and it isn't as much fun as having a microcontroller-based setup with digital control and data. 😜

So the idea was to complete a small Arduino-based project over the Christmas break to provide simple on-off control of the heating / lighting and provide some data feedback on the temperature and humidity inside the greenhouse, which could be used for deciding when to provide more water to the growing plants, or possibly at some point in the future for adding an automated watering system. Of course, things were busy over the Christmas break with traveling, illnesses, and afterward, work commitments. So the small few-day project has turned into a month-long project, before it could reach an acceptable point where I could at least blog about it. 

One major goal in completing the project was to figure out some way of using the same HM-10 BLE (Bluetooth low-energy) device that is used on the AMOS Remote for communications with a host PC that could be used for data viewing and graphing. There is a wealth of online information about how to interface to the HM-10 and related BLE devices with a mobile Android or iOS device, and that was what I used for the mobile Boat Captain software that runs on Android phones and tablets. Surprisingly though, there seems to be very few examples of how to communicate over BLE using a PC. I was however, able to find this project: which turned out to be a really well written C# console application for doing every possible thing you could ever want to do with BLE devices connected to a PC's Bluetooth radio. I was able to adapt sections of this code to work in a simple GreenhouseViewer app that I created for viewing data from the greenhouse:

Similar code changes could be made for the PC BoatCaptain software to allow the PC to connect wirelessly to the AMOS Remote, which in turn connects wirelessly to AMOS. Currently, the AMOS Remote needs to use the included USB cable when it is being used with a PC. If the AMOS Remote were situated atop a pole for better line-of-sight however, using the USB cable would likely not be practical. 

So far, the only plants that have sprouted are the jalapenos:

Possibly the hotter peppers require more time? Or maybe this is just the universe's way of protecting me from too much spiciness. 

Here are some other pics of the setup: 

Not shown are some blankets that are draped over the outside of the greenhouse. The blankets serve as insulation for keeping in the heat and for preventing the harsh UV light from hurting anybody's eyes. I have noticed that the humidity shoots momentarily way up at night (> 80% and then gradually settles to ~ 70%) when the heat and light get switched off. This probably isn't great for the electronics, as they are openly exposed to the air. I've done similar stuff in the past though, and never experienced any problems, so hopefully it will be OK here too.