arduino-uno


Baud rate arduino


I am implementing a simple visible light communication module with two arduinos, as transmitter and receiver, with a short text message consisting of 120 characters. I have used Manchester encoding with on-off -keying modulation.
Altogether, in my message frame, with Manchester encoding and with preambles and end-of-frame byte, there are 2480 bits. I have set one bit period to be 500 micro second. In the receiver side I am sampling this bit four times, at (500/4) 125 micro seconds. From my knowledge, since each bit is 500 us, there are 2000 bits/s that are being transmitted from the transmitter so a baud rate of 9600 bits/s should work. However, 9600 is not working and any baud rate above 38400 upto 115200 is working and I can properly decode this short message in my receiver.
Can anyone please explain me the behavior? Why is baud rate of 9600 not working though I am only transmitting 2000 bits per second.
Further information, I have set the prescalar to 128, so the ADC sampling frequency is (16MHz/128)/13 = 9.6kHz.
Thank you very much.
When you suddenly started talking about "baud rates", it implied that you're using the Hardware Serial port on the Arduino. If so, then realise that feeding 2,000 bits per second (bps) into a device expecting 9,600 bps has problems.
The way that an Asynchronous UART works is that it waits for a start signal (bit), then decodes the next (typically) 9 signals at the current bit rate. It then checks that the 9th bit is a stop bit; if it isn't, it discards the byte.
Since you're only changing every 9600/2000 = 4.8 bits, then odds on the 9th "stop" bit will be of the wrong sense, and the data will be lost.
I'm going to draw an ASCII diagram (I don't have the resources necessary for some of the gorgeous diagrams I've seen on this site...) for the timing that I'm talking about.
I'll use the bitstream 00101101 for the signal produced by the circuit, with a . as a 0ms separator between bits;
I'll use a ^ to point out where the UART is sampling the bits;
I'll use a * to indicate a "correct" byte (insofar as the byte ends in a correct stop bit);
I'll use a ! to indicate an "incorrect" byte (insofar as the byte ends in an incorrect stop bit);
Of course, I'll assume a baud rate of 10,000bps (5 rather than 4.8...)
00000.00000.11111.00000.11111.11111.00000.11111
^^^^^.^^^^!.......^^^^^.^^^^*.......^^^^^.^^^^*
This sequence would result in the UART recording the following 3 bytes:
Error
0xF0 (LSb first is defined...)
0xF0 (LSb first is defined...)

Related Links

upload a programme to Arduino-uno gives error “could not find any usb device”
Arduino UNO(9600) with Wizfi250 cannot send data to Ubidots
How to wire a 12V double solenoid to an Arduino?
Receiving data automatically in wifi(ESP8266) Even though connected my mobile with ESP8266
How to copy string (char*) from Flash to RAM with strcpy_P
LED's won't light up with Arduino
Every function executes on Arduino reset
What is the output of this arduino code?
Shield L6474 and motor equiped with a reducer
NRF24L01+PA+LNA (Transciever) not communicating between two arduinos
Can't program Arduino 328P after first time use of ICSP Sparkfun AVR Pocket Programmer
Arduino uploading issue: “avrdude: no programmer has been specified on the command line or the config file”
Code is showing multiple object declaration error during multiple file compilation
arduino wifi upload google spreadsheet
How to solve error compiling an arduino sketch?
load image in the TFT lcd screen without SD card

Categories

HOME
wso2-am
bluetooth
onedrive
setup-deployment
react-redux
malloc
rdf
callback
fingerprint
swagger-ui
bs4
nano-server
midi
row
qt-creator
vb.net-2010
decimal
windows-7-x64
reactive-cocoa
plunker
conemu
autocad-plugin
scriptcs
tokenize
tibco-mdm
icloud-api
java-7
h2db
fifo
typo3-6.2.x
elasticsearch-net
srcset
jspresso
framemaker
adobe-premiere
hockeyapp
jna
squib
jvm-languages
bootstrap-dialog
import-from-excel
slick-3.0
filepicker
sqlclient
qtwebview
jquery-filter
firmata
removechild
home-directory
adxstudio-portals
skobbler-maps
impresspages
lttng
sigabrt
fadeout
wso2cloud
endeca-workbench
wireshark-dissector
dukescript
createprocessasuser
key-management
javax.mail
rake-task
xc16
coldbox
issuu
article
contenttype
java.nio.file
monomac
intentservice
c18
access-rights
dataservice
shellexecute
mqx
enterprisedb
free-variable
funscript
spring-portlet-mvc
subscript
nsdatecomponents
zpt
vdsp
xmemcached
file-comparison
floating
lpeg
gamequery
getresponsestream
filtered-index
bespin
perfect-hash
ncqrs
database-management
substrings
boost-smart-ptr
privilege
temporal-database
nerddinner
sector
geneva-server
ajax-forms

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App