Pi-naps :: Tutorial _ 2

In this we take a closer look at setting up Pi-Naps to better tailor the setup to our use cases.

We are covering a small set of functions that configure the data and communication of the EEG sensor on Pi-Naps.

We'll assume you have setup your Raspberry Pi ready to work with Pi-Naps. If not click the button below:

Tutorial _ 2 :: Modes.py

Tutorial 2 will begin by showing you how to start getting and using data from Pi-naps' EEG sensor.

You are free to write your own script using this tutorial as a guide or simply clone the examples available on our GitHub.

To handle EEG data from Pi-Naps, we need to make use of two simple libraries made to interact with the Pi-Naps shield.

The First is the Pi-Naps Controller.

The Pi-Naps controller. The Pi-Naps controller allows you to interact with the Pi-Naps shield; read data, configure the board and control any built in features.
We designed to be flexible in order to maximise compatibility with other projects. The trade off for this, is that a little setup is required. For most cases, this is very simple and just requires calling a few of functions:

There are three sets of functionality to configure:

Control Interface

The control interface is the setting describing how the Raspberry Pi and Pi-Naps shield should comunicate. You may control the shield using the I2C bus (which is recomended for full featured operation), or using the GPIO pins.

In general, we recommend using the I2C setting and would only change this, if we had a specific reason to completely reserve the I2C bus. This tutorial only covers the general use and handling of data - but we will discuss configuring I2C settings in a future tutorial, in the interest of operating with other devices communicating over I2C.

EEG Sensor Interface

The EEG sensor interface allows you to set the pins over which the EEG data itself is transfered. Again we recomend I2C for this, however this can also be set to use UART. Again, this is done to allow for avoiding collisions with other projects or devices.

Setting the Mode

The Pi-Naps mode is more important in terms of your application. This configures what data the EEG sensor produces. Notably: The Rasberry Pi Zero can currently only operate in Basic Mode.

For most applications, basic mode is the most useful as it has a lower power draw and provides the most useful data points to work with the processing power of the Pi Zero. We are exploring options for unlocking the other modes on the Pi Zero though - so stay tuned and ge tin touch if you have questions.

The Modes are as follows:

Basic Mode:

Basic mode provides the following data points:

- Signal Quality

- Meditation Value

- Attention Value

- EEG powers ( FFT )


Raw EEG mode provides the following data points:

- Signal Quality

- Meditation Value

- Attention Value

- Raw EEG Signal

- EEG powers ( FFT )

Pinaps Initialisation:

By considering what we have discussed above we can configure the Pi-Naps shield with just a handful of function calls, yet this allows for the device to be configured a variety of ways to suit all kinds of setups.

We can even reconfigure the system on the fly.

We provide a brief example that allows us to demonstrate this which you can download from our examples repo on github.

Try it with the following commands:

© 2018 by Blino ltd.

  • White Twitter Icon
  • White Facebook Icon
  • White LinkedIn Icon