Skip to content

mmWave SDK examples based on Batman Kit mmWave Sensor module

Notifications You must be signed in to change notification settings

bigheadG/mmWave

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mmWave based on AI (by request with purcahse of corresponding AI enabled mmWave EVM Kit)

RadarSensingPredictBasedOnAI.2021-11-12.17-44-24.mov

mmWave based on PC3 360 degree application(BM501)

fusion_pc3_rt+openCV.MOV

mmWave

mmWave SDK examples based on Batman Kit mmWave Sensor module This App works with Raspberry Pi 3, Pi 2 , Pi 4, Jetson Nano ,Windows, MacOS or Intel NUC. Run this repository example needs install mmWave lib. Those examples are

DRN, HAM, LPD, PC3, PC3D, PCR, PCT, PCT_FDS, PMB, POS, SRR, SVD, TMD, TRS, VED, VOD, VSD and ZOD examples:

DRN: Drone Radar Navigation.
HAM: High Accuracy Measurement.
LPD: Long range People Detection.
PC3: People Counting Detection.
PC3_v2: People Counting Detection 3D version:2.
PC3D: People Overhead Counting 3D.
PCR: People Counting short Range sensing.
PCT: People-Counting with Tilt Sensing.
PCT_FDS: People Fall Detection demo application based on mmWave-PCT.
PMB: People Moving Behavior.
POS: People counting Overhead Sensor.
SRR: Short Range Radar.
SVD: Surface Velocity Detection.
TMD: Traffic Monitor Detection.
TRS: Traffic_monitoring_detection Roadway Sensing.
VED: Vital Energy Detection.
VOD: Vehicle Occupancy Detection.
VSD: Vital Signs Detection.
ZOD: Zone Occupancy Detection

mmWave Data Sheet:

BM101: https://github.com/bigheadG/mmWaveDocs/blob/master/Datasheet_BM101_F_C.pdf (deprecated)
BM201: https://github.com/bigheadG/mmWaveDocs/blob/master/Datasheet_BM201_O_C.pdf
BM301: https://github.com/bigheadG/mmWaveDocs/blob/master/Datasheet_BM301FDS_D_C.pdf (deprecated)
BM501: https://github.com/bigheadG/mmWaveDocs/blob/master/Datasheet_BM501_G_C.pdf
BM502: https://github.com/bigheadG/mmWaveDocs/blob/master/Datasheet_BM502_F_C.pdf
BM601: https://github.com/bigheadG/mmWaveDocs/blob/master/Datasheet_BM601_D_C.pdf
BM201-Module: https://github.com/bigheadG/mmWaveDocs/blob/master/Datasheet_BM201_Module_C_C.pdf
BM501-Module: https://github.com/bigheadG/mmWaveDocs/blob/master/Datasheet_BM501_M_A_C.pdf
BM502-Module: https://github.com/bigheadG/mmWaveDocs/blob/master/Datasheet_BM502_M_A_C.pdf
BM601-Module: https://github.com/bigheadG/mmWaveDocs/blob/master/Datasheet_BM601_M_A_C.pdf

Youtube Demo:

Watch the video

Hardware requirements:

   DRN: Batman Kit 201(ISK) :IWR6843-DRN
   HAM: Batman kit 101/201: IWR1642-HAM/IWR6843-HAM
   LPD: Batman kit 201: IWR6843-LPD       
   PC3: Batman Kit 201(ISK) :IWR6843-PC3 and BM501 AOP-PC3
   PC3_v2: Batman Kit 201(ISK)/501(AOP) :IWR6843-PC3 and BM501 AOP-PC3
   PC3D: Batman kit 301: IWR6843-PC3D
   PCR: Batman Kit 201(ISK) :IWR6843-PCR and BM501 AOP-PCR
   PCT_FDS: Batman Kit 502(AOP) :BM502 PCT-FDS
   PMB: Batman kit 101/201: IWR1642-PMB/IWR6843-PMB
   POS: Batman Kit 201(ISK)/501(AOP) :IWR6843-POS and BM501 AOP-POS
   SRR: Batman kit 101: IWR1642-SRR
   SVD: Batman Kit 201(ISK) :IWR6843-SVD
   TMD: Batman kit 201: IWR6843-TMD
   TRS: Batman Kit 201(ISK) :IWR6843-TRS
   VED: Batman Kit 201(ISK) :IWR6843-VED and BM501 AOP
   VOD: Batman Kit 201(ISK) :IWR6843-VOD
   VSD: Batman kit 101/201/501(AOP): IWR1642-VSD/IWR6843-VSD/IWR6843AOP-VSD
   ZOD: Batman kit 201(ISK) :IWR6843-ZOD

Install Library:

  mmWave Library
  $sudo pip3 install mmWave
  
  tkinter Library
  $sudo pip3 install tkinter
  or
  $sudo apt-get install python3-tk python-tk
  
  numpy Library
  $sudo pip3 install numpy
  or
  $sudo apt-get install python3-numpy python-numpy
  
  NOOBS_V3 is installed already
  pySerial Library
  $sudo pip3 install pySerial
  
  RPi.GPIO library please reference:
  https://www.raspberrypi-spy.co.uk/2012/05/install-rpi-gpio-python-library/
  
  pandas Library
  $sudo pip3 install pandas
  
  scikit-learn Library
  $sudo pip3 install scikit-learn
  
  pyqtgraph Library
  $sudo pip3 install pyqtgraph
  https://pyqtgraph.readthedocs.io/en/latest/installation.html

Some install problem the following information for reference:

  (1)-------libf77blas.so.3-----------------------------------------
  from scipy.linalg import _fblas
  ImportError: libf77blas.so.3: cannot open shared object file: No such file or directory

  problem solved:
  First of all, for libf77blas.so.3, you have to install ATLAS, something like sudo apt-get install libatlas-base-dev

  $sudo apt-get install libatlas-base-dev
  (2)-----------------------------------------
  Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 265, in open
  self.fd = os.open(self.portstr, os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK)
  FileNotFoundError: [Errno 2] No such file or directory: '/dev/ttyS0'

  problem solved:

  (1)menu->perference->Raspberry pi Configuration->Serial Port(Enable)
  (2)reboot:
  (3)$ls -l /dev/ttyS0
        crw--w---- 1 root tty       4, 64 Nov  1 04:21 /dev/ttyS0
  (4)$sudo chmod +666 /dev/ttyS0
  (5)pi@raspberrypi:~ $ ls -l /dev/ttyS0
      crw-rw-rw- 1 root tty 4, 64 Nov  1 04:21 /dev/ttyS0

How to Enable RPi UART port:

Enable UART:

  1:[MainMenu] -> [Preferences] -> [Raspberry Pi Configuration]

MainMenu 1

  2:Select [Interface Tab] in Raspberry Pi Configuration
  
  3:Enable Serial Port: Check radio RadioButton

MainMenu 1

  4:List tty Device
  
  $ls /dev/tty*
  $sudo chmod +666 /dev/ttyS0
  or 
  $sudo chmod +666 /dev/ttyAMA0
  
  Reboot

MainMenu 1

UART Still can not work, Please check cmdline.txt

$cat /boot/cmdline.txt

if you find the console=serial0,115200 in cmdline.txt. please use raspi-config to remove it.

$sudo raspi-config 
then reboot

Detailed information please reference:

https://www.raspberrypi.org/documentation/configuration/uart.md

For pyqtgraph v0.13.1 users need to replace the three parts of the code in the file.

Method 1:

############################################
#(1) for pyqtgraph Version: 0.13.1
from pyqtgraph.Qt import mkQApp ,QtCore ,QtGui

''' # remove
# before pyqtgraph Version: 0.13.1
from pyqtgraph.Qt import QtCore, QtGui
'''

############################################
#(2)
app = mkQApp("PCT") #for pyqtgraph v0.13.1
#app = QtGui.QApplication([]) #remove 

############################################
#(3)#for pyqtgraph v0.13.1
if __name__ == '__main__':
	 pg.exec()

''' # remove
#before pyqtgraph Version: 0.13.1 
if __name__ == '__main__':
    import sys
    if (sys.flags.interactive != 1) or not hasattr(QtCore,'PYQT_VERSION'):
	QtGui.QApplication.instance().exec_()
'''
############################################
setDaemon() is deprecated, set the daemon attribute instead
remove thread1.setDaemon(True)
add    thread1.daemon = True
############################################

#for pyqtgraph V0.13.1 
remove circle = pg.QtGui.QGraphicsEllipseItem(-r, -r, r * 2, r * 2)
add    circle = pg.QtWidgets.QGraphicsEllipseItem(-r, -r, r * 2, r * 2)

#for pyqrgraph 0.13 verison
remove win = pg.GraphicsWindow()
add    win = pg.GraphicsLayoutWidget(show=True) 

Method 2

############################################
#(1) for pyqtgraph Version: 0.13.1
#from PyQt5.QtGui import QPen, QColor
from PyQt5 import QtGui, QtWidgets, QtCore   
from pyqtgraph.Qt import mkQApp, QtGui

''' # remove
# before pyqtgraph Version: 0.13.1
from pyqtgraph.Qt import QtCore, QtGui
'''

############################################
#(2)
app = QtWidgets.QApplication([])      

# remove 
#app = QtGui.QApplication([]) #remove 

############################################
#(3.0)#for pyqtgraph v0.13.1
if __name__ == '__main__':
	 pg.exec()
 	
#(3.1) 
if __name__ == '__main__':
	import sys
	if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'): 
		#QtGui.QApplication.instance().exec_()     
		QtWidgets.QApplication.instance().exec_()  # for Pyqtgraph_V0.13

# remove
'''
#before pyqtgraph Version: V0.13.1 
if __name__ == '__main__':
    import sys
    if (sys.flags.interactive != 1) or not hasattr(QtCore,'PYQT_VERSION'):
	QtGui.QApplication.instance().exec_()
'''

circle for pyqtgraph V0.13.1 
remove : circle = pg.QtGui.QGraphicsEllipseItem(-r, -r, r * 2, r * 2)
add new line : circle = pg.QtWidgets.QGraphicsEllipseItem(-r, -r, r * 2, r * 2)
example :
for r in range(1, 10, 1):
    #circle = pg.QtGui.QGraphicsEllipseItem(-r, -r, r * 2, r * 2)
     circle = pg.QtWidgets.QGraphicsEllipseItem(-r, -r, r * 2, r * 2)
     circle.setPen(pg.mkPen(1.0))
     w0.addItem(circle)

Please refer to https://github.com/bigheadG/pyqtgraph_3d_text when you find the following errors when executing the 3d program

Error while drawing item <__main__.CustomTextItem object at 0x7f7950a9c4c0>.
Error while drawing item <__main__.CustomTextItem object at 0x7f7950a9c550>.

In MAC got setDaemon error (got the following message): 2014-01-23

DeprecationWarning: setDaemon() is deprecated, set the daemon attribute instead
thread1.setDaemon(True)
2024-01-23 13:53:22.983 Python[1631:77099] WARNING: Secure coding is not 
enabled for restorable state! Enable secure coding by implementing 		
NSApplicationDelegate.applicationSupportsSecureRestorableState: and returning YES.

remove: 
    #thread1 = Thread(target = uartWork, args =("UART",))
#thread1.setDaemon(True)
#thread1.start()

added:
from threading import Thread
thread1 = threading.Thread(target=uartWork("UART"), daemon=True)
thread1.start()

When MQTT got error:

	 client = mqtt.Client()
	             ^^^^^^^^^^^^^
	TypeError: Client.__init__() missing 1 required positional argument: 'callback_api_version'

    sol:
      #client = mqtt.Client()
  client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION1)

About

mmWave SDK examples based on Batman Kit mmWave Sensor module

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages