Obstacle Detector (B4J) - in progress

Explore the Raspberry Pi
Site Admin
Posts: 224
Joined: 07 Oct 2017, 12:16

Obstacle Detector (B4J) - in progress

Postby rwblinn » 09 Oct 2017, 15:22

Detect an Obstacle and flash an LED whilst updating Browser information. The Obstacle Detector and the LED are connected to the Raspberry Pi GPIO (General Purpose Input/Output Pins).
This is a B4J Server Application.


Ready to develop?
Before starting, ensure to read Setup B4J first.

The Solution
Raspberry Pi, GPIO Extension Board, GPIO cable, Breadboard, 1 Resistor 330 ohm, 1 LED 3.3 V, Obstacle Detector, several jumper wires.
Build the circuit (see also picture at the right)
The Pi GPIO is connected via a GPIO Extension Board (T-Cobbler) and GPIO cable to a Breadboard.
On the Breadboard:
-place the LED with a 330 ohm resistor in series with the GND (Physical Pin 6) and the GPIO18 Pin (Physical Pin 12, Pi4J GPIO1).
-connect the Obstacle Detector OUT Pin with Raspberry Pi GPIO0 (Physical Pin 11), + with 3.3V RDC and GND with Ground.

Create the Software
A B4J server application using the jPi4J Libary (Raspberry Pi GPIO controller).
For detailed information about the project see Description below or look up in project source.
Run the Experiment
On the Pi start the B4J-Bridge by login on as user Pi, open a terminal, go to folder /home/pi/b4j and run $sudo java -jar b4-bridge.jar, note the MyIp address.
Open the B4J IDE and load the b4j project file, connect to the B4J-Bridge (Menu Tools > B4J Bridge > Connect > Enter IP address.

Run the application from the B4J IDE by pressing F5.
Open a Browser and enter as URL the Pi IP Address:port, like
Depending object detection, the information on the Browserpage is updated.

Download the B4J Project Source

Sep 01, 2015: First Version.

Return to “Raspberry Pi”

Who is online