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 !!