Mario Soranno
Created February 9, 2020 © GPL3+

Sensors Detecting Human Body on a ROS Self-Driving Mini Car

I have thought of creating a sensory array to detect the human body in order to use it in robotics and other application.

AdvancedFull instructions provided3 days857

Things used in this project

Hardware components

KEMET Electronics Corporation SS-430L-BK
×3
KEMET Electronics Corporation C0603C105K4PACTU
×4
KEMET Electronics Corporation C0603C104J5RACTU
×9
SMT-1640-S-R
×1
NXP PESD5V0L2BT
×1
Broadcom HLMP-K105
×1
Broadcom HLMP-1540
×1
Broadcom HLMP-1440
×1
S4B-XH-A (LF)(SN)
×3
Amphenol 10118194-0001LF
×1
Panasonic ERJ-3EKF1001V
×3
MC0063W0603122R
×2
Vishay CRCW06032K20FKEAC
×2
Cypress CY8C3866PVI-021
×1
Texas Instruments LM3480IM3-3.3/NOPB
×1
XHP-4
×3
BXH-001T-P0.6
×12
SHR-05V-S-B
×3
SH3-SH3-28150
×3
Custom PCB
×1

Software apps and online services

Robot Operating System
ROS Robot Operating System
PSoC Creator
Cypress PSoC Creator

Hand tools and fabrication machines

Soldering Station Power Supply, For Weller WX Soldering System
Soldering Station Power Supply, For Weller WX Soldering System

Story

Read more

Custom parts and enclosures

Gerber Files

Gerber Files of K-board PCB
I used the Seeed Fusion PCB Assembly (https://www.seeedstudio.com/fusion_pcb.html) Service for a new prototype and I was very satisfied. Seeed is fast and produce superior quality PCBs. Free DFA and free functional tests are also provided. Check out the https://www.seeedstudio.com/prototype-pcb-assembly.html

PSoC Creator - HEX file

Hexadecimal file to program the CY8C3866PVI-021 48-SSOP PSoC microcontroller

Case - lower part

File of the 3D lower part of orange PLA case

Case - lid

File of the 3D lid of orange PLA case

Schematics

Electrical schematic

Electrical schematic of sensors detecting human body on a ROS self-driving mini car

BOM - Bill of Materials

Bill of Materials of sensors detecting human body on a ROS self-driving mini car

3D PCB - Printed Circuit Board

3D PCB of sensors detecting human body on a ROS self-driving mini car

Code

PSoC Creator - main.c

C/C++
The main C-file of PSoC Creator project. Copy it in your Creator project.
/* ========================================
 *
 * Copyright Mario Soranno, 2020
 * All Rights Reserved
 *
 * CONFIDENTIAL AND PROPRIETARY INFORMATION
 * WHICH IS THE PROPERTY OF Mario Soranno.
 *
 * ========================================
*/
#include "project.h"

#define loopAlarmValue 5    // 500ms
#define loopBeepValue 2     // 200ms

uint8 status = 0; 
uint8 loopAlarm1 = 0;
uint8 loopAlarm2 = 0;
uint8 loopAlarm3 = 0;
uint8 loopBeep = 0;
uint8 array_char[5];
uint8 ss430Stato1 = 0x30;
uint8 ss430Stato2 = 0x30;
uint8 ss430Stato3 = 0x30;

int main(void)
    {
    // Test LEDs and Buzzer
    LEDR_Write(1);
    LEDG_Write(0);
    LEDY_Write(0);
    CyDelay(500);
    LEDR_Write(0);
    LEDG_Write(1);
    LEDY_Write(0);
    CyDelay(500);
    LEDR_Write(0);
    LEDG_Write(0);
    LEDY_Write(1);
    CyDelay(500);
    LEDR_Write(0);
    LEDG_Write(0);
    LEDY_Write(0);
    CyGlobalIntEnable;
    // Peripherals initialization
    PWM_Start();
    PWM_WritePeriod(255);
    CyDelay(500);
    PWM_WritePeriod(0);
    CyDelay(50);
    USBUART_Start(0u, USBUART_5V_OPERATION);
    CyDelay(50);
    VDAC8_Start();
    Comp1_Start();
    Comp2_Start();
    Comp3_Start();
    for(;;)
        {
        if (0u != USBUART_IsConfigurationChanged())
            {
            if (0u != USBUART_GetConfiguration())
                {
                USBUART_CDC_Init();
                }
            }

        status = Status_Reg_Read();
        if((status & 0x01) == 0x01)
            {
            LEDR_Write(1);              // Red LED on
            loopAlarm1 = loopAlarmValue;// Update of countdown for LED off
            loopBeep = loopBeepValue;   // Update of countdown for Buzzer off
            ss430Stato1 = 0x31;         // Sensor status
            PWM_WritePeriod(255);       // Buzzer on - low frequency
            }
        else loopAlarm1--;


        if((status & 0x02) == 0x02)
            {
            LEDG_Write(1);              // Green LED on
            loopAlarm2 = loopAlarmValue;// Update of countdown for LED off
            loopBeep = loopBeepValue;   // Update of countdown for Buzzer off
            ss430Stato2 = 0x31;         // Sensor status
            PWM_WritePeriod(240);       // Buzzer on - medium frequency
            }
        else loopAlarm2--;

            
        if((status & 0x04) == 0x4)
            {
            LEDY_Write(1);              // Yellow LED on
            loopAlarm3 = loopAlarmValue;// Update of countdown for LED off
            loopBeep = loopBeepValue;   // Update of countdown for Buzzer off
            ss430Stato3 = 0x31;         // Sensor status
            PWM_WritePeriod(220);       // Buzzer on - high frequency
            }
        else loopAlarm3--;

 
        if(loopAlarm1 == 0) 
            {
            LEDR_Write(0);              // Red LED off
            ss430Stato1 = 0x30;
            }   
        if(loopAlarm2 == 0) 
            {
            LEDG_Write(0);              // Green LED off
            ss430Stato2 = 0x30;
            }  
        if(loopAlarm3 == 0) 
            {
            LEDY_Write(0);              // Yellow LED off
            ss430Stato3 = 0x30;
            }
        if(loopBeep == 0) PWM_WritePeriod(0); // Buzzer off
        else loopBeep--;   

        if(USBUART_GetConfiguration() != 0u)
            {                           // Send string on USB
            array_char[0] = 'K';
            array_char[1] = ss430Stato1;
            array_char[2] = ss430Stato2;
            array_char[3] = ss430Stato3;
            array_char[4] = '\r';
            USBUART_PutData(array_char,5);
            }
        CyDelay(100);
        }
    }

/* [] END OF FILE */

KEMET ROS Node

Python
ROS node that reads data from KEMET Board. Create a Python file and copy it in your ROS package in catkin workspace.
#!/usr/bin/env python

import serial
import rospy
from std_msgs.msg import UInt16
from time import sleep

if __name__ == '__main__':
	rospy.init_node('kemet')                                # ROS node name
	serdata = serial.Serial("/dev/ttyACM0", 9600) # serial port inizialization
	pub1 = rospy.Publisher("kemet1", UInt16, queue_size=10) # kemet1 ROS topic
	pub2 = rospy.Publisher("kemet2", UInt16, queue_size=10) # kemet2 ROS topic
	pub3 = rospy.Publisher("kemet3", UInt16, queue_size=10) # kemet3 ROS topic
	rate = rospy.Rate(10)   # ROS node rate = 10Hz
	while not rospy.is_shutdown():
		datain = serdata.read() # Read data from serial port
		sleep(0.05)
		numberdatain = serdata.inWaiting()
		datain += serdata.read(numberdatain)
		rospy.loginfo(datain)
		if datain[0] == 'K':  # data publication on ROS topics
			# rospy.loginfo("ok")
			msgKemet1 = ord(datain[1]) - 0x30
			pub1.publish(msgKemet1)
			msgKemet2 = ord(datain[2]) - 0x30
			pub2.publish(msgKemet2)
			msgKemet3 = ord(datain[3]) - 0x30
			pub3.publish(msgKemet3)
		else: # Error in data read
			rospy.loginfo("errore")
		rate.sleep()

Credits

Mario Soranno

Mario Soranno

9 projects • 24 followers
I have a Bachelor's Degree in Industrial Engineering - Electronics. I am an expert in hardware design, I can program in C/C++,Python and ROS

Comments