Close
0%
0%

Smart Mini Elevator

Old scanner hacked and turned into smart mini elevator

Similar projects worth following
I built this mini elevator with an old scanner, to achieve it I had to make some modifications to insert it inside a wooden box. In other words, everything I use here is sustainable material such as recycled material or wood. This project is a good experience for people who start with artificial intelligence by voice commands, since I used a free tools to control my mini elevator. Also this project has many options to continue improving, since I experimented with some voice commands. For example, you can modify it easily and order the device to move up or down to the floor you want to go, to open or close the doors, or maaybe to activate some sensors, etc.

This is a smart elevator to scale. A real elevator probably uses a huge A/C motor with sensors at each floor location. We certainly could use this approach with a smaller-scale but putting sensors at each floor is a lot of wiring, and we would have concerns about sensitivity and alignment. On the other hand, a stepper motor can be positioned precisely, but we would have to know exactly where we are and how far we have to go to do that; fortunately, I know how to use stepper motors and looks more interestingly. The other design concern will be with the elevator call buttons; here I will use machine learning with Modus Toolbox and Picovoice to control the ascent and descent using voice commands

smart-mini-elevator.zip

Project code (version 1)

x-zip-compressed - 8.85 MB - 06/27/2022 at 20:04

Download

schematic diagram.zip

Schematic diagram (version 1)

x-zip-compressed - 1.32 MB - 06/27/2022 at 19:54

Download

  • 1 × Infineon PSoC™ 62S2 Wi-Fi BT Pioneer Kit
  • 1 × Infineon IoT Sense Expansion Kit
  • 1 × Stepper Motor, Bipolar
  • 1 × Dual H-Bridge motor drivers L298
  • 1 × Battery, 5V

  • 6. Test and Conclusion

    Guillermo Perez Guillen06/27/2022 at 20:48 0 comments

    Below I show you the video of the test done with the mini elevator.

    Conclusion:

    • I have achieved my goal of building a mini elevator with my PSoC 62S2 Wi-Fi BT Pioneer Kit, and IoT sense expansion kit;
    • I have also incorporated the Picovoice platform into my project to experiment and create wake words;
    • I still have plans in the future to make more changes to this project, such as try with another techology, or maybe adding a small sliding door, or a display that tells me the floor number, or even adding environmental sensors. 

  • 5. Picovoice Platform

    Guillermo Perez Guillen06/27/2022 at 20:45 0 comments

    Picovoice is the end-to-end platform for building voice products on your terms. Unlike Alexa and Google services, Picovoice runs entirely on-device while being more accurate. Using Picovoice, one can infer a user's intent from a naturally spoken utterance such as: Hey Edison, set the lights in the living room to blue.

    For my  purposes, it is enough to use the free account. so following the webinar instructions I got the access key right away.

    I have created three wake words of which I have used one of them in my project.

  • 4. ModusToolbox Software

    Guillermo Perez Guillen06/27/2022 at 20:41 0 comments

    I downloaded and install the software ModusToolbox 2.4 in its version for Windows

    I recommend you follow the instructions in this webinar, since some steps will serve as a reference: Implementing Machine Learning on the Edge

    To develop my project, I will use the next code demo as a reference: "Picovoice_Porcupine_Wake_Word_Demo".

    Step 1. Click on: File> New> ModusToolBox Application

    Step 2. Insert kit name: CY8CKIT-062S2-43012, and click next

    Step 3. Select "Picovoice_Porcupine_Wake_Word_Demo" poject, and click on create. Below is the project:

    Step 4. Open main.c file and make the next changes:

    // AUTHOR: GUILLERMO PEREZ GUILLEN
    
    #include <stdbool.h>
    #include <stdio.h>
    #include <stdlib.h>
    
    #include "cy_rgb_led.h"
    #include "cybsp.h"
    
    #include "pv_audio_rec.h"
    #include "pv_keywords.h"
    #include "pv_porcupine.h"
    #include "pv_psoc6.h"
    
    #include "cy_pdl.h"
    #include "cyhal.h"
    #include "cy_retarget_io.h"
    
    #define MEMORY_BUFFER_SIZE (70 * 1024)
    
    static const char* ACCESS_KEY = "gkylTu/7ljkHnB1/yobm78094/ea8DZ59MN7xcgWduJU1278u6AyGg=="; // AccessKey string obtained from Picovoice Console (https://picovoice.ai/console/)
    
    static int8_t memory_buffer[MEMORY_BUFFER_SIZE] __attribute__((aligned(16)));
    
    #define DELAY_LONG_MS           (2)   /* ADD 2 milliseconds */
    
    #ifdef __PV_LANGUAGE_ENGLISH__
    
    static const int32_t NUM_KEYWORDS = 4;
    static const int32_t KEYWORD_MODEL_SIZES[] = {
            sizeof(DEFAULT_KEYWORD_ARRAY),
            sizeof(PINKY_KEYWORD_ARRAY),
            sizeof(BUMBLEBEE_KEYWORD_ARRAY),
            sizeof(ALEXA_KEYWORD_ARRAY)
    };
    static const void *KEYWORD_MODELS[] = {
            DEFAULT_KEYWORD_ARRAY,
            PINKY_KEYWORD_ARRAY,
            BUMBLEBEE_KEYWORD_ARRAY,
            ALEXA_KEYWORD_ARRAY
    };
    static const float SENSITIVITIES[] = {
            0.75f,
            0.75f,
            0.75f,
            0.75f
    };
    
    static const char *KEYWORDS_NAME[] = {
            "Porcupine",
            "Pinky",
            "Bumblebee",
            "Alexa"
    };
    
    #else
    
    static const int32_t NUM_KEYWORDS = 1;
    static const int32_t KEYWORD_MODEL_SIZES[] = { sizeof(DEFAULT_KEYWORD_ARRAY) };
    static const void *KEYWORD_MODELS[] = { DEFAULT_KEYWORD_ARRAY };
    static const float SENSITIVITIES[] = { 0.75f };
    static const char *KEYWORDS_NAME[] = { "" };
    
    #endif
    
    static void error_handler(void) {
        cy_rgb_led_on(CY_RGB_LED_COLOR_RED, CY_RGB_LED_MAX_BRIGHTNESS);
        while(true);
    }
    
    int main(void) {
    
        uint32_t delay_led_blink = DELAY_LONG_MS;
        cy_rslt_t result;
    
    	result = cyhal_gpio_init(P0_2, CYHAL_GPIO_DIR_OUTPUT, CYHAL_GPIO_DRIVE_STRONG, CYBSP_LED_STATE_ON);
        result = cyhal_gpio_init(P0_3, CYHAL_GPIO_DIR_OUTPUT, CYHAL_GPIO_DRIVE_STRONG, CYBSP_LED_STATE_ON);
        result = cyhal_gpio_init(P1_3, CYHAL_GPIO_DIR_OUTPUT, CYHAL_GPIO_DRIVE_STRONG, CYBSP_LED_STATE_ON);
        result = cyhal_gpio_init(P13_6, CYHAL_GPIO_DIR_OUTPUT, CYHAL_GPIO_DRIVE_STRONG, CYBSP_LED_STATE_ON);
    
        if (result != CY_RSLT_SUCCESS)
        {
            CY_ASSERT(0);
        }
    
        pv_status_t status = pv_board_init();
        if (status != PV_STATUS_SUCCESS) {
            error_handler();
        }
    
        status = pv_message_init();
        if (status != PV_STATUS_SUCCESS) {
            error_handler();
        }
    
        const uint8_t *board_uuid = pv_get_uuid();
        printf("UUID: ");
        for (uint32_t i = 0; i < pv_get_uuid_size(); i++) {
            printf(" %.2x", board_uuid[i]);
        }
        printf("\r\n");
    
        status = pv_audio_rec_init();
        if (status != PV_STATUS_SUCCESS) {
            printf("Audio init failed with '%s'\r\n", pv_status_to_string(status));
            error_handler();
        }
    
        status = pv_audio_rec_start();
        if (status != PV_STATUS_SUCCESS) {
            printf("Recording audio failed with '%s'\r\n", pv_status_to_string(status));
            error_handler();
        }
    
        pv_porcupine_t *handle = NULL;
    
        status = pv_porcupine_init(
                ACCESS_KEY,
                MEMORY_BUFFER_SIZE,
                memory_buffer,
                NUM_KEYWORDS,
                KEYWORD_MODEL_SIZES,
                KEYWORD_MODELS,
                SENSITIVITIES,
                &handle);
    
        if (status != PV_STATUS_SUCCESS) {
            printf("Porcupine init failed with '%s'\r\n", pv_status_to_string(status));
            error_handler();
        }
    
        while (true) {
            const int16_t *buffer = pv_audio_rec_get_new_buffer();
            if (buffer) {
                int32_t keyword_index = -1;
                const pv_status_t status = pv_porcupine_process(handle, buffer,...
    Read more »

  • 3. Bipolar Stepper Motor

    Guillermo Perez Guillen06/27/2022 at 20:24 0 comments

    To rotate a bipolar stepper motor, pulses are applied in sequence to the windings, the sequence of these pulses, are applied externally with an electronic controller. Said controllers are designed in such a way that the motor can be kept in a fixed position and also so that it can be rotated in both directions.

    There are three characteristics that are common in stepper motors:

    • Voltage: Stepper motors have a working electrical voltage. This value is printed on its case or is at least specified on its datasheet.
    • Electric resistance: This resistance will determine the current that the motor will consume and its value affects the torque curve of the motor and its maximum operating speed.
    • Degrees per step: This factor defines the number of degrees the axis will rotate for each full step.

    Here is a quick guide for Stepper Motor Wire Color And Coil Pairs.

    However, color codes are not always respected by manufacturers. So a test allowed me to find that my stepper motor works at 5 volts. I also found by means of an ohmmeter the two coils and the order of the pins as follows:

    • pin 1 - gray
    • pin 2 - yellow
    • pin 3 - brown
    • pin 4 - red

    These motors have several windings that, to produce the advance of a step, must be fed in a suitable sequence. By reversing the order of this sequence, the motor turns in the opposite direction. The next table shows the sequence to generate the CW (Clockwise) and CCW (Counterclockwise) movements of a bipolar motor.

  • 2. Build and Wiring the Mini Elevator

    Guillermo Perez Guillen06/27/2022 at 20:20 0 comments

    I got the stepper motor from an old printer scanner that I'm recycling.

    In fact, I took advantage of the entire mechanism and adapted it to a wooden box that I built from recycled wood.

    In the image below you can see the scanner mechanism adapted to a wooden box (back view).

    The front view of the mini elevator is shown in the figure below. The wooden box has the next dimensions: 20 cm (width) x 20 cm (depth) x 45 cm (height).

    I assembled this prototype with screws in its corners, then added white glue and silicone. The elevator cabinet is made of thick cardboard to reduce weight and give it strength, and it has next dimensions: 17 cm (width) x 8 cm (depth) x 14 cm (height). In all this I spent two days because the prototype had to be painted.

  • 1. Hardware

    Guillermo Perez Guillen06/27/2022 at 20:12 0 comments

    The PSoC™ 62S2 Wi-Fi BT Pioneer Kit(CY8CKIT-062S2-43012) is a low-cost hardware platform that enables design and debug of the PSoC™ 62 MCU and the Murata 1LV Module (CYW43012 Wi-Fi + Bluetooth Combo Chip).

    Features:

    • CY8CMOD-062S2-43012 carrier module that contains: a) PSoC 6 MCU (CY8C624ABZI-S2D44), and b) Murata 1LV ultra-small 2.4/5.0-GHz WLAN and Bluetooth functionality module based on CYW43012
    • 512-Mbit external Quad SPI NOR Flash that provides a fast, expandable memory for data and code
    • 4-Mbit Quad SPI ferroelectric random-access memory (F-RAM)
    • KitProg3 onboard SWD programmer/debugger with USB-UART and USB-I2C bridge functionality
    • CapSense touch-sensing slider (5 elements), two buttons, based on self-capacitance (CSD) and mutual-capacitance (CSX) sensing
    • A micro-B connector for USB device interface for PSoC 6 MCU
    • 1.8 V and 3.3 V operation of PSoC 6 MCU is supported
    • Two user LEDs, an RGB LED, two user buttons, and a reset button for PSoC 6 MCU
    • A potentiometer
    • One Mode selection button and one Status LED for KitProg3
    • A microSD Card holder

    The IoT sense expansion kit is a low-cost Arduino™ UNO compatible shield board that can be used to easily interface a variety of sensors with the PSoC™ 6 MCU platform, specifically targeted for audio and machine learning applications.

    Features:

    • Digital XENSIV™ MEMS Microphone(s)
    • Digital XENSIV Barometric Air Pressure Sensor
    • Bosch 9-axis Absolute Orientation Sensor
    • Piezo MEMS Analog Microphone
    • Audio Codec and headset jack
    • OLED Display Module

    Now I show you the electrical diagram of the circuit that we assembled below.

View all 6 project logs

  • 1
    Software apps and online services
    • Infineon ModusToolbox™ Software
    • Picovoice AI Picovoice Porcupine Wake Word Engine
  • 2
    Hand tools and fabrication machines
    • Old scanner

View all instructions

Enjoy this project?

Share

Discussions

Guillermo Perez Guillen wrote 06/27/2022 at 21:13 point

Also, this project is sustainable, because to build it I have recycled old electronic components and wood.

  Are you sure? yes | no

Guillermo Perez Guillen wrote 06/27/2022 at 21:09 point

My project fits the "Hack it Back" category because adds new capabilities to my old scanner to keep it useful, since I have developed a smart mini elevator with it. Now I have turned my outdated scanner into a smart mini elevator that work by voice commands. 

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates