general process¶
pm2¶
in the beginning of the project we tried to use everything was used by the previous team, e.g, we wanted to use pm2 commands to run both socket server and the webapp in one command instead of starting them separately, we noticed that it is not working windows operating system we tried solutions like updating nodemon, updating node js, installing windows tool and even using old version of node js and after a research the conclusion was pm2 is not functioning well with windows, and the solution for this is using docker to creat an isolated environment where pm2 could work well, and this is one of reasons why the previous team has used Docker.
1- we need to download docker check get docker for windows follow the steps needed to install it properly. 2-click creat development environment by clicking on Dev Environments then creat.
3-select the root of your project, then open it on visual studio code
using the terminal go to the pm2-little-endian directory, download nodeJs and npm
these commands are for ubunto sudo apt-get install curl
then curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
after that sudo apt-get install nodejs
4- once you have installed nodeJs you can use sudo npm install pm2@latest -g
to install pm2
then pm2 star
which will allow you to run the socket server and the web-application in one command.
before:
after:
to read more about pm2 check this pm2.README
it is so important to know that all you need all this steps every time you close the stop the container, unfortunately we did not have enough time to solve this issue due to the short sprint and the amount of work we need to deliver.
Reducing the heating of the motors:¶
after uploading the code to the WEMOS we noticed that the stepper motors are getting heated even if the motors are in
sleep mode (not running), this caused melting of the stand where the steppers are placed. that is why we made a quick
research about the reason of motor’s heating, we used search terms like accelStepper overheated, reason of heating up
the stepper motor and how to reduce the accelStepper overheating. As a result we found out that it is a typical issue
by stepper
motor here we found the answer
and the reason of it is, that motor holds its position in other words it is using power to hold the gears inside not to
run. we decided to solve this problem by turning the motors down by cutting the power, using the
void AccelStepper::disableOutputs();
method in the accelStepper library. This method makes sure that all pins are set
to low. accelStepper library reference
however we noticed that this solution is working perfect but, it works after doing something with the motors via the blockly, despite the fact that we also set the pins to low in Engin::begin() but somehow the motor is keeping on getting heated. We also tried to call the method which sets the pins low in the method Little-Endian::loop() to make sure it will constantly be set to low but this solution did not work as well, so it is important to take in mind that we need to run the motor via the blockly interface otherwise, the 3D printed design will get melted.
Possible implementation of auditory feedback¶
The Little Endian has at the moment 4 sensors connected to it, which are 2 stepper motors and 2 servo motors. The stepper motors are connected to the 4-pin PCB connector of the Little Endian. The left stepper motor is connected to the “MOTOR LEFT”, and the right stepper motor is connected to the “MOTOR RIGHT”. In the firmware/src/settings.h you can find the configurations for the pins that are used for the stepper motors. The servo motors are connected to the expansion PCB connector. These expansion connectors are meant for the I2C protocol, which you can use to connect multiple sensors to it. But at the moment we are using it make use of 2 servo motors using both the available pins of those expansion connectors. Down below you can see a image of the PCB with the connectors to it. The Red squares are the connectors for the stepper motors, the yellow squares are open slots where a connector hasn’t been soldered on to, and the orange squares are the expansion connectors. With this project we wanted to implement one more sensor that gives some feedback to the user when a certain step or task has been done by the WEMOS. But because both the expansion connectors are used for the servo motors instead of the I2C protocol, we couldn’t implement the extra sensor to the Little Endian.
How to implement I2C¶
For the implementatie of I2C you need to make use of a “Master and Student” relationship. With the Master and student relation it needs more than one PCB’s or WEMOS’s. An example of a Master and student relation between two Arduino’s