The Binho Nova Multi-Protocol USB Host Adapter allows you to interface your computer directly to hardware circuits. This device is powered by the USB connection to the host PC and is also able to provide downstream power to test circuits. The following guide details how to use a Binho Nova with CircuitPython libraries to interface with sensors and components via I2C (Inter-Integrated Circuit), SPI (Serial Peripheral Interface), GPIO's (General Purpose Input/Output), or UART (Universal Asynchronous Receiver/Transmitter).

Parts

The Binho Nova Multi-Protocol USB Host Adapter allows you to interface your computer directly to hardware circuits. This device is powered...
$229.00
In Stock

And things we'll be connecting to!

Bosch has stepped up their game with their new BME280 sensor, an environmental sensor with temperature, barometric pressure and humidity! This sensor is great for all sorts...
$14.95
In Stock
Need some big indicators? We are big fans of these huge 10mm diffused green LEDs. They are fairly bright so they can be seen in daytime, and from any angle. They go easily into a...
$4.95
In Stock
This is a cute half-size breadboard with an assortment of small jumper wires, great for prototyping. The breadboard is 2.2" x 3.4" (5.5 cm x 8.5 cm) with a standard...
$9.95
In Stock
Just about all electronics use TTL serial for debugging, bootloading, programming, serial output, etc. But it's rare for a computer to have a serial port anymore. This is a USB to...
$19.95
In Stock

Prerequisites:

Python 3 Installed with pip. If you do not have Python 3 installed, you can get it for free for major platforms on python.org.

Verify pip:

C:\Binho\adafruit>pip --version
pip 19.3.1 from c:\program files (x86)\python38-32\lib\site-packages\pip (python 3.8)

 

Step 1: Setup Binho Nova Host Adapter hardware

The Binho Nova Multi-Protocol USB Host Adapter utilizes the standardized USB Communications Device Class driver in order to achieve maximum compatibility with as many systems as possible. As such, there's no driver to download and install for most modern operating systems (OS). 

Certain operating systems, like Mac and Ubuntu, may require additional permissions to start using Binho Nova. In addition, Windows 7 does not have the standard USB CDC driver included as default. 

Please check the following guide to setup permissions on Mac\Ubuntu and Windows 7 driver setup:

https://support.binho.io/user-guide/using-the-device/software-installation

 

Step 2: Install the Binho Host Adapter Libraries

The following command will install the binhoHostAdapter Python library.

pip install binho-host-adapter

Verify Nova can communicate with binhoHostAdapter Python library:

C:\Binho\adafruit>python
Python 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:21:23) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from binhoHostAdapter import binhoUtilities
>>> devices = binhoUtilities.binhoUtilities().listAvailableDevices()
>>> print(devices)

['COM8']

 

Step 3: Install Adafruit Blinka

pip install adafruit-blinka

 

Step 4: Set BLINKA_NOVA environment variable

In order for Adafruit blinka libraries to use Binho Nova, set the BLINKA_NOVA environment variable with the following command.

Windows Command line:

set BLINKA_NOVA=1

Windows Powershell:

$Env:BLINKA_NOVA = "1"

Mac/Ubuntu:

export BLINKA_NOVA=1

Verify Binho Nova’s environment variable is set and the Adafruit Blinka libraries can recognize and communicate with the adapter:

C:\Binho\adafruit>set BLINKA_NOVA=1

C:\Binho\adafruit>python
Python 3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:21:23) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import board
>>> dir(board)
['I2C', 'IO0', 'IO1', 'IO2', 'IO3', 'IO4', 'MISO', 'MOSI', 'RX', 'SCK', 'SCL', 'SCLK', 'SDA', 'SPI', 'SS0', 'SS1', 'TX', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'ap_board', 'board_id', 'detector', 'pin', 'sys']
>>>

 

Below you will find the pinout for the Binho Nova Multi-protocol host adapter. We have labelled the pinout on the Breadboard Breakout accessory that comes with each Nova as this is most likely how you would connect your Nova to any hardware project you might be working on.

The  examples following this page show just how easy it is to use a Binho Nova with many of CircuitPython's readily available sensors and their Python libraries along with example code.

We will be providing examples on how to use the following CircuitPython packages:

  • busio SPI to talk to a temperature/barometric pressure/humidity sensor
  • busio I2C to talk to a temperature/barometric pressure/humidity sensor
  • digitalio GPIO to toggle an LED
  • pulseio PWM (Pulse Width Modulation) to change the brightness of an LED
  • busio UART to send and receive messages from a terminal application

Setup

In this example, we will be using the Bosch BME280 temperature, barometric pressure, and humidity sensor which has an Adafruit CircuitPython library.

Install circuitpython bme280 python library:

pip install adafruit-circuitpython-bme280

Bosch has stepped up their game with their new BME280 sensor, an environmental sensor with temperature, barometric pressure and humidity! This sensor is great for all sorts...
$14.95
In Stock

Setup

 

Pin connections from Nova to BME280

  • Nova IO0 to CS
  • Nova IO2 to SDO
  • Nova IO3 to SCK
  • Nova IO4 to SDI
  • Nova 3V3 to VIN
  • Nova GND to GND

Example code:

This example uses Adafruit’s digitalio package to create a DigitalInOut object for the Chip Select Pin and the busio package to create an SPI object.

import time
import board
import digitalio
import busio
import adafruit_bme280

# Create library object using our Bus SPI port
spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
bme_cs = digitalio.DigitalInOut(board.IO0)
bme280 = adafruit_bme280.Adafruit_BME280_SPI(spi, bme_cs)

# change this to match the location's pressure (hPa) at sea level
bme280.sea_level_pressure = 1013.25

while True:
  print("\nTemperature: %0.1f C" % bme280.temperature)
  print("Humidity: %0.1f %%" % bme280.humidity)
  print("Pressure: %0.1f hPa" % bme280.pressure)
  print("Altitude = %0.2f meters" % bme280.altitude)
  time.sleep(2)

 

Pin connections from Nova to a BME280:

  • Nova IO0 to SDI
  • Nova IO2 to SCK
  • Nova 3V3 to VIN
  • Nova GND to GND

Example code

This example uses Adafruit’s busio package to create an I2C object.

import time
import board
import busio
import adafruit_bme280

# Create library object using our Bus I2C port
i2c = busio.I2C(board.SCL, board.SDA)
bme280 = adafruit_bme280.Adafruit_BME280_I2C(i2c)

# change this to match the location's pressure (hPa) at sea level
bme280.sea_level_pressure = 1013.25

while True:
  print("\nTemperature: %0.1f C" % bme280.temperature)
  print("Humidity: %0.1f %%" % bme280.humidity)
  print("Pressure: %0.1f hPa" % bme280.pressure)
  print("Altitude = %0.2f meters" % bme280.altitude)
  time.sleep(2)

Example use

In this example, we show you how to complete the "Hello World" of hardware: blinking an LED. We will also show you how to PWM the LED.

Setup

Use a small resistor, about 150 ohms (give or take) and a green LED on a breadboard.

 

 

Pin connections to LED:

  • Nova IO0 to LED Anode (+)
  • LED Cathode (-) to Resistor
  • Resistor to GND

This example uses the Adafruit’s digitalio package to create a DigitalInOut object.

The LED should blink with on and off times of a half second.

import time
import board
import digitalio

led = digitalio.DigitalInOut(board.IO0)
led.direction = digitalio.Direction.OUTPUT

while True:
    led.value = True
    time.sleep(0.5)
    led.value = False
    time.sleep(0.5)

This example uses the Adafruit’s pulseio package to create a PWMOut object.

import time
import board
import pulseio

led = pulseio.PWMOut(board.IO0, frequency=5000, duty_cycle=0)

while True:
    for i in range(100):
        # PWM LED up and down
        if i < 50:
            # Up
            led.duty_cycle = int(i * 2 * 65535 / 100)
        else:
            # Down
            led.duty_cycle = 65535 - int((i - 50) * 2 * 65535 / 100)       
        time.sleep(0.01)

Example demo

The following UART example uses a TTL-234X-3V3 FTDI cable (compatible with Adafruit product FTDI Serial TTL-232 USB Cable).

Setup

 

 

Pin Connections to FTDI cable:

  • Nova IO4 (TX) to FTDI RX (Yellow)
  • Nova IO3 (RX) to FTDI TX (Orange)
Just about all electronics use TTL serial for debugging, bootloading, programming, serial output, etc. But it's rare for a computer to have a serial port anymore. This is a USB to...
$19.95
In Stock

This example uses Adafruit’s busio package to create a UART object. It will read 3 characters from the FTDI cable which CoolTerm (Windows) or other terminal emulator is connected to.  The script then sends ‘hello world’ to the FTDI cable which will display in the terminal.

import board
import busio

uart = busio.UART(board.TX, board.RX, 115200, 8, None, 1, 1000)
data = uart.read(3)
# convert bytearray to string
data_string = ''.join([chr(b) for b in data])
print(data_string, end="")
uart.write('hello world')
uart.deinit()

This guide was first published on Dec 18, 2019. It was last updated on Dec 18, 2019.