Friday, September 30, 2016

Arduino - Using Servo Motor via the shield for a Pan-Tilt

Motor shield can connect two servos.  The marked locations on the shield are actually the reroute of pins on arduino, for convenience:
  • servo 1 is arduino pin 10
  • servo 2 is arduino pin 9
Yes, reversed. 

Expected value for the analog write ranges from 0 to 180 degrees, when using the servo library.

Example code can be found at
Arduino - Servo

I use them on a pan-tilt, works fine.

stack the joint before mounting the servo
use this little screws on the arm

 




Labels: , , ,

Sunday, September 25, 2016

HOWTO connect Arduino UNO and NodeMCU in IDE on Mac OS X

Arduino 

UNO has many clones.  And different clones use different USB to UART chips.

On mine, I have to install a Virtual Com Port (VCP) driver from FTPI and modify the Product ID and Vendor ID in order to get the driver working.

I did it a while ago.  My memory blurred now.  The followings are some references that might help.

http://www.ftdichip.com/Drivers/VCP.htm


use this guide:  http://www.ftdichip.com/Support/Documents/InstallGuides/Mac_OS_X_Installation_Guide.pdf

My current PID and VID.  I recalled steps: 1) found out what PID and VID my board have.  2) use some tool to modify the config. 3) restart driver, something like kextload.  can't remember now.  I have a note somewhere... will update when I found it back.






NodeMcu 

already has a built-in USB to Serial chip CP2102.  standard one.  connected right away.
the only missing thing is the library:

add the URL to download from (similar to ubuntu update server)

need this library

select board type...

... and serial port

that's it. uploadable right away.

Labels: , , , ,

Saturday, September 24, 2016

My Pi 3 Install Log (10): Arduino development; + some other tools

// First of all, zim for notes, and vnc server for remote access:
sudo apt-get install zim tightvncserver

// now for arduino IDE, libraries, and example codes, I did only:
sudo apt-get install arduino arduino-core

// before starting the IDE, install node.js stuff:
sudo apt-get install nodejs npm
Failed to install:
npm install http-server -g


* * *

now working on Arduino IDE is out of the box:

 

I tried download a basic example 'blink', yes, it worked great!





Labels: , , ,

My Pi 3 Install Log (9): Wireless Connections

The biggest advantage that makes Pi 3 stands out from the older generations are the built-in WiFi and Bluetooth.

ref:
http://www.makeuseof.com/tag/setup-wi-fi-bluetooth-raspberry-pi-3/

sudo apt-get update
sudo apt-get upgrade

to search for available hotspots:
sudo iwlist wlan0 scan



note the SSID of interest, setup password for wifi.  (yes, plain text storing password)
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
You’ll need to add or edit the following:
network={
ssid="SSID"
psk="WIFI PASSWORD"
}

now restart wifi module
sudo ifdown wlan0
sudo ifup wlan0

* * *
for bluetooth, i tried the below, package not found.
sudo apt-get install bluetooth-pi
so i did this instead, works:
sudo apt-get install bluez bluez-firmware
the command below starts the config program... with its prompt
bluetoothctl
enter 'help' for available commands.

to search for devices:
power on
agent on
scan on
and of course, to turn off, use 'off' in place of 'on'.

didn't install 'blueman' yet.  download 18MB -> 6x MB.  i don't need it for now, like command line.
but as ref:
sudo apt-get install blueman
sudo reboot


Labels: , , , ,

Saturday, September 10, 2016

OSX Arduino 3rd party Libraries installation path

Third party libraries usually distributed in zip files.
Old Arduino IDE required users to mkdir a 'libraries' within the app, and then into it manually expand  the zipped libraries... Those days are gone.

With latest Arduino IDE, no unzip at all.
Launch IDE, click menu 'sketch>include library>add .ZIP library...', now navigate to the zip file, say,  ~/Download/IRremote.zip, selected.
done.
yes, that's it.

Already expanded to ~/Document/Arduino/libraries/IRremote.

Restart IDE for that libraries' example code.

For more detail, see the link in readme.txt inside the libraries folder.

Labels: , ,