Micropython And C Play Together Better

Python is a versatile, powerful language but sometimes it’s not the best choice, especially if you’re doing work in embedded systems with limited memory. Sometimes you can get away with MicroPython for these cases, but the best language is likely C or assembly. If you’re really stubborn, like [amirgon], and really want C and Python to play well together, you can make use of his new tool which can bring any C library to MicroPython.

As an example of how this tool is used, a “Pure MicroPython” display driver for ILI9341 on the ESP32, which means that everything was implemented in MicroPython. [amirgon] wanted to see how the Python driver would compare to one that’s already been written in C, and use it to showcase MicroPython binding. This tool also automatically converts structs, unions, enums and arrays to Python objects, and provides a means to work with pointers which is something that Python doesn’t handle in the same way that C requires.

[amirgon] hopes that this tool will encourage the adoption of Micropython by removing the obstacle of missing APIs and libraries in MicroPython. Since most libraries for systems like these are written in C, a way to implement them in Python is certainly powerful. We featured one use case for this a while back, but this is a much more generic fix for this coding obstacle.

Hands-On: CCCamp2019 Badge Is A Sensor Playground Not To Be Mistaken For A Watch

Last weekend 5,000 people congregated in a field north of Berlin to camp in a meticulously-organized, hot and dusty wonderland. The optional, yet official, badge for the 2019 Chaos Communication Camp was a bit tardy to proliferate through the masses as the badge team continued assembly while the camp raged around them. But as each badge came to life, the blinkies that blossomed each dusk became even more joyful as thousands strapped on their card10s.

Yet you shouldn’t be fooled, that’s no watch… in fact the timekeeping is a tacked-on afterthought. Sure you wear it on your wrist, but two electrocardiogram (ECG) sensors for monitoring heart health are your first hint at the snoring dragon packed inside this mild-mannered form-factor. The chips in question are the MAX30001 and the MAX86150 (whose primary role is as a pulse sensor but also does ECG). We have high-res ADCs just waiting to be misused and the developers ran with that, reserving some of the extra pins on the USB-C connector for external devices.

There was a 10€ kit on offer that let you solder up some electrode pads (those white circles with gel and a snap for a solid interface with your body’s electrical signals) to a sacrificial USB-C cable. Remember, all an ECG is doing is measuring electrical impulses, and you can choose how to react to them. During the workshop, one of the badge devs placed the pads on his temples and used the card10 badge to sense left/right eye movement. Wicked! But there are a lot more sensors waiting for you on these two little PCBs.

Continue reading “Hands-On: CCCamp2019 Badge Is A Sensor Playground Not To Be Mistaken For A Watch”

Hackaday Prize Mentor Session: Beau Ambur

Beau Ambur can often be found hosting hardware events and offering help all around the Bay Area. Now he’s turned it into a career and travels the west coast helping hackers and creators effectively leverage Kickstarter’s platform. Beau’s mentor session covers everything from, “is this project a good fit for venture capital?” to, “is open source a good fit for my project?”.

For this year’s Hackaday Prize we’ve found experts in a wide range of fields so you can take your entries to the next level regardless of the stage the project is in. The sessions are on a first come basis so sign up now for a chance to get some valuable feedback on your entry.

Your Robot Language Coach

The first project is a Personal English Trainer by the lonely programmer. As a student he noticed a need for a more interactive and portable language learning aid. Solutions do exist on the market but they are along the lines of a pocket dictionary, instructional phone app, or a full on translator. These break the flow of thought and conversation. The lonely programmer envisioned something that you can conversationally ask for help as you’re using a new language.

As many have discovered, the best way to see if there’s a need for something is to build a minimum viable product (MVP). The snips.ai platform offered the perfect foundation to quickly test out the idea. It’s working on a few words and he wants to get it ready for more people to play with the idea. The majority of the lonely programmer’s questions centered around making the project interesting for other hackers so that it could one day turn into a product.

Bolt-On Bike Assist

Rob and Shushanik are developing a project called BikeOn. It bolts to any bicycle and converts it to an electric assist bike without tools or replacing any components. BikeOn has already won some accolades such as Editors Choice at the last 2019 Makerfaire Bay Area. Rob had a few questions on how to transition a project from the proof of concept stage to the product stage. The discussion went over using open source as a tool for product promotion as well as getting funding for taking a hardware product to market.

He also wanted to know if there was anything the team could do to have a better shot at winning the prize. There were a few good tips such as directly focusing on the five categories the judges would be looking at: Concept, Design, Production, Benchmark, and Communication. It is also important to cover the development journey. Why did you make the choices you made when designing the project?

No-Spill Trash Can Concept

Rounding out this mentor session, Jeannie and her team of highschool students demonstrate SEAL. In the area around the Granada Hills Charter High School there are winds mighty enough to blow over full trashcans. This trash travels to the ocean and disrupts local ecosystems. The team is working on a device which can detect a tipping trashcan and keep the lid from opening.

Prototyping started with Arduinos, but they’ve already escalated to designing their own PCBs. Their hope is to produce a run of fifty devices and try them out with a local commercial partner. Beau recommended they look into the Micropython ecosystem. Not only would the students get the advantage of using the STM32 chips in their board layouts (reducing the number of support components they would need), micropython would make it easier for students to jump in and help rather than having to learn the nuances of C first.

The Hackaday Prize mentoring sessions continue through the summer so don’t forget to sign up and check out the list of mentors who are here to share their knowledge and experience.

Continue reading “Hackaday Prize Mentor Session: Beau Ambur”

Building An ESP8266 Game System With MicroPython

After a seemingly endless stream of projects that see the ESP8266 open doors or report the current temperature, it can be easy to forget just how powerful the little WiFi-enabled microcontroller really is. In fact, you could argue that most hackers aren’t even scratching the surface of what the hardware is actually capable of. But that’s not the case for [Brian Wagner] and his students from the Kentucky Country Day School.

Their project, the GamerGorl, is a completely custom handheld game system running on a Wemos D1 Mini development board. The team’s PCB, which was developed over several iterations, is essentially a breakout board which allows them to easily connect up peripheral devices. Given the low total component cost of the GamerGorl and relative simplicity of its construction, it looks like a phenomenal project for older STEM students.

Beyond the ESP8266 board, the GamerGorl features a SSD1106 1.3″ OLED display, a buzzer for sound effects, two tactile buttons, and an analog joystick originally intended for an Xbox controller. Around the backside there’s a WS2812B RGB LED strip that’s at least partially for decoration, but it’s also actively used in some of the games such as the team’s take on Simon.

Even if you aren’t in the market for a portable game system, the GameGorl does provide an interesting case study for MicoPython applications on the Wemos D1 Mini. Browsing through the team’s source code as well as the helpful hints that [Brian] gives about getting the software environment up and running could be useful if you’re looking to expand your ESP8266 programming repertoire. We’d also love to see this device running the “ESP Little Game Engine” we covered recently.

Continue reading “Building An ESP8266 Game System With MicroPython”

New Part Day: Pyboard D Is Smaller, Wireless, And Has Expansion Modules

Historically, microcontrollers’ limited computing power and storage space meant software had to be written in low-level languages out of necessity. In recent years small affordable chips grew powerful enough that they could theoretically run higher level languages, sparking numerous efforts to turn that theory into reality. MicroPython delivered on this promise in a big way when their Kickstarter-funded pyboard was delivered along with its open source software. Several years have since passed, and now it is time for an upgraded pyboard: the D-series.

We’ve talked with [Damien George] back when the original Kickstarter was still underway. Since the launch of pyboard and release of MicroPython source code, we’ve played with ports running on an ESP8266 and on a BBC micro:bit. The software ecosystem has continued to grow, most recently we looked at LittlevGL graphics library. But just because all the flashy action has been happening on the software side doesn’t mean the hardware side has been sitting stagnant.

Pyboard-D upgraded from original pyboard’s STM32F4 to more capable STM32F7 chips. Witnessing the popularity of MicroPython on networked darlings ESP8266 and ESP32, there will be a pyboard D variant with a Murata 1DX on board for WiFi and Bluetooth connectivity. The new pyboard will be extremely compact with limited edge connections so a fine-pitched connector is required to bring out all the pins. To bring the new pyboard back to its educational and tinkerer roots, a breakout board will take those pins and spread them out in a breadboard friendly form factor. These breakout boards can also host small (12 mm x 12 mm) “tiles” to add individual features.

The wireless pyboard D will obviously invite comparison tests with an ESP32 running MicroPython, and its hardware expansion tiles invites comparison with Adafruit’s Wings. It’ll be interesting to see how they fare once widely available and we can get our hands on them. If you’ve picked up an earlier release at FOSDEM 2019, we invite you to share your experience in comments.

[via Adafruit blog]

LittlevGL Brings GUI Tools To Micropython

Microcontrollers are wonderfully useful things, but programming them can be a little daunting if you’re used to the simplicity of compiling for regular PCs. Over time though, this has become easier. Communities have strayed away from assembly code and created higher-level languages such as Micropython, to allow these devices to be programmed in a more accessible manner. Unfortunately, Micropython has historically lacked a decent high-level GUI library. Thankfully, that’s no longer the case, with [amirgon] porting LittlevGL to the platform.

Putting a GUI into a project with a screen seems simple, until one actually gets down to brass tacks. A simple button can consist of a background color, text, and a symbol – and that’s not even considering the use of shading or other visual effects. Having a library to handle the grunt work can massively cut down development time.

LittlevGL is the work of [kisvegabor], and is programmed in C, but this effort has made it possible to integrate it with Micropython code. It’s all object-oriented, and thus works well in the broader Python framework. [amirgon] notes that it’s particularly good for quick development, due to Python’s ability to run code without a slow compiling step.

There are other approaches to this problem, too – with MyOpenLab being a particularly versatile example.

Friday Hack Chat: Circuit Python

Back in the olden days, if you wanted to learn how to program a computer, you used the BASIC interpreter stored in ROM. This is how an entire generation of devs learned how to program. Now, home computers do not exist, there is no programming language stored in ROM, and no one should inflict JavaScript on 8-year-olds. What is the default, My First Programming Language™ today? Python. And now it’s on microcontrollers.

For this week’s Hack Chat on hackaday.io, we’re going to be talking all about Circuit Python. Circuit Python is based on the Open Source MicroPython, a Python 3 interpreter that implements a subset of the Python language on microcontrollers and other constrained environments. It is the spiritual successor of BASIC on every computer: MicroPython has an interactive prompt, arbitrary precision integers, closures, lists, and more. All of this fits on a microcontroller with 256 kB of code space and 16 k of RAM.

Our guests for this week’s Hack Chat will be [Scott Shawcroft] and [Dan Halbert] from Adafruit. [Scott] started working on MicroPython with Adafruit in September 2016 and has led the renamed CircuitPython effort ever since. [Dan] started working on CircuitPython in early 2017 and joined Adafruit in August of that year. [Dan], by the way, is the original author of the ‘more’ command in UNIX.

For this Hack Chat, we’re going to be talking about CircuitPython, its history, current boards that support the project, and the end goals for CircuitPython. We’ll be talking about future plans, what will be supported in the future, and asking any technical questions about CircuitPython.

join-hack-chat

Our Hack Chats are live community events on the Hackaday.io Hack Chat group messaging. This Hack Chat is going down Friday, February 2nd at noon, Pacific time. Time Zones got you down? Here’s a handy countdown timer!

Click that speech bubble to the left, and you’ll be taken directly to the Hack Chat group on Hackaday.io.

You don’t have to wait until Friday; join whenever you want and you can see what the community is talking about.