Need a Digital to USB UART bridge with high baud rates

Hello fellow programmers,

I am looking for a board that needs to do just one simple job.:
It needs to read the state of a digital Pin -> buffer the input until it has amounted one byte (8 Inputs of either 0 or 1) -> send the byte serially over a USB Plug at at least 500.000 baud.

At the moment i am using an arduino nano and the following code to read the read the state of a connected 433Mhz receiver data Pin and it works perfectly fine. I am receiving up to 50.000 bytes per second on my PC. But for this small task i dont need a whole arduino nano that could do so much more. Its a huge overkill. So i am looking for smaller alternatives.

#include <digitalWriteFast.h>

byte bufferbyte = 0;
int bufferCount = 0;

void setup() {
  Serial.begin(2000000); 
  pinMode(2, INPUT);
}

void loop() {
  
  uint8_t rawInput = digitalReadFast(2);
  
  bufferbyte = (bufferbyte << 1) | rawInput;
  bufferCount++;

  if (bufferCount == 8) {
    Serial.write(bufferbyte);
    bufferCount = 0;
  }
}

I got myself this CH340 USB Interface Concerter: USB interface converter | Joy-IT
But it doesnt really do the job. I am able to receive some data but its way too little to work for my project. I thought that i could programm the CH340 microcontroller in that bord to execute the code above, but i found no way to do so. If someone knows weather its possible to do so and could tell me how to it would be very helpful.

I then stumbled across a ATtiny85 board. This one could execute my code but i am not sure if it can support the high baud rate i need. I need to know the max baud rates this board supports with a very low error rate but dont know how i can find it.

When someone has a suggestion for a device that is pricewise and sizewise like a ATtiny85 i would be glad to hear it.

For further context if needed:
I am trying to reliably receive 433Mhz signals without using premade libraries by analyzing the raw digital output of a 433Mhz receiver. I am filtering the noise and identifying the signals of either doorbells or garage door openers. I want all the processing to be done on my PC thats why i need a device that can transmitt the raw digital data the receiver gives me to my PC as fast as possible. To distinguish the signal from noise a resolution of 50.000 byte (400.000 bit) per second is suitable.

And to complete the context here is the code i wrote in python to evaluate the amount of bytes i receive per second:

import serial
import time

ser = serial.Serial('COM3', 2000000)

countnoise = 0
count = 0
start_time = time.time()

while True:
   
    data = ser.read()#Read the serial input byte by byte saves it form of b'\x00' 
   
    data = bin(int.from_bytes(data, byteorder='big'))[2:].zfill(8)#conversts the byte into a binary String

    count += 1#Counter total bytes received
    
    if time.time() - start_time >= 1:#Loops every second once
        
        print("Data signals per second:", count)
        
        count = 0
        start_time = time.time()

Thanks in advance for everyone that tries to help me !!

Why not,

use an available rate like 115200, and collect only transitions, attach microsecond time stamps to those, and then pass those to the PC. That is how I successfully analyzed IR signals with brute force code, no library.

USB has NO baud. IT uses a fixed length message. 60 bytes, as I recall. Your serial data is packed into one message until the USB timeout occurs or the record is filled, and then the message goes to the PC. Same process for sending back to the Arduino. All goes at whatever speed your USB connection uses.

That is a quite good idea,

I just thought that any code i put in my arduino loop that takes some time to process would slow down the rate at wich i check the digital Pin to my receiver and so lower the resolution. But transforming the raw data into the Intervalls at wich they are low or high will definetly save me a lot of serial.write()-time as well.
I will definetly try this. Thanks for the advice !

I'm wondering why a simple logic analyzer didn't work

It would actually raise the resolution, because the processing you mention, can be made independent of the microsecond time stamps, which would eliminate any inaccuracy due to latency in transmitting the data.

It would be crazy to write this without using interrupts.

You can even achieve sub-microsecond accuracy by using the input capture feature of an MCU hardware timer.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.