Vista Normal

Hay nuevos artículos disponibles. Pincha para refrescar la página.
AnteayerSalida Principal

Coupling STM32 And Linux? Consider HID over I2C

26 Junio 2024 at 08:00
screenshot of the code defining a hid descriptor by using essentially macros for common descriptor types

If you’re pairing a tiny Linux computer to a few peripherals — perhaps you’re building a reasonably custom Pi-powered device — it’s rightfully tempting to use something like an STM32 for all your low-level tasks, from power management to reading keyboard events.

Now, in case you were wondering how to tie the two together, consider HID over I2C, it’s a standardized protocol with wide software and peripheral support, easily implementable and low-power. What’s more, [benedekkupper] gives you an example STM32 project with a detailed explanation on how you too can benefit from the protocol.

There are several cool things about this project. For a start, its code is generic enough that it will port across the entire STM32 lineup nicely. Just change the pin definitions as needed, compile it, flash it onto your devboard and experiment away. Need to change the descriptors? The hid-rdf library used lets you define a custom descriptor super easily, none of that building a descriptor from scratch stuff, and it even does compile-time verification of the descriptor!

The project has been tested with a Raspberry Pi 400, and [benedekkupper] links a tutorial on quickly adding your I2C-HID device on an Linux platform; all you need is DeviceTree support. Wondering what’s possible with HID? We’ve seen hackers play with HID aplenty here, and hacking on the HID standard isn’t just for building keyboards. It can let you automate your smartphone, reuse a laptop touchpad or even a sizeable Wacom input surface, liberate extra buttons on gamepads, or build your own touchscreen display.

Hands On: Inkplate 6 MOTION

Por: Tom Nardi
6 Junio 2024 at 14:00

Over the last several years, DIY projects utilizing e-paper displays have become more common. While saying the technology is now cheap might be overstating the situation a bit, the prices on at least small e-paper panels have certainly become far more reasonable for the hobbyist. Pair one of them with a modern microcontroller such as the RP2040 or ESP32, sprinkle in a few open source libraries, and you’re well on the way to creating an energy-efficient smart display for your home or office.

But therein lies the problem. There’s still a decent amount of leg work involved in getting the hardware wired up and talking to each other. Putting the e-paper display and MCU together is often only half the battle — depending on your plans, you’ll probably want to add a few sensors to the mix, or perhaps some RGB status LEDs. An onboard battery charger and real-time clock would be nice as well. Pretty soon, your homebrew e-paper gadget is starting to look remarkably like the bottom of your junk bin.

For those after a more integrated solution, the folks at Soldered Electronics have offered up a line of premium open source hardware development boards that combine various styles of e-paper panels (touch, color, lighted, etc) with a microcontroller, an array of sensors, and pretty much every other feature they could think of. To top it off, they put in the effort to produce fantastic documentation, easy to use libraries, and free support software such as an online GUI builder and image converter.

We’ve reviewed a number of previous Inkplate boards, and always came away very impressed by the attention to detail from Soldered Electronics. When they asked if we’d be interested in taking a look at a prototype for their new MOTION 6 board, we were eager to see what this new variant brings to the table. Since both the software and hardware are still pre-production, we won’t call this a review, but it should give you a good idea of what to expect when the final units start shipping out in October.

Faster and Stronger

As mentioned previously, the Inkplate boards have generally been differentiated by the type of e-paper display they’ve featured. In the case of the new MOTION, the theme this time around is speed — Soldered says this new display is capable of showing 11 frames per second, no small feat for a technology that’s notoriously slow to refresh. You still won’t be watching movies at 11 FPS of course, but it’s more than enough to display animations and dynamic information thanks to its partial refresh capability that only updates the areas of the display where the image has actually changed.

But it’s not just the e-paper display that’s been swapped out for a faster model. For the MOTION 6, Soldered traded in the ESP32 used on all previous Inkplates for the STM32H743, an ARM Cortex-M7 chip capable of running at 480 MHz. Well, at least partially. You’ll still find an ESP32 hanging out on the back of the MOTION 6, but it’s there as a co-processor to handle WiFi and Bluetooth communications. The STM32 chip features 1 MB of internal SRAM and has been outfitted with a whopping 32 MB of external DRAM, which should come in handy when you’re throwing 4-bit grayscale images at the 1024 x 758 display.

The Inkplate MOTION 6 also features an impressive suite of sensors, including a front-mounted APDS-9960 which can detect motion, proximity, and color. On the backside you’ll find the SHTC3 for detecting temperature and humidity, as well as a LSM6DSO32 accelerometer and gyroscope. One of the most impressive demos included in the MOTION 6’s Arduino library pulls data from the gyro and uses it to rotate a wireframe 3D cube as you move the device around. Should you wish to connect other sensors or devices to the board, you’ve got breakouts for the standard expansion options such as I²C and SPI, as well as Ethernet, USB OTG, I²S, SDMMC, and UART.

Although no battery is included with the MOTION 6, there’s a connector for one on the back of the board, and the device includes a MCP73831 charge controller and the appropriate status LEDs. Primary power is supplied through the board’s USB-C connector, and there’s also a set of beefy solder pads along the bottom edge where you could wire up an external power source.

For user input you have three physical buttons along the side, and a rather ingenious rotary encoder — but to explain how that works we need to switch gears and look at the 3D printed enclosure Soldered has created for the Inkplate MOTION 6.

Wrapped Up Tight

Under normal circumstances I wouldn’t go into so much detail about a 3D printed case, but I’ve got to give Soldered credit for the little touches they put into this design. Living hinges are used for both the power button and the three user buttons on the side, there’s a holder built into the back for a pouch battery, and there’s even a little purple “programming tool” that tucks into a dedicated pocket — you’ll use that to poke the programming button when the Inkplate is inside the enclosure.

But the real star is the transparent wheel on the right hand side. The embedded magnet in the center lines up perfectly with a AS5600 magnetic angle encoder on the Inkplate, with an RGB LED just off to the side. Reading the value from the AS5600 as the wheel rotates gives you a value between 0 and 4048, and the library offers macros to convert that to radians and degrees. Combined with the RGB LED, this arrangement provides an input device with visual feedback at very little cost.

It’s an awesome idea, and now I’m looking for an excuse to include it in my own hardware designs.

The 3D printed case is being offered as an add-on for the Inkplate MOTION 6 at purchase time, but both the STLs and  Fusion 360 files for it will be made available with the rest of the hardware design files for those that would rather print it themselves.

An Exciting Start

As I said in the beginning of this article, the unit I have here is the prototype — while the hardware seems pretty close to final, the software side of things is obviously still in the early stages. Some of the libraries simply weren’t ready in time, so I wasn’t able to test things like WiFi or Bluetooth. Similarly, I wasn’t able to try out the MicroPython build for the MOTION 6. That said, I have absolutely no doubt that the team at Soldered Electronics will have everything where it needs to be by the time customers get their hands on the final product.

There’s no denying that the $169 USD price tag of the Inkplate MOTION 6 will give some users pause. If you’re looking for a budget option, this absolutely isn’t it. But what you get for the price is considerable. You’re not just paying for the hardware, you’re also getting the software, documentation, schematics, and PCB design files. If those things are important to you, I’d say it’s more than worth the premium price.

So far, it looks like plenty of people feel the same way. As of this writing, the Inkplate MOTION 6 is about to hit 250% of its funding goal on Crowd Supply, with more than 30 days left in the campaign.

❌
❌