عرض الفئات

StandardFirmataPishiAi for Arduino with external BLE or Serial Modules

📡 StandardFirmataPishiAi for Arduino with External BLE or Serial Modules #

StandardFirmataPishiAi is a modified version of StandardFirmata created by Pishi.ai.
It enables Arduino boards to connect to Scratch using either:

  • BLE عبر المتصفح – when using external BLE-UART modules
  • USB عبر المتصفح – when using Arduino’s built-in USB port or external USB/Serial adapters

This firmware is ideal for boards without built-in BLE or for users who want to use external BLE or serial modules.

Supported BLE modules include HM-10, HM-11, JDY-08, JDY-10, JDY-23, JDY-24 and other BLE-UART modules.


🌟 Overview #

  • Serial or BLE Communication: Supports BLE-UART modules and standard UART serial modules.
  • Flexible Pin Protection: Protects selected RX/TX pins used for communication.
  • Multiple Modes: Built-in USB, SoftwareSerial, or multi-hardware UART.
  • Wired or Wireless: Use USB for wired projects, BLE for wireless projects.
  • Recommended for: Uno, Nano, Mega, Leonardo, Due, Zero, etc.
  • Full Firmata Feature Set: All StandardFirmata capabilities included.

📥 Download StandardFirmataPishiAi #

 

 


🔀 Communication Modes #

StandardFirmataPishiAi offers four communication modes depending on your hardware setup.

Mode 0 – Built-in USB Only (Hardware Serial) #

  • Uses Arduino’s main USB connection
  • No external serial/BLE module required
  • Same behavior as StandardFirmata
  • Best for testing, debugging, or wired projects

Mode 1 – SoftwareSerial Only (External Serial/BLE Module) #

  • Uses SoftwareSerial pins (default: RX 4, TX 7)
  • Can connect to BLE-UART modules or wired UART modules
  • Arduino’s built-in USB is unused and available for debugging
  • Best for wireless BLE modules, but serial adapters work too

Mode 2 – USB + SoftwareSerial (Dual Channel) ⭐ Recommended #

  • Arduino’s built-in USB is active (USB via Browser)
  • SoftwareSerial is active (for external BLE or serial modules)
  • Upload through USB, then communicate using either USB or the external module (both stay active).
  • Ideal for development, teaching, flexible setups

Mode 3 – USB + Hardware Serial (Multi-UART Boards) #

  • Uses Arduino’s built-in USB
  • Uses extra hardware UART ports (default: Serial1)
  • Connect external BLE or serial modules to a hardware UART
  • Best performance and stability
  • Recommended for Mega, Leonardo, Due, Zero

🚀 Installation Steps #

Step 1 – Download the Firmware

Download: StandardFirmataPishiAi.ino

 

Step 2 – Open in Arduino IDE

    1. Open the Arduino IDE
    2. Go to: File → Open
    3. Select the downloaded StandardFirmataPishiAi.ino file

ملاحظة: If Arduino IDE shows a message asking to move the file into a folder named StandardFirmataPishiAi, click OK. This is expected behavior for .ino sketches.

 

Step 3 – Select Communication Mode (Optional)

Mode 2 (USB + SoftwareSerial) is selected by default.
To change the mode, find this section in the sketch:
// Mode 0: Built-in USB only
// Mode 1: SoftwareSerial only (external Serial/BLE module)
// Mode 2: USB + SoftwareSerial (recommended)
// Mode 3: USB + Hardware Serial (boards with multiple UARTs)
#define SERIAL_MODE 2

 

Step 4 – Baud Rates (Optional)

Default baud rates:

  • Built-in USB: 57600
  • SoftwareSerial: 9600 (default baud rate for most BLE modules)

You can adjust them here:
#define HARDWARE_SERIAL_BAUD_RATE 57600
#define SOFTWARE_SERIAL_BAUD_RATE 9600

 

Step 5 – Configure SoftwareSerial Pins (Optional)

Default pins:

  • Pin 4 → Arduino RX
  • Pin 7 → Arduino TX

Change them here if needed:
#define SW_SERIAL_RX_PIN 4
#define SW_SERIAL_TX_PIN 7

 

Step 6 – Upload the Sketch

Upload the sketch normally using the Arduino IDE.

 


🔌 Wiring Guide for External Modules #

 

📍 Mode 1 and Mode 2 (SoftwareSerial) #

 

Module Pin Arduino Pin ملحوظات
VCC 5V / 3.3V Check module voltage rating
GND GND Required common ground
TX Pin 4 Module TX → Arduino RX
RX Pin 7 Arduino TX → Module RX
Level shifting may be needed for 3.3V modules

↔ مرر لليسار أو اليمين لعرض الجدول الكامل على الهاتف المحمول

 

📍 Mode 3 (Hardware Serial) #

  • Mega: Serial1 (18/19), Serial2 (16/17), Serial3 (14/15)
  • Leonardo/Due/Zero: Serial1

🔗 Connecting Arduino to Scratch #

1. Open Pishi.ai Scratch:
pishi.ai/play
2. Add Arduino Extension
3. Enable Pin Protection
enable serial/ble on rx: [4] tx: [7]
4. Connect

  • USB via WebSerial Bluetooth → for BLE-UART modules
  • BLE Via WebBluetooth USB → for Arduino’s built-in USB or USB-to-Serial adapters

🧱 Serial/BLE Protection Blocks #

 

Enable Protection

enable serial/ble on rx: [4] tx: [7]

Reserves the selected RX/TX pins so Scratch blocks cannot change them. Required before using external BLE or serial modules.

 

Disable Protection

disable serial/ble and release pins

Removes the protection and frees the pins for other uses when the external module is no longer needed.

 

Check Status

serial/ble enabled?

Returns true if protection is active. Useful for debugging or conditional scripts.

 


📝 Customization #

 

💡 Change Communication Pins #

You can assign different pins for SoftwareSerial if pins 4 and 7 conflict with your project.
Update both the firmware and the Scratch block so they match.

Firmware:
#define SW_SERIAL_RX_PIN 10
#define SW_SERIAL_TX_PIN 11

Scratch:
enable serial/ble on rx: [10] tx: [11]

 

💡 Increase SoftwareSerial Speed #

After configuring your module to a higher baud rate (for example 57600), you can increase SoftwareSerial speed in the firmware to improve communication performance.

#define SOFTWARE_SERIAL_BAUD_RATE 57600

 


🔧 Troubleshooting #

  • No data → check baud rate, wiring, pin protection
  • Upload fails → disconnect external serial module (Mode 1)
  • Weak wireless range → typical BLE range is 3–10 meters
  • Wrong pins → confirm RX/TX mapping

⚡ Performance Tips #

  • Use Mode 2 during development
  • Use Mode 3 for highest performance UART
  • Power motors/servos externally

🎮 Example Projects #

  • Wireless robot car
  • Remote sensor station
  • Game controller with BLE
  • Wearable Arduino projects

🔒 Safety Notes #

  • Check module voltage: many BLE modules are 3.3V
  • If your Arduino uses 5V logic, add a level shifter for the BLE module’s RX pin
  • Never drive motors directly from Arduino pins

🧪 Technical Info #

  • Protocol: StandardFirmata (Enhanced by Pishi.ai team)
  • Default RX/TX Pins: 4 and 7
  • Default SoftwareSerial Baud: 9600
  • Supported Boards: Uno, Nano, Mega, Leonardo, Due, Zero, …

📚 Learn More #


 

Scroll to Top