I want to build a smart elevator to scale. A real elevator probably uses a huge A/C motor with sensors at each floor location.
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.
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.
4. Bipolar Stepper MotorTo 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.
5. ModusToolbox SoftwareI 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 made changes.
Analysis:
- To avoid duplication of any pin used by the "IoT sense expansion kit" board, I have enabled four pins to take control of the stepper motor:
In my case, the stepper motor I have used needs 48 steps to make a 360 degree turn. The speed of rotation is controlled by the delay, that is, 2 ms.
- insert the access key obtained from the Picovoice platform in:
static const char* ACCESS_KEY
- I have designed the wake words table shown below:
- case 0 is used to move from floor 1 to 2 or from 2 to 3;
- case 1 is used to move from floor 2 to 1 or from 3 to 2;
- case 2 is used to move from floor 1 to 3; Y
- case 3 is used to move from floor 3 to floor 1.
Step 5. I have added the "Pinky" wake word in the pv_params.h file. This wake word was obtained from the Picovoice platform as shown in the next section.
6. Picovoice Platform
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.
Below I show you the video of the test done with the mini elevator.
Image gallery
Comments