FreshRSS

Normální zobrazení

Jsou dostupné nové články, klikněte pro obnovení stránky.
PředevčíremHlavní kanál
  • ✇IEEE Spectrum
  • Build a Radar Cat DetectorStephen Cass
    You have a closed box. There may be a live cat inside, but you won’t know until you open the box. For most people, this situation is a theoretical conundrum that probes the foundations of quantum mechanics. For me, however, it’s a pressing practical problem, not least because physics completely skates over the vital issue of how annoyed the cat will be when the box is opened. But fortunately, engineering comes to the rescue, in the form of a new US $50 maker-friendly pulsed coherent radar sens
     

Build a Radar Cat Detector

29. Červenec 2024 v 16:00


You have a closed box. There may be a live cat inside, but you won’t know until you open the box. For most people, this situation is a theoretical conundrum that probes the foundations of quantum mechanics. For me, however, it’s a pressing practical problem, not least because physics completely skates over the vital issue of how annoyed the cat will be when the box is opened. But fortunately, engineering comes to the rescue, in the form of a new US $50 maker-friendly pulsed coherent radar sensor from SparkFun.

Perhaps I should back up a little bit. Working from home during the pandemic, my wife and I discovered a colony of feral cats living in the backyards of our block in New York City. We reversed the colony’s growth by doing trap-neuter-return (TNR) on as many of its members as we could, and we purchased three Feralvilla outdoor shelters to see our furry neighbors through the harsh New York winters. These roughly cube-shaped insulated shelters allow the cats to enter via an opening in a raised floor. A removable lid on top allows us to replace straw bedding every few months. It’s impossible to see inside the shelter without removing the lid, meaning you run the risk of surprising a clawed predator that, just moments before, had been enjoying a quiet snooze.

A set of components, including an enclosure with two large holes for LEDs and what looks like cat ears on top. The enclosure for the radar [left column] is made of basswood (adding cat ears on top is optional). A microcontroller [top row, middle column] processes the results from the radar module [top row, right column] and illuminates the LEDs [right column, second from top] accordingly. A battery and on/off switch [bottom row, left to right] make up the power supply.James Provost

Feral cats respond to humans differently than socialized pet cats do. They see us as threats rather than bumbling servants. Even after years of daily feeding, most of the cats in our block’s colony will not let us approach closer than a meter or two, let alone suffer being touched. They have claws that have never seen a clipper. And they don’t like being surprised or feeling hemmed in. So I wanted a way to find out if a shelter was occupied before I popped open its lid for maintenance. And that’s where radar comes in.

SparkFun’s pulsed coherent radar module is based on Acconeer’s low-cost A121 sensor. Smaller than a fingernail, the sensor operates at 60 gigahertz, which means its signal can penetrate many common materials. As the signal passes through a material, some of it is reflected back to the sensor, allowing you to determine distances to multiple surfaces with millimeter-level precision. The radar can be put into a “presence detector” mode—intended to flag whether or not a human is present—in which it looks for changes in the distance of reflections to identify motion.

As soon as I saw the announcement for SparkFun’s module, the wheels began turning. If the radar could detect a human, why not a feline? Sure, I could have solved my is-there-a-cat-in-the-box problem with less sophisticated technology, by, say, putting a pressure sensor inside the shelter. But that would have required a permanent setup complete with weatherproofing, power, and some way of getting data out. Plus I’d have to perform three installations, one for each shelter. For information I needed only once every few months, that seemed a bit much. So I ordered the radar module, along with a $30 IoT RedBoard microcontroller. The RedBoard operates at the same 3.3 volts as the radar and can configure the module and parse its output.

If the radar could detect a human, why not a feline?

Connecting the radar to the RedBoard was a breeze, as they both have Qwiic 4-wire interfaces, which provides power along with an I2C serial connection to peripherals. SparkFun’s Arduino libraries and example code let me quickly test the idea’s feasibility by connecting the microcontroller to a host computer via USB, and I could view the results from the radar via a serial monitor. Experiments with our indoor cats (two defections from the colony) showed that the motion of their breathing was enough to trigger the presence detector, even when they were sound asleep. Further testing showed the radar could penetrate the wooden walls of the shelters and the insulated lining.

The next step was to make the thing portable. I added a small $11 lithium battery and spliced an on/off switch into its power lead. I hooked up two gumdrop LEDs to the RedBoard’s input/output pins and modified SparkFun’s sample scripts to illuminate the LEDs based on the output of the presence detector: a green LED for “no cat” and red for “cat.” I built an enclosure out of basswood, mounted the circuit boards and battery, and cut a hole in the back as a window for the radar module. (Side note: Along with tending feral cats, another thing I tried during the pandemic was 3D-printing plastic enclosures for projects. But I discovered that cutting, drilling, and gluing wood was faster, sturdier, and much more forgiving when making one-offs or prototypes.)

An outgoing sine-wave pulse from the radar is depicted on top. A series of returning pulses of lower amplitudes and at different distances are depicted on the bottom. The radar sensor sends out 60-gigahertz pulses through the walls and lining of the shelter. As the radar penetrates the layers, some radiation is reflected back to the sensor, which it detects to determine distances. Some materials will reflect the pulse more strongly than others, depending on their electrical permittivity. James Provost

I also modified the scripts to adjust the range over which the presence detector scans. When I hold the detector against the wall of a shelter, it looks only at reflections coming from the space inside that wall and the opposite side, a distance of about 50 centimeters. As all the cats in the colony are adults, they take up enough of a shelter’s volume to intersect any such radar beam, as long as I don’t place the detector near a corner.

I performed in-shelter tests of the portable detector with one of our indoor cats, bribed with treats to sit in the open box for several seconds at a time. The detector did successfully spot him whenever he was inside, although it is prone to false positives. I will be trying to reduce these errors by adjusting the plethora of available configuration settings for the radar. But in the meantime, false positives are much more desirable than false negatives: A “no cat” light means it’s definitely safe to open the shelter lid, and my nerves (and the cats’) are the better for it.

Boards Guide 2024: Boards Are Back

Boards Guide 2024: Boards Are Back

From Make: Vol. 87: New evolutions in dev boards make this a metamorphic period for Makers.

The post Boards Guide 2024: Boards Are Back appeared first on Make: DIY Projects and Ideas for Makers.

  • ✇Make: DIY Projects and Ideas for Makers
  • Smarter Serial Communications with WiSerDavid Groom
    Surely you’ve been there: you need to capture serial output from a microcontroller or other device, so you reach for a PL2303 or CP210x or FT232RL-based USB-to-TTL serial cable (if you can remember where you put the damn thing after you last used it!) and…realize you don’t have the drivers installed on the computer you […] The post Smarter Serial Communications with WiSer appeared first on Make: DIY Projects and Ideas for Makers.
     

Smarter Serial Communications with WiSer

Smarter Serial Communications with WiSer

Surely you’ve been there: you need to capture serial output from a microcontroller or other device, so you reach for a PL2303 or CP210x or FT232RL-based USB-to-TTL serial cable (if you can remember where you put the damn thing after you last used it!) and…realize you don’t have the drivers installed on the computer you […]

The post Smarter Serial Communications with WiSer appeared first on Make: DIY Projects and Ideas for Makers.

  • ✇IEEE Spectrum
  • Build the Most Accurate DIY Quartz Clock YetGavin Watkins
    Accurate timing is something that’s always been of interest to me. These days we rely heavily on time delivered to us over the Internet, through radio waves from GPS satellites, or broadcast stations. But I wanted a clock that would keep excellent time without relying on the outside world—certainly something better than the time provided by the quartz crystal oscillator used in your typical digital clock or microcontroller, which can drift by about 1.7 seconds per day, or over 10 minutes in the
     

Build the Most Accurate DIY Quartz Clock Yet

15. Únor 2024 v 16:00


Accurate timing is something that’s always been of interest to me. These days we rely heavily on time delivered to us over the Internet, through radio waves from GPS satellites, or broadcast stations. But I wanted a clock that would keep excellent time without relying on the outside world—certainly something better than the time provided by the quartz crystal oscillator used in your typical digital clock or microcontroller, which can drift by about 1.7 seconds per day, or over 10 minutes in the course of a year.

Of course, I could buy an atomic clock—that is, one with a rubidium oscillator inside, of the sort used onboard GPS satellites. (Not the kind that’s marketed as an “atomic clock” but one that actually relies on picking up radio time signals.) Rubidium clocks provide incredible accuracy, but cost thousands of U.S. dollars. I needed something in between, and salvation was found in the form of the oven-controlled crystal oscillator, invariably known as an OCXO for historical reasons. With one of these, I could build my own clock for around US $200—and one that’s about 200 times as accurate as a typical quartz clock.

Temperature changes are the biggest source of error in conventional crystal oscillators. They cause the quartz to expand or shrink, which alters its resonance frequency. One solution is to track the temperature and compensate for the changes in frequency. But it would be better not to have the frequency change in the first place, and this is where the OCXO comes in.

A printed circuit board surrounded by components including LED display matrices, a nano microcontroller, and a rotary controller. The printed circuit board [center] can be cut into two pieces, with the timing-related components mounted on the lower section, and the control and display components mounted on the upper section.James Provost

The OCXO keeps the crystal at a constant temperature. To avoid the complexity of having to both heat and cool a crystal in response to ambient fluctuations, the crystal is kept heated close to 80 °C or so, well above any environmental temperatures it’s likely to experience. In the past, OCXOs were power hungry and bulky or expensive, but in the last few years miniature versions have appeared that are much cheaper and draw way less power. The Raltron OCXO I chose for my clock costs $58, operates at 3.3 volts, and draws 400 milliamperes in steady-state operation.

The OCXO resonates at 10 megahertz. In my clock, this signal is fed into a 4-bit counter, which outputs a pulse every time it counts from 0000 to 1111 in binary, effectively dividing the 10-MHz signal by 16. This 625-kilohertz (kHz) signal then drives a hardware timer in an Arduino Nano microcontroller, which triggers a program interrupt every tenth of a second to update the clock’s time base. (Full details on how the timing chain and software work are available in an accompanying post on IEEE Spectrum’s website , along with a bill of materials and printed circuit board files.) A rotary controller connected directly to the Nano lets you set the time.

The Nano keeps track of the time, advancing seconds, minutes, and hours, and it also drives the display. This display is created using six Adafruit “CharliePlex FeatherWings,” which are 15 by 7 LED matrices with controllable brightness that come in a variety of colors. Each one is controlled via the addressable I2C serial bus protocol. A problem arises because a CharliePlex is hardwired to have only one of two possible I2C addresses, making it impossible to address six clock digits individually on a single bus. My solution was to use an I2C multiplexer, which takes incoming I2C data and switches it between six separate buses.

A block diagram connecting the OCXO, a 4bit counter, a Nano microcontroller, an I2C multiplexer and six display digits. The timing chain begins with the OCXO oscillator and its 10-megahertz signal and ends with the display being updated once every second. The timing signal synchronizes a hardware timer in the Nano microcontroller so that it triggers an interrupt handler in the Nano’s software 10 times a second. Consequently, you can make many modifications or add new features via software changes.James Provost

Using a microcontroller—rather than, say, discrete logic chips—simplified the design and allows for easy modification and expansion. It’s trivial to tweak the software to substitute your own font design for the numbers, for example, or adjust the brightness of the display. Connector blocks for serial interfaces are directly available on the Nano, meaning you could use the clock as an timer or trigger for some other device.

For such a purpose you could omit the display entirely, reducing the clock’s size considerably (although you’ll have to modify the software to override the startup verification of the display). The clock’s printed circuit board is designed so that it can be cut into two pieces, with the lower third holding the microcontroller, OCXO, and other supporting electronics. The upper two thirds hold the display and the rotary encoder. By adding four headers and running two cables between the pieces to connect them, you can arrange the boards to form a wide range of physical configurations, giving you a lot of freedom in designing the form factor of any enclosure you might choose to build for the clock. Indeed, creating the PCB so this was possible was probably the most challenging part of the whole process. But the resulting hardware and software flexibility of the final design was worth it.

The whole device is powered through the Nano’s USB-C port. USB-C was needed in order to provide enough current, as the clock, OCXO, and display all together need more than the 500-mA nominal maximum current of earlier USB ports. A battery backup connected to this port is needed to prevent resets due to power loss—using one of the popular coin-cell-based real-time backup clocks would be pointless due to their relative inaccuracy.

And as for that goal of creating an accurate clock with a great bang for the buck, I cross-checked my OCXO’s output in circuit with an HP 53150A frequency counter. The result is that the clock drifts no more than 0.00864 seconds per day, or less than 3.15 seconds in a year. In fact, its accuracy is probably better than that, but I’d reached the limit of what I could measure with my frequency counter! I hope you’ll build one of your own—it takes just a few hours of soldering, and I think you’ll agree it would be time well spent.

  • ✇Make: DIY Projects and Ideas for Makers
  • Smarter Serial Communications with WiSerDavid Groom
    Surely you’ve been there: you need to capture serial output from a microcontroller or other device, so you reach for a PL2303 or CP210x or FT232RL-based USB-to-TTL serial cable (if you can remember where you put the damn thing after you last used it!) and…realize you don’t have the drivers installed on the computer you […] The post Smarter Serial Communications with WiSer appeared first on Make: DIY Projects and Ideas for Makers.
     

Smarter Serial Communications with WiSer

Smarter Serial Communications with WiSer

Surely you’ve been there: you need to capture serial output from a microcontroller or other device, so you reach for a PL2303 or CP210x or FT232RL-based USB-to-TTL serial cable (if you can remember where you put the damn thing after you last used it!) and…realize you don’t have the drivers installed on the computer you […]

The post Smarter Serial Communications with WiSer appeared first on Make: DIY Projects and Ideas for Makers.

❌
❌