Coder Social home page Coder Social logo

electricityforprogress / biodatafeather Goto Github PK

View Code? Open in Web Editor NEW
40.0 5.0 5.0 6.85 MB

Biodata Sonification Device using a 555 timer and Adafruit ESP32 allowing BLE and RTPMIDI via wifi

License: MIT License

C++ 100.00%
esp32 biodata sonification plants

biodatafeather's Introduction

BiodataFeather

Feather daughter board for the Adafruit ESP32 and Huzzah (and others), allowing BLE and RTPMIDI via wifi. Still a work in progress, and can provide the framework for anyone to use other Adafruit Feather boards Lots of Biodata information on my website electricityforprogress.com See also the project submission on Hackaday.io

3D Enclosure Model: https://www.tinkercad.com/things/8HZnh0ERNtr-biodata-wifi-snap-enclosure

Menu Modes:

From normal Biodata mode, by pressing the button you will enter into the Menu selection where you can turn the knob to select different menus listed below. When the desired menu color is illuminated click the button and continue to turn the knob to choose a value. Click a final time to select the value and return to Biodata Mode. Selections are saved and reloaded each time you turn on the device. To 'hard reset' press and hold the button while turning on the device, after the light show the White led will display and the factory default settings are applied (Chromatic Scaling, Channel 1, Bluetooth ON, Wifi OFF).

Red - Note Scaling - Entering this mode will illuminate the Red LED, by turning the knob one of the other LEDs will flash indicating a different Note Scaling. Flashing Red = Chromatic, Orange = Minor, Green = Diatonic Minor, Blue = Major, White = Indian

Orange - MIDI Channel - Entering this mode will illuminate the Orange LED, by turning the knob different combinations of the LEDs are used to display the MIDI Channel in 'Binary'.  MIDI Channel can be configured between 1-16, each of the 5 LEDs are used to display the MIDI channel chosen where 1 = 1xxxx, 2 = x1xxx, 3 = 11xxx, etc. The MIDI Channel can then be saved by pressing the button.  So far, this MIDI selection method has been a big PiTA for users, but it is kinda clever.

Green - Wifi On/Off - This mode turns on and off Wifi, default is off. Control is similar to the Bluetooth mode.  If you have uploaded code with your wifi credentials, you can connect to WiFi MIDI

Blue - Bluetooth On/Off - This mode turns on and off Bluetooth, default is ON.  The Blue LED will illuminate and either the Red LED (indicating off) or White LED (indicating on) can be selected by turning the knob.  Press the button again to save the setting.

White - Battery Level - Entering into this mode will display the battery charge percentage by illuminating the white LED and one of the other colors will flash.  Flashing blue = 100%, green = 80%, Yellow = 50%, Green = 30%

biodatafeather's People

Contributors

electricityforprogress avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

biodatafeather's Issues

BiodataFeather board question: substitute for 3.9K timer resistor? Also, NE555 vs LM555 chip tradeoffs?

Hi Sam - I had a question on a resistor value for the LM555 timer chip: what can I substitute for the 3.9K resistor? I have 3.3K or 4.7K resistors, but unfortunately I don't have any 3.9K resistors. Can I substitute one of those values for the 3.9K?

Also, I'm ordering some LMC555CN timer chips, but I have lots of NE555 chips. I was planning on temporarily using the NE555 timer chip in the socket while I wait for the LMC555CN chips.

What are the drawbacks for using the NE555 chip? I read that the NE555 chip is less stable over temperature and time. Will this cause glitching in the biodata?

Thanks again for all the great work on the BiodataFeather! It's awesome to have this as an open-source project.

Request: code to enable double-click, long-click on buttons

I'm looking to add the ability to enable and disable some additional options for the Biodata Feather interface (extra CC messages, AP setup), and it would be great to turn on/off these options with a double-click or long-click.

It appears that the samButton class was partially set up to support these functions, but I don't think it was fully enabled. Would you post the additions/updated samButton class to add these abilities?

Optoisolator alternative?

This Optoisolator:

CNC1S171S0LF	Panasonic Electronic Components	OPTOISOLATOR 5KV TRANSISTOR 4DIP

seems to be obsolete and not manufactured anymore:
https://www.digikey.de/en/products/detail/panasonic-electronic-components/CNC1S101/970631
However I found the R0 instead of the S0:
https://www.digchip.com/datasheets/parts/datasheet/2099/CNC1S171R0LF.php

The specs seem to be the same: https://www.findchips.com/parametric/Optoelectronics/Optocoupler?term=CNC1S171S0LF&Manufacturer%20Part%20Number=cnc1s171*

Values not changing or result not accurate

Hi

I'm hoping I get some response here even though the project is still not very much alive anymore.

But I'm making a simplified version of the project and stuck with the results being the same.

I'm using the breadboard example here. (I have all the parts for the PCB board too but, unable to recreate it with perfboard, my schematic reading isn't very good as I am no a very technical person)
Breadboard example

This is my code

/*----------------------------------------------------------
   Everything for OSC && WiFi
  ----------------------------------------------------------*/

#if defined(ESP8266)
#include <ESP8266WiFi.h>        // Include the Wi-Fi library
#else
#include <WiFi.h>
#endif
#include <WiFiUdp.h>            // UDP library
#include <OSCMessage.h>         // OSC library
#include <OSCBundle.h>

#include <Wire.h>



WiFiUDP Udp; // A UDP instance to let us send and receive packets over UDP
//const IPAddress outIp(192, 168, 0, 234); // remote IP of your computer

const unsigned int outPort = 4560; // remote port to receive OSC
const unsigned int localPort = 8888; // local port to listen for OSC packets (actually not used for sending)


// Sensor and analysis setup
const int sensorPin = A0; // Wemos A0 gpio
const byte samplesize = 10;
volatile unsigned long samples[samplesize];
volatile byte SampleIndex = 0;
float threshold = 2.3; // Adjust as necessary


void setup()
{
    Serial.begin(115200);
    delay(10);
    Serial.println('\n');

    WiFi.begin(ssid, password);             // Connect to the network
    Serial.print("Connecting to ");
    Serial.print(ssid); Serial.println(" ...");
    
    int i = 0;
    while (WiFi.status() != WL_CONNECTED) { // Wait for the Wi-Fi to connect
    delay(1000);
    Serial.print(++i); Serial.print(' ');
    }
    Serial.println('\n');
    Serial.println("Connection established!");
    Serial.print("IP address:\t");
    Serial.println(WiFi.localIP());         // Send the IP address of the ESP8266 to the computer
    
    Serial.println("Starting UDP");
    Udp.begin(localPort);
    Serial.print("Local port: ");
    #ifdef ESP32
      Serial.println(localPort);
    #else
      //Serial.println(Udp.localPort());
    #endif

  // Sensor setup
  pinMode(sensorPin, INPUT);
  Serial.println("Setup complete");

}

/*----------------------------------------------------------
    Galvano sensor  loop
  ----------------------------------------------------------*/
void loop() {
  // If the samples array is full, analyze the sample
  if (SampleIndex >= samplesize) {
    analyzeSample();
  }

  // Read sensor data
  if (SampleIndex < samplesize) {
    samples[SampleIndex++] = analogRead(sensorPin);
    delay(5); // Delay between samples
  }
}

void analyzeSample() {
  unsigned long sum = 0;
  unsigned long maxVal = 0;
  unsigned long minVal = 4294967295; // Max unsigned long
  float stdDev = 0;

  for (byte i = 0; i < samplesize; i++) {
    sum += samples[i];
    if (samples[i] > maxVal) maxVal = samples[i];
    if (samples[i] < minVal) minVal = samples[i];
  }

  float avg = sum / (float)samplesize;
  for (byte i = 0; i < samplesize; i++) {
    stdDev += pow(samples[i] - avg, 2);
  }
  stdDev = sqrt(stdDev / samplesize);

if ((maxVal - minVal) > (stdDev * threshold)) {
    OSCMessage msg("/sensor/change");
    msg.add((float)avg); // Casting to float
    Serial.println(avg);
    msg.add((int)maxVal); // Casting to int
    Serial.println(maxVal);
    msg.add((int)minVal); // Casting to int
    Serial.println(minVal);
    msg.add((float)stdDev); // Casting to float
    sendOSCMessage(msg);
  }


  SampleIndex = 0; // Reset index for next samples
}

void sendOSCMessage(OSCMessage &msg) {
  Udp.beginPacket(outIp, outPort);
  msg.send(Udp); // Send the message
  Udp.endPacket(); 
  msg.empty(); // Free space occupied by the message
  Serial.println("OSC message sent");

}

Replaced every piece of the board incase something might be faulty (tried three different Wemos boards)
Quadrupple checked my wiring

This is the output of the serial monitor:

2 3 4 

Connection established!
IP address:	192.168.0.114
Starting UDP
Local port: Setup complete
2.60
4
2
OSC message sent
0.80
2.50
4
2
OSC message sent
0.67
2.70
4
2
OSC message sent
0.78
2.70
4
2
OSC message sent
0.78
2.70
4
1
OSC message sent
1.00
2.70
4
2
OSC message sent
0.78
2.70
4
2
OSC message sent
0.78
2.90
3
2
OSC message sent
0.30
2.40
4
2
OSC message sent
0.66
2.50
4
2
OSC message sent
0.81
3.00
5
2
OSC message sent
0.89
2.50
3
1
OSC message sent
0.67
2.50
4
2
OSC message sent
0.67
2.60
4
2
OSC message sent
0.80
2.60
4
2
OSC message sent
0.66
2.60
4
2
OSC message sent
0.66
2.80
4
2
OSC message sent
0.75
2.80
3
2
OSC message sent
0.40
2.50
4
2
OSC message sent
0.81
2.50
4
2
OSC message sent
0.67
2.80
3
2
OSC message sent
0.40
2.50
4
2
OSC message sent
0.67
2.50
4
1
OSC message sent
0.92
2.70
5
2
OSC message sent
0.90
2.70
4
2
OSC message sent
0.78
2.60
4
2
OSC message sent
0.66
2.90
4
2
OSC message sent
0.70

This is what I get when I use the perfboard:

When I used my soldered version I get nothing..

@
IMG_1966
IMG_1967
IMG_1968
IMG_1969
IMG_1970
IMG_1971

Update on ESP32-S3: compiled!

Hi Sam - I wanted to give you an update on my progress with the BiodataFeather code.

The good news: I've compiled the code for the ESP32-S3 chip, and uploaded it successfully!
More good news: When I first plugged the ESP32-S3 into my Mac, it was immediately recognized as a "keyboard" (native USB works!).
Even more good news: I can connect to the board via BLE.

The bad news: It's not connecting to the network. Here's the error it's giving:

[WiFiUdp.cpp:219] parsePacket(): could not receive data: 9

I'll be digging into it to see if I can get it to connect to the WiFi successfully. I'm also going to try adding the WiFi Manager code so I can let other people use the interface on their network.

Which pins are beings use for Serial1?

Latest update: I have the captive portal working for WiFi for general configuration.

I think I've run into a limitation with the current ESP32-S3 SDK, because using the Serial1 port seems to crash. There might be a workaround if I explicitly define the Serial1 pins. Which pins on the Feather are you using so I can try out this workaround?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.