Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
Ahmed Abdulhai
Published Β© MIT

Automatic Touchless Soap Dispenser using Hexabitz Platform

In this project, we will build an automatic liquid soap machine with Hexabitz modules.

BeginnerFull instructions provided3 hours170
Automatic Touchless Soap Dispenser using Hexabitz Platform

Things used in this project

Hardware components

Dual H-Bridge Motor Driver (H18R1x)
Hexabitz Dual H-Bridge Motor Driver (H18R1x)
Γ—1
VL53L1 Time-of-Flight IR Sensor Module (H08R70)
Hexabitz VL53L1 Time-of-Flight IR Sensor Module (H08R70)
Γ—1
BitzClamp
Hexabitz BitzClamp
Γ—1
4-Pin USB-Serial Prototype Cable
Hexabitz 4-Pin USB-Serial Prototype Cable
Γ—1
STLINK-V3MODS Programmer (H40Rx)
Hexabitz STLINK-V3MODS Programmer (H40Rx)
Γ—1
Bench Power Supply, Linear DC
Bench Power Supply, Linear DC
Γ—1

Software apps and online services

STM32CUBEPROG
STMicroelectronics STM32CUBEPROG
STMicroelectronics stm32cubIDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Solder Wire, Lead Free
Solder Wire, Lead Free

Story

Read more

Schematics

Dual H-Bridg Motor Driver (H18R1x) Hardware

Hexabitz H08R6x 1D LiDAR IR module Hardware

H08R6x Factsheet

H18R1x Factsheet

Automatic soap dispenser machine using HEXABITZ modules

Code

Automatic soap dispenser machine (H08R6) module

C/C++
/*
 BitzOS (BOS) V0.3.0 - Copyright (C) 2017-2024 Hexabitz
 All rights reserved

 File Name     : main.c
 Description   : Main program body.
 */
/* Includes ------------------------------------------------------------------*/
#include "BOS.h"

/* Private variables ---------------------------------------------------------*/
volatile uint32_t distance;

/* Private function prototypes -----------------------------------------------*/

/* Main function ------------------------------------------------------------*/

int main(void) {

	Module_Init();		//Initialize Module &  BitzOS

	//Don't place your code here.
	for (;;) {
	}
}

/*-----------------------------------------------------------*/

/* User Task */
void UserTask(void *argument) {

	AddBOSvar(FMT_UINT32, (uint32_t) &distance);
	distance = Sample_ToF();
	WriteRemote(2, (uint32_t) &distance, 1, FMT_UINT32, 0);
	IND_blink(100);
	Delay_ms(1);

	// put your code here, to run repeatedly.
	while (1) {

		distance = Sample_ToF();

		AddBOSvar(FMT_UINT32, (uint32_t) &distance);

		WriteRemote(2, (uint32_t) &distance, 1, FMT_UINT32, 0);
		IND_blink(5);
		IND_OFF();
	}
}

/*-----------------------------------------------------------*/

Automatic soap dispenser machine (H18R2) module

C/C++
/*
 BitzOS (BOS) V0.3.0 - Copyright (C) 2017-2024 Hexabitz
 All rights reserved

 File Name     : main.c
 Description   : Main program body.
 */
/* Includes ------------------------------------------------------------------*/
#include "BOS.h"

/* Private variables ---------------------------------------------------------*/
volatile uint32_t distance;
bool Enable =0, Disable =0;
/* Private function prototypes -----------------------------------------------*/

/* Main function ------------------------------------------------------------*/

int main(void){
	
	Module_Init();		//Initialize Module &  BitzOS
	
	//Don't place your code here.
	for(;;){
	}
}

/*-----------------------------------------------------------*/

/* User Task */
void UserTask(void *argument){
	
	AddBOSvar(FMT_UINT32,(uint32_t )&distance);
	
	// put your code here, to run repeatedly.
	
	while(1){
		
		Enable =(distance >= 50 && distance <= 150);
		if(Enable && Disable){
			Turn_ON(forward,MotorA);
			Delay_ms(200);
			Turn_OFF(MotorA);
			Disable =0;
			Delay_ms(500);
		}
		else if(distance > 150){
			Disable =1;
		}
		
	}
}

/*-----------------------------------------------------------*/

Hexabitz H08R6x 1D LiDAR IR module firmware

Dual H-Bridg Motor Driver (H18R1x) firmware

Credits

Ahmed Abdulhai
3 projects β€’ 3 followers
Contact

Comments

Please log in or sign up to comment.