here you can exchange knowledge and designs
Write comments

Interfacing ADS1299 with Arduino Uno and BrainBay

Sat 13. Jan 2024, 06:51

Greetings Everyone !
I am Acquiring EEG signals using ADS1299 by Texas Instruments (24 bit ADC (8channels / 1 reference/1 bias) and Arduino Uno for the Hardware. Software is BrainBay. Is it possible to use BrainBay Along With ADS1299EEGFE Evaluation Module Which is interfaced with SPI with Arduino Uno. If so, then please provide me the instructions to use it and the Settings and Configuration applicable. Also if any Pre Configured design file is available , then please suggest me.

Thank You

Sat 13. Jan 2024, 06:51

Re: Interfacing ADS1299 with Arduino Uno and BrainBay

Sat 11. May 2024, 20:57

You could emulate a supported communication protocol via UART (for example the P2 protocol).
instead of using analogRead() to get the signal values from the internal ADC, you would use the SPI interface of the external ADS1299.
(note that P2 is limited to a resoltion of 16 bits)

here i send you an example code which sends P2-compatible data packets,
here an i2c-ads (ADS1115) is used. You could modify this code to use the SPI interface instead:

<----------------------

// see https://github.com/tonysteinbock/avr-ads1115
// https://arduino-projekte.webnode.at/mei ... c-ads1115/
// https://learn.adafruit.com/adafruit-4-c ... /downloads
// https://cdn-shop.adafruit.com/datasheets/ads1115.pdf
// https://github.com/pietern/avr-i2c

#define F_CPU 16000000

#include <avr/io.h>
#include <util/delay.h>
#include <stdio.h>

#include "i2cmaster.h"
#include "ads1115.h"


/** ++++++++++ UART functions ++++++++++ */
void uart_init (uint32_t baudrate)
{
uint16_t ubrr = (F_CPU / 8 / baudrate) - 1;
UBRR0H = (uint8_t) (ubrr >> 8);
UBRR0L = (uint8_t) (ubrr & 0xff);
UCSR0A |= (1 << U2X0); // "double speed" (bit 1)
UCSR0B |= ( 1 << TXEN0); // enable UART transmit
UCSR0B |= ( 1 << RXEN0); // enable UART receive
}

void uart_transmit (uint8_t data)
{
while ( (UCSR0A & (1 << UDRE0)) == 0); // warten, bis bit UDRE0 (bit 5) in UCSR0A 1 wird -> free to send !
UDR0 = data; // data senden !
}

uint8_t uart_receive ()
{
while ( (UCSR0A & (1 << RXC0)) == 0);
return (UDR0);
}


int main(void)
{
uint8_t P2[17] = {0xa5,0x5a,0x02};

uart_init(115200);
i2c_init(400000);
TCCR1B = 2; // start timer1, prescaler 8 -> 2 MHz!

while (1)
{

TCNT1 = 0;
int16_t val = ads1115_readADC_SingleEnded(0x48, 0, ADS1115_DR_860SPS, FSR_6_144);
if (val<0) val=0;
uint16_t time = TCNT1 >> 1; // get duration in uS
uint16_t mV = ads1115_conv2mV(val, FSR_6_144);

P2[3]++;
P2[4]=val>>8;
P2[5]=val&0xff;

for (int i=0;i<17;i++) uart_transmit(P2[i]);

// 200Hz -> 5ms until next conversion!
while (TCNT1 < 2000 * 5);
}
}
Write comments




Bei iphpbb3.com bekommen Sie ein kostenloses Forum mit vielen tollen Extras
Forum kostenlos einrichten - Hot Topics - Tags
Beliebteste Themen: Bands, NES, Audi, Otto, Song

Impressum | Datenschutz