Raspberry Pi 3 UART Problem /ttyS0
Nowadays, i am working in a project and i am preparing a competition which as known as UAVTurkey. The competition is fundraising by TUBITAK. TUBITAK means "Scientific and Technological Research Council of Turkey" My task is communicate arduino and raspberry pi 3 via uart. we have only rx tx and ground cables. It looks simple. The first time I heard it, I thought so too. The youtube, stackoverflow or raspberry pi support forums are big change for me or the beginners. But I had had some problems.
In Raspberry pi 3 the uart pins was changed /ttyATA0 to /ttys0.
1 - sudo raspi-config >> Enable Serial and Expand file system
2- sudo apt-get update
3- sudo apt-get upgrade
4 -sudo nano /boot/config.txt
Open config.txt and write at EOF (End of life) ;
dtoverlay=pi3-disable-bt (closes bluetooth module)
Please use this code to test your uart pins:
Mehmet Çağrı Aksoy
MQ-3 Alcohol Sensor with Nokia 5110 LCD Module.
What is MQ-3 Sensor?
Mq3 is a sensor which measure alcohol sensitively. The sensor has 6 pin (it can be changed sensor version or brand, I worked on 6pin MQ-3 sensor)
Heater pins are represented by h.
You need supply 5VDC h pin and of course other h pin must connect to ground. (No need any resistor)
You have to connect 5VDC to the A pin. It can be same voltage and voltage source like h pin.
The most important part is B pin. Because you have to measure Analog (code:AnalogRead();) values. And connect Analog pin and B pin. B pin must connect ground but you have to use resistor. It can be change 2K and 20K ohm. (I used 10K resistor)
Note: There is no difference A and B pins. The naming can be changed.
Important note: The sensor may not work first 24-48 hours. –read datasheet preheat time. You should let it warm up.
You can see datasheet MQ-3 here;
MQ-3 Alcohol Sensor Arduino Code:
The articles are writed by Mehmet Ç. Aksoy