1.5 Development Steps this week. #5 #6

Development Step #5 – Controlling servos using the face position.

o Approach.

Tech_Chart.jpg

o Learning Experience.

DSC08218.JPG

I used the Arduino Knob example as a basis for my code.

I changed the functionality of the code below from using a pot meter, to using data from Processing on x and y axis.

/*
Controlling a servo position using a potentiometer (variable resistor)
by Michal Rinott <http://people.interaction-ivrea.it/m.rinott&gt;
modified on 8 Nov 2013
by Scott Fitzgerald
h􀂂p://www.arduino.cc/en/Tutorial/Knob
/
#include <Servo.h>
Servo myservo; // create servo object to control a servo
int potpin = 0; // analog pin used to connect the potentiometer
int val; // variable to read the value from the analog pin
void setup() {
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}
void loop() {
val = analogRead(potpin); // reads the value of the potentiometer (value between 0 and 1023)
val = map(val, 0, 1023, 0, 180); // scale it to use it with the servo (value between 0 and 180)
myservo.write(val); // sets the servo position according to the scaled value
delay(15); // waits for the servo to get there
}

o Result.

Arduino Code:


#include <Servo.h>
Servo servoY; // create servo object to control a servo
Servo servoX;
int ValX;
int ValY;
byte Processing;
int val; // variable to read the value from the analog pin
void setup() {
ValY = 0;
ValX = 0;
Serial.begin(9600);
servoX.attach(13); // attaches the servo on pin 9 to the servo object
servoY.attach(12);
}
void loop() {
if (Serial.available() > 0) {
Processing = Serial.read();
}
if (Processing == 'a') {
ValY–;
servoY.write(ValY);
}
if (Processing == 'b') {
ValY++;
servoY.write(ValY);
}
if (Processing == 'c') {
ValX–;
servoX.write(ValX);
}
if (Processing == 'd') {
ValX++;
servoX.write(ValX);
}
if (Processing == 'e') {
}
if (ValX >= 210){
ValX = 210;
}
if (ValX <= 0){
ValX = 0;
}
if (ValY >= 210){
ValY = 210;
}
if (ValY <= 0){
ValY = 0;
}
}

view raw

Stalker_Arduino

hosted with ❤ by GitHub

Processing Code: https://gist.github.com/TheVisualG/f531f6f5845106767e749d81085954aa
The servos were not having a set diapason and they broke the wooden parts.

o Sources.

Arduino library examples

 

Development Step #6 – Installing Raspbian and VNC

o Approach.

raspbian-logo.png

I am going to follow the steps mentioned on the official website for the installation of the Raspbian OS.

What I need:
– Raspberry
– Power / micro-USB cable + power supply out-putting more than 1A
– USB splitter
– Mouse
– Keyboard
– Monitor

VNC is a lightweight version of TeamViewer , it basically give you an easy access to a remote device. I will follow a guide on the official website.

o Learning Experience.

• First we download a ZIP file from this page https://www.raspberrypi.org/downloads/raspbian/

• We unzip the archive and take the ISO file
• Then using a software called Etcher we Install the ISO file h􀂂ps://etcher.io/ on the SD card.
• If all goes well we can plug the power cable, the hdmi cable, the keyboard and the mouse and boot into Raspbian.
• Opening terminal.
• The next step is updating the OS to the latest release by typing:

sudo apt-get update
sudo apt-get upgrade
sudo reboot

https://learn.pimoroni.com/tutorial/raspberry-pi/keeping-your-raspberry-pi-updated
• If you prefer you can also update the karnel itself by typing:
sudo rpi-update

VNC

VNC-logo.jpg

https://www.raspberrypi.org/documenta􀢢on/remote-access/vnc/

• first install the viewer on your laptop/PC https://www.realvnc.com/en/connect/download/viewer/
• After that download VNC on the raspberry
• After that install in your router settings assign make the raspberry connection Static and then ping it and find
out what is the IP address https://www.raspberrypi.org/documenta􀢢on/remote-access/ip-address.md

o Result.

I followed the steps but at first my raspberry was not boo􀢢ng anything from the SD card.

I tried another approach, which I found while googling my issue.
Instead of using Etcher, I used a software called SD Memory Card Formatter to format the SD card and after that Win32DiskImager
https://www.raspberrypi.org/documentation/installation/installing-images/windows.md

It did work out and I booted into the OS, after updating it through the RPI-update function it stuck on that screen while booting:

rasp1.jpg

After redoing the whole process several times I finally found the issue:

Not every SD card is compatible and I ended using:

On raspberry zero:

rasp2.jpg

On respberry pi 3b:

rasp3.jpg

And I don’t recommend updating the karnel.

I followed the instructions for VLC and it is working!

vnc2.jpg

o Sources

https://www.raspberrypi.org/
https://learn.pimoroni.com/tutorial/raspberry-pi/keeping-your-raspberry-pi-updated
https://www.raspberrypi.org/documentation/installation/installing-images/windows.md
https://sourceforge.net/projects/win32diskimager/files/latest/download
https://www.balena.io/etcher/
https://www.sdcard.org/downloads/formatter_4/
https://www.raspberrypi.org/documentation/remote-access/ip-address.md
https://www.realvnc.com/en/connect/download/viewer/
https://www.raspberrypi.org/documentation/remote-access/vnc/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s