title: Use Raspberry Pi 3B+ to read sensor data from Arduino Uno with JDY-18 bluetooth module
body: <p>I Used Rpi 3B+ to read sensor data from Arduino Uno with JDY-18 bluetooth module. JDY-18 can connect to Rpi, but can't receive sensor data.</p>
  <p>My Arduino code like this :</p>
  <pre><code>#include &lt;SoftwareSerial.h&gt;
  #include &quot;LowPower.h&quot; // For Arduino Sleep Mode
  
  SoftwareSerial BTSerial(2, 3); // RX | TX
  
  int soilMoisureInt;
  
  void setup()
  {
    pinMode(A0, INPUT);
    BTSerial.begin(9600);
    Serial.begin(9600);
  }
  
  void loop()
  {
    // Make initial soilMoisureInt equal zero
    soilMoisureInt = analogRead(A0);
  
    // Send data through bluetooth
    BTSerial.write(soilMoisureInt);
  
    // Get Arduino into sleep mode
    for (int i = 0 ; i &lt; 2 ; i++)
      LowPower.powerDown(SLEEP_4S, ADC_OFF, BOD_OFF);
  }
  </code></pre>
  <p>And my Rpi code like this (use bluepy Python3 package):</p>
  <pre><code>import bluepy.btle as btle
  
  # Set up variables
  dataInt = None
  blue_address = &quot;XX:XX:XX:XX:XX:XX&quot;
  
  # For bluepy Peripheral class
  class ReadDelegate(btle.DefaultDelegate):
      def handleNotification(self, cHandle, data):
          # Access global variables insid class
          global dataInt
          # Change ascii char to int
          dataInt = ord(data)
  
  # Connect to bluetooth module
  p = btle.Peripheral(blue_address)
  # Use ReadDelegate
  p.withDelegate(ReadDelegate())
  
  # Read date
  while True:
      p.waitForNotifications(0)
      print(&quot;Soil Moisure : &quot; + str(dataInt))
  </code></pre>
  <p>Could anyone have the experience of connection between JDY-18 and Rpi?</p>