The model on the left is inserted directly into the USB connector. Beware, hackers are using this model to create fake USB sticks, as it can simulate a keyboard.
The model on the right uses a USB-microUSB cable to connect to the PC. This is the model that I will use by itself the most comfortable.
I need a faster response (BT latency is not acceptable). Can I connect the board through USB to the phone and have Android read the usb value? And what's the attiny85 curse to put the reading of the buttons on the usb bus?
In case the above want clear: I need Android app to react immediately to the pushing of an external physical button.
Dear @David_Schkolnik,
are you really sure that the BT is not fast enough ?
Please take a look at this:
Even with the worst speed (1Mbps) we are talking about 100 bytes every 1 millisecond (let's suppose 1 start bit + 8 data bits + 1 stop bit => each byte = 10 bits). Since you want to respond to a pushbutton, this means that you have also to consider the human responsiveness to a stimulus.
Normally I use a clock with a 10 milliseconds period in AI2 to poll the incoming BT line. If nothing has arrived, the clock exits immediately, otherwise if characters have arrived, i fetch all data 'till the end of buffer. (put -1 as termination and LF as end of transmission from BT),
On the Arduino board set the baudrate toward the HC06 @115200 (9600 is 10 times slower)
I use this procedure to get data incoming from CAN bus (@500 Kbits/sec) and I don't lose any data.
Give it a chance.
Kind regards.
PS Sorry Juan_Antonio it seems that I answered to you instead of @David_Schkolnik
Thanks so much for your quick response. It's not the baud rate what hinders BT 's performance in this case but latency. Once data stats streaming through BT it can be fast, but the first package can take some milliseconds, and I don't have that time. But I'll give it a try with Arduino.
Hi David, (@David_Schkolnik)
sorry, I misunderstood , since you were talking about the possible use of a USB instead of the BT, I thought it was a problem of the BT speed. Anyway you can still have two possible causes of "first frame" latency: the Arduino code or the AI2. As I told in my previous post, a 10 millisecond timer (clock) is suitable to get fast data on AI2 side, provided that, when it detectcs a not empty buffer, it fetches all data stored therein.
Best wishes !
Cheers, Ugo.
Hello David - need to see your Blocks. The fastest way the App can receive data via BLE is by using the Register for [value type] Block. A timer is not then required. Ensure you have the latest MIT BLE Extension: https://www.professorcad.co.uk/appinventortips#TipsBluetooth
However, why on earth do you need to receive data so fast? Isn't it likely that you will end up receiving several rows of identical values?
Hi, thanks for your response.
I don't need to receive so much data. When a physical button is pressed, I need the device to read an analogy value and send it ASAP. What's important is the time from button pushed to Android receiving data.
Dear @David_Schkolnik,
would it be possible for you to share your Arduino code please ?
It's becoming interesting why you have "latency" between the button push and the display on the phone.
Assumed that it's not a BT baudrate issue, nor a clock timing on AI2 (as I told previously I can get data as fast as 10ms), now it is the turn to take a look to the sender (the Arduino )
Do you apply some filtering routine when you acquire the pushbutton ? Are you waiting for some kind of handshake ?
Cheers, Ugo.