Posts with «python» label

New Part Day: Arduino Goes Pro with the Portenta H7

The Consumer Electronics Show in Las Vegas is traditionally where the big names in tech show off their upcoming products, and the 2020 show was no different. There were new smartphones, TVs, and home automation devices from all the usual suspects. Even a few electric vehicles snuck in there. But mixed in among flashy presentations from the electronics giants was a considerably more restrained announcement from a company near and dear to the readers of Hackaday: Arduino is going pro.

While Arduino has been focused on the DIY and educational market since their inception, the newly unveiled Portenta H7 is designed for professional users who want to rapidly develop robust hardware suitable for industrial applications. With built-in wireless hardware and the ability to run Python and JavaScript out of the box, the powerful dual-core board comes with a similarly professional price tag; currently for preorder at $99 USD a pop, the Portenta is priced well outside of the company’s traditional DIY and educational markets. With increased competition from other low-cost microcontrollers, it seems that Arduino is looking to expand out of its comfort zone and find new revenue streams.

That’s a Lot of Pins

The Portenta H7 is obviously a far cry from the relatively dinky 8-bit Arduinos that we’ve all got filling up our parts drawers. Developed for high performance edge computing applications, the new board is powered by a 32-bit STM32H747XI that utilizes both an ARM Cortex M7 and an M4 running at 480 MHz and 240 MHz respectively. The two cores can work independently, allowing for example one core to run interpreted Python while the other runs code compiled in the Arduino IDE. When they need to work together, the cores can communicate with each other via a Remote Procedure Call (RPC) mechanism.

The new 80-pin connectors on the Portenta

Outwardly, the new board doesn’t look far removed from the modern Arduino form factor we’re used to. The USB connector has been upgraded to a Type-C, but the Portenta still retains the dual rows of pads ready for hand-soldered headers — that’s their more recent pinout that they call the Arduino MKR form factor.

If you look on the back of the board however, you’ll see that they’ve added two 80-pin high density connectors. According to the product page, these are intended to allow the Portenta to simply be plugged into a device as a removable module. The idea being that devices in the field can easily have their Portenta swapped out for an upgraded model. Some digging into the product page documentation section turns up a schematic that lists the connectors as Hirose DF40C-80DP-0.4V(51).

The base model Portenta features 8 MB SDRAM and 16 MB NOR flash, but it can be custom ordered with up to 64 MB of memory and 128 MB of flash should you need it. It’s also possible to delete various interfaces from the board when ordering, so if you don’t want network connectivity or the NXP SE050C2 crypto chip, they can simply be left off. However as of this writing it is unclear as to what minimum order quantity is necessary to unlock this level of customization, or or how much these modifications will change the unit cost.

Year of the Arduino Desktop?

The Portenta Carrier Board

The Portenta H7 is an impressive enough piece of hardware on its own, but when it’s plugged into the optional Carrier Board, things really start to get interesting. The Carrier Board provides full size connectors for all of the onboard peripherals, and according to documentation, turns the Portenta into an eNUC-class embedded computer. There’s even support for DisplayPort to connect a monitor, and miniPCI for expansion cards.

With a fully loaded Portenta H7 slotted into the Carrier Board, it would seem you have the makings of a low-power ARM “desktop” computer. Albeit one that wouldn’t outperform the Raspberry Pi Zero, and which costs several times more.

The Arduino press release and product page doesn’t make any mention of what kind of software or operating system said computer would run, so presumably that’s left as an exercise for the customer. While not particularly well suited to it, the ARM Cortex-M family of processors is capable of running the Linux kernel, so spinning up a “real” OS image for it should be possible. Of course with a maximum of just 64 MB of RAM, you’ll want to keep your performance expectations fairly low.

Where Does Portenta Fit?

We can’t even speculate what a maxed out Portenta would cost, and there’s no pricing or release date for the Carrier Board. But even at $99, the base model Portenta H7 would be a tough sell for hackers and makers who are used to buying dual-core ESP32 boards at 1/10 of the price, or the Teensy 4.0 which has a 600 MHz Cortex-M7 at 1/4 of the price. Which is fine, since this board isn’t intended for the traditional core Arduino audience.

Seeing the carrier board, we can’t help but notice some parallels here with the Raspberry Pi Compute Module. With connections broken out to a SODIMM header, the idea of the Computer Module was to help bridge the gap between the DIY community and the commercial one by offering up a Raspberry Pi in a more rugged form factor that would be easier to integrate into end-user products. But since it wasn’t any cheaper than the stock Pi, there wasn’t a whole lot of incentive to switch over. We haven’t seen consumer products advertising “Raspberry Pi Inside!” so it’s hard to tell if there has been any meaningful adoption from industry.

One has to wonder why any company that has the resources to integrate such an expensive board into their products wouldn’t just come up with their own custom design around the Portenta’s STM32H747XI chip, which even in single quantities, can currently be had for less than $15. The difference may end up coming down to the world-renowned community that surrounds the Arduino brand, and the company’s efforts to modernize their toolchain.

Arduino Polygraph Shows How It’s Done

Sometimes, a project comes along that makes a good reference design for anyone doing similar work. In this particular case, it’s a DIY USB polygraph-like machine by [Juangg] using an Arduino and sensors on the hardware side, and a Python front end for data visualization. It’s even complete with 3D printed enclosure and sensor elements.

[Juangg] designed it to use three sensors: a pulse sensor, a breath sensor, and one to measure Galvanic Skin Response (GSR). The pulse sensor uses a piezo element pressed against a fingertip to detect changes in pressure resulting from blood flow. It can be picky about placement, but finding sweet spot can yield remarkably good readings. The breath sensor works on a similar principle but uses a 3D printed fixture to hold the sensor between a strap and the subject’s chest, so that breathing in and out can be detected. The GSR sensor is a voltage divider used to measure small changes in skin conductivity. How well does it all work? That depends on what one is looking to get out of it, but the documentation and design files are available from the project page and the GitHub repository if anyone wants a reference for similar work.

The polygraph may have a mixed reputation, but it makes a good project that demonstrates just how messy biometrics can be from an engineering perspective. And in case you missed it, here’s a reminder that Wonder Woman and the polygraph have much more in common than you might realize.

Arduino python GUI led control

Hello Friends,

In this project, we are interfacing arduino with python. Arduino can be easily interfaced with python using serial communication (uart) via pyserial library. For GUI on python, we are using tkinter.

Let's start with the python script:
Libraries required: pyserial

It can  be esaily installed by: pip install pyserial

Python script:

import serial as s
import time as t
from tkinter import *
from tkinter import messagebox

ser = s.Serial('COM3', 9600, timeout=0)   # check your com port

def on():

def off():

def exit():
    ser.close() # close serial port

window = Tk()
window.title("                  ARDUINO MEETS PYTHON")
lbl = Label(window, text="Welcome to this project",fg='black',font=(None, 15)), rely=0.10, height=50, width=250)
bo = Button(window, text="LED ON", width=10 ,bg='red' ,command=on), rely=0.30, height=40, width=200)
cb = Button(window, text="LED OFF", width=10, bg='green' ,command=off), rely=0.40, height=40, width=200)
ext = Button(window, text="Exit", width=10, bg='white', command=exit), rely=0.50, height=40, width=200)

 Arduino code:

char a=0;
const int led=13;

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x3f,16,2);  // set the LCD address to 0x27 for a 16 chars and 2 line display

void setup() {

void loop() {




////// code ends here

Note: LCD is optional

Python GUI

Vintage Sewing Machine to Computerized Embroidery Machine

It is February of 2018. Do you remember what you were doing in December of 2012? If you’re [juppiter], you were starting your CNC Embroidery Machine which would not be completed for more than half of a decade. Results speak for themselves, but this may be the last time we see a first-generation Raspberry Pi without calling it retro.

The heart of the build is a vintage Borletti sewing machine, and if you like machinery porn, you’re going to enjoy the video after the break. The brains of the machine are an Arduino UNO filled with GRBL goodness and the Pi which is running CherryPy. For muscles, there are three Postep25 stepper drivers and corresponding NEMA 17 stepper motors.

The first two axes are for an X-Y table responsible for moving the fabric through the machine. The third axis is the flywheel. The rigidity of the fabric frame comes from its brass construction which may have been soldered at the kitchen table and supervised by a big orange cat. A rigid frame is the first ingredient in reliable results, but belt tension can’t be understated. His belt tensioning trick may not be new to you, but it was new to some of us. Italian translation may be necessary.

The skills brought together for this build were vast. There was structural soldering, part machining, a microcontroller, and motion control. The first time we heard from [juppiter] was December 2012, and it was the result of a Portable CNC Mill which likely had some influence on this creation. Between then, he also shared his quarter-gobbling arcade cabinet with us.

Simple Computer Gesture Control with Arduino and Python

As outlined in this Circuit Digest write-up, with the right hardware, you can now control your computer using hand gestures. While interesting, this kind of technology can be a little expensive. But if you’d like to augment your notebook or laptop via simple gesture capabilities without breaking the bank, B. Aswinth Raj has your answer in the form of an Arduino Uno and two ultrasonic sensors.

His system places the two sensors at the top of a screen, which are read by the Uno. This data is then passed on to a Python program running on the host computer that allows for actions such as play/pause, fast-forward, and volume control while watching videos.

Given the nature of the setup, there’s no reason why more sensors or programming couldn’t be added for further control, perhaps as shortcut “keys” for your favorite design software package! You can read more about the project here, and see a demo of it below.

Listening for Hand Gestures

[B. Aswinth Raj] wanted to control a VLC player with hand gestures. He turned to two common ultrasonic sensors and Python to do the job. There is also, of course, an Arduino. You can see a video of the results, below.

The Arduino code reads the distance from both sensors — one for the left hand and the other for the right. This allows the device to react to single hand gestures that get closer or further away from one sensor as well as gestures involving both hands. For example, raising your left hand and moving it closer or further away will adjust the volume. The right hand controls rewind and fast forward. Raising both hands will start or stop playback.

Of course, since the Arduino is reading the gestures you could change them to suit you. We might have mounted the sensors further back (or, perhaps, added more sensors) so you could use trigonometry to triangulate the hand’s exact position. Well, perhaps not exact, but you could get an idea of the hand’s motion from right to left as well as forward and backward.

On the host computer side, Python receives serial data from the Arduino and then simulates keystrokes to get the desired result. Of course, this is also highly customizable.

By coincidence, we did a similar project a few years ago using one sensor and the Arduino’s ability to appear like a USB keyboard. We’ve also seen 8 sensors making piano music.

Filed under: Arduino Hacks
Hack a Day 02 Nov 03:00

Arduino and Pi Breathe New Life into Jukebox

What do you do when someone gives you a Wurlitzer 3100 jukebox from 1969, but keeps all the records? If you are like [Tijuana Rick], you grab an Arduino and a Rasberry Pi and turn it into a really awesome digital music player.

We’ll grant you, making a music player out of a Raspberry Pi isn’t all that cutting edge, but restoration and integration work is really impressive. The machine had many broken switches that had been hastily repaired, so [Rick] had to learn to create silicone molds and cast resin to create replacements. You can see and hear the end result in the video below.

[Rick] was frustrated with jukebox software he could find, until he found some Python code from [Thomas Sprinkmeier]. [Rick] used that code as a base and customized it for his needs.

There’s not much “how to” detail about the castings for the switches, but there are lots of photos and the results were great. We wondered if he considered putting fake 45s in the machine so it at least looked like it was playing vinyl.

Of course, you don’t need an old piece of hardware to make a jukebox. Or, you can compromise and build out a replica.



Filed under: Arduino Hacks, Raspberry Pi


Primary image

What does it do?

Avoid obstacles with vision

Hardware overview is in the video with a better description.

Jetson TK1 processes images from the USB webcam and the two Raspberry Pi NoIR cameras then sends commands to the Arduino Mega in order to move autonomously around the environment avoiding obstacles.

The software is custom written and uses OpenCV for image processing.  No ROS, no SLAM, no neural nets or whatever.

Cost to build

Embedded video

Finished project


Time to build


URL to more information


C64 Keyboard Emulation Over Serial

There’s a lot of reasons you might want to emulate the keyboard on your Commodore 64. The ravages of time and dust may have put the original keyboard out of order, or perhaps you need to type in a long program and don’t fancy pecking away with the less-than-stellar feedback of the standard keys. [podstawek] has come up with the solution: a Commodore 64 keyboard emulator that works over serial.

It’s a simple concept, but one that works well. A Python script accepts incoming keypresses or pre-typed text, then converts them into a 6-bit binary code, which is sent to an Arduino over the serial connection. The Arduino uses the 6-bit code as addresses for an MT8808 crosspoint switch.

MT8808 Functional Diagram from Datasheet

The MT8808 is essentially an 8×8 matrix of controllable switches, which acts as the perfect tool to interface with the C64’s 8×8 keyboard matrix. Hardware wise, this behaves as if someone were actually pressing the keys on the real keyboard. It’s just replacing the original key switches with an electronic version controlled by the Arduino.

[podstawek] already has the setup working on Mac, and it should work on Linux and Windows too. There’s a little more to do yet – modifying the script to allow complex macros and to enable keys to be held – so check out the Github if you want to poke around in the source. Overall it’s a tidy, useful hack to replace the stock keyboard.

The C64 remains a popular platform for hacking — it’s even had a Twitter client since 2009.

Filed under: classic hacks, computer hacks

Raspberry Pi Project

Hey guys,

I'm starting out a project in which I want to build a Raspberry Pi Self Driving Robot. The basic tasks the robot will perform are:

  • Lane tracking using RPi Camera and OpenCV3 + Python
  • Obstacle detection with Ultrasonic sensor + input from RPi Camera(if possible)

The materials I currently plan to use in this project are:

read more

Let's Make Robots 01 Jan 15:42