Sunday, May 15, 2016

Updating firmware of Wi-Fi ESP8266 Module using FTDI

"This is one procedure for downloading and installing the latest available firmware on an ESP8266 using the flash tool provided by Espressif, the chip manufacturer."


Windows 10
PuTTY 0.67



Hint:

  • The operation of the ESP8266 outside of stated limits may be unstable and unreliable - you could damage your sanity.
  • The ESP8266 may draw more current than the 3.3V regulator on your Arduino can supply - you could damage your Arduino. Use a separate 3.3v power source.

Hardware:

  • ESP8266 - ESP01 module
  • FTDI - FT232RL module
  • StepDown 5v-3.3v module

Schematics:
Schematics using FTDI of 5v and a stepdown module




Downloads:


Installing the Firmware:

  • Power up your ESP connecting it to your PC.
  • Press and hold the Reset button, and then press and hold the Flash button. Release the Reset button, and then release the Flash button.
  • Click the box in the flash download tool GUI window labeled "SpiAutoSet," which will cause the download tool to automatically select the correct flash size and crystal frequency.
  • In the flash download tool GUI window, select checkbox on the left and click the START button.

Flash Download Tool DOS window

Flash Download Tool GUI window

  • Press and hold the Reset button, and then press and hold the Flash button. Release the Reset button, and then release the Flash button. Click the START button in the Flash Download Tool GUI window. The download should begin, and its progress should be shown in the Flash Download Tool GUI window and the log window, as depicted below.
Loading firmware

  • When the flash operation is complete, close the Flash Download Tool. Remove power from the ESP board, and then reconnect the power.

Testing:

  • Open PuTTY, and click the Serial radio button. Enter the COM port number (which must be less than 10) and the baud rate (which will most likely be 115200 or 9600.)
  • Click the Open button, and a PuTTY terminal session window should open.


  • Enable Caps Lock on your PC, and type AT, but don't press Enter. You should see AT in the PuTTY terminal window. If you don't, you may have selected the wrong COM port or the wrong baud rate. Close PuTTY and start again at the top of this section. The permissible baud rates are: 9600, 19200, 38400, 74880, 115200, 230400, 460800, and 921600; try each one in turn until you find the one that works.
  • Enable Caps Lock on your PC, and type AT, but don't press Enter. You should see AT in the PuTTY terminal window. Type a + sign followed by GMR. When you see AT+GMR in the PuTTY terminal window, while holding the Ctrl key down, press the M key followed by the J key. Release the Ctrl key. You should see the ESP8266 firmware information in the PuTTY terminal window similar to that shown in the picture below.




Links:

If you like this content, feel free to

Sunday, March 27, 2016

Install OpenCV and WebPy on Raspberry Pi

Raspbian
OpenCV


Install:
  • Install Raspberry Pi updates:
  • sudo apt-get update
  • sudo apt-get upgrade
  • sudo rpi-update
  • Reboot:
  • Install webpy:
  • cd ~
  • wget http://webpy.org/static/web.py-0.37.tar.gz
  • gzip -d -r web.py-0.37.tar.gz
  • tar -xvf web.py-0.37.tar 
  • cd ./web.py-0.37
  • sudo python setup.py install
  • Install OpenCV requirements:
  • sudo apt-get install build-essential cmake pkg-config
  • sudo apt-get install libgtk2.0-dev
  • sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
  • sudo apt-get install libatlas-base-dev gfortran
  • wget https://bootstrap.pypa.io/get-pip.py
  • sudo python get-pip.py
  • sudo pip install virtualenv virtualenvwrapper
  • sudo rm -rf ~/.cache/pip
  • Then, update your ~/.profile  file to include the following 3 lines:
  • # virtualenv and virtualenvwrapper
  • export WORKON_HOME=$HOME/.virtualenvs
  • source /usr/local/bin/virtualenvwrapper.sh
  • Reload profile:
  • source ~/.profile
  • mkvirtualenv cv
  • sudo apt-get install python2.7-dev
  • pip install numpy  (zzz... 45min)
  • Download and Install OpenCV:
  • wget -O opencv-2.4.10.zip http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.11/opencv-2.4.11.zip/download
  • unzip opencv-2.4.11.zip
  • cd opencv-2.4.11
  • mkdir build
  • cd build
  • cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_NEW_PYTHON_SUPPORT=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON  -D BUILD_EXAMPLES=ON ..
  • ???this or the last one??? cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON ..
  • Compile OpenCV:
  • make  (zzz... 9h)
  • sudo make install
  • sudo ldconfig
  • Check if installtion is ok:
  • ls /usr/local/lib/python2.7/dist-packages
  • But in order to utilize OpenCV within our cv  virtual environment, we first need to sym-link:
  • cd ~/.virtualenvs/cv/lib/python2.7/dist-packages/
  • ln -s /usr/local/lib/python2.7/dist-packages/cv2.so cv2.so
  • ln -s /usr/local/lib/python2.7/dist-packages/cv.py cv.py

Links:
If you like this content, feel free to

Monday, January 18, 2016

MobileSim - Simulator for Pioneer (MobileRobots) Robots

Windows 10

Aria 2.9.0.1  (32bits)
MobileSim 0.7.2

Status:
  • 2016.01.18 - Simulator (MobileSim) is working. Python example (simple.py) is working with MobileSim.

Todo:
  • Test java example.
Instalation on Windows:
  • Download and install ARIA SDK.
  • Configure PATH system variable - C:\Development\Aria_2.9.0-1_32bit\bin;C:\Development\Aria_2.9.0-1_32bit\python;C:\Development\Aria_2.9.0-1_32bit\java
  • Configure PYTHONPATH system variable - C:\Development\Aria_2.9.0-1_32bit\python
  • Download and install MobileSim.
Testing Python Examples:
  • cd \Development\Aria_2.9.0-1_32bit\PythonExamples
  • Start MobileSim, with C:\Development\Aria_2.9.0-1_32bit\maps\triangle.map
  • python simple.py




References:
If you like this content, feel free to

Wednesday, June 24, 2015

Installing Ubuntu 12.04 and ARIA (Pioneer API) on BeagleBone (White)

Windows 7
Ubuntu 12.04
Win32DiskImager
PuTTY 0.63
ARIA 2.9.0

Status:
  • 2015.06.24 - "ARIA has been installed in /usr/local/Aria".
  • 2015.06.24 - "ARIA has been installed in /usr/local/Aria" on Ubuntu 14.04. But ARIA APIs and demo app are running an error "ImportError: /usr/local/Aria/python/_AriaPy.so: cannot open shared object file:"

Installing Ubuntu 14.04 for BeagleBone:
  • Download Ubuntu for BeagleBone microSD card image (bone-ubuntu-14.04.2-console-armhf-2015-06-11-2gb.img.xz).
  • Write image to microSD card using Win32DiskImager.
  • Boot BeagleBone Board with RJ45 pluged.
  • Access BeagleBone with SSH client (user: ubuntu pass: temppwd)
  • Change sudo password:
  • sudo -i
  • passwd (ubuntu)
  • exit


Compiling ARIA from sources:
  • Installing dependencies to compile de sources:
  • sudo apt-get install binutils-multiarch gcc-4.6 build-essential swig python-dev python-setuptools python-serial
  • Configuring Enviroment to recompile ARIA files from sources:
  • Create PYTHONPATH and PYTHON_INCLUDE system variable:
  • sudo nano ~/.bashrc
  • Include these four lines below at the end of this file:
  • PYTHONPATH="/usr/local/Aria/python:${PYTHONPATH}"
  • export PYTHONPATH
  • PYTHON_INCLUDE="/usr/include/python2.7:${PYTHON_INCLUDE}"
  • export PYTHON_INCLUDE
  • Start a new shell or reload the config file by running the command below:
  • source ~/.bashrc
  • Download ARIA 2.9.0 - Other 32-bit Linux systems (Generic compressed TAR archive) with GCC 4.6
  • cd ~/
  • wget http://robots.mobilerobots.com/ARIA/download/current/ARIA-2.9.0+gcc4.6.tgz
  • tar -xzvf ARIA-2.9.0+gcc4.6.tgz
  • cd Aria-2.9.0/
  • sudo make install
  • The result is listed below:
------------------------------------------------------------------------------------
ARIA has been installed in /usr/local/Aria.

To be able to use the ARIA libraries, you must now add /usr/local/Aria/lib
to your LD_LIBRARY_PATH environment variable, or to the /etc/ld.so.conf system file,
then run 'ldconfig'
------------------------------------------------------------------------------------


  • Rebuild Python wrapper Library:
  • sudo nano ~/Aria-2.9.0/Makefile
  • CXX:=g++-4.6
  • PYTHON_INCLUDE:=/usr/include/python2.7
  • PYTHON_INCLUDE_FLAGS=-I/usr/include/python2.7
  • sudo make python   (zzz... +- 1h)
  • Setting enviroment variable:
  • sudo nano /etc/ld.so.conf.d/aria.conf
  • Include these two lines (below) on this file:
  • include /usr/local/Aria/lib
  • include /usr/local/Aria/python
  • configure dynamic linker run-time bindings:
  • sudo ldconfig


References:

If you like this content, feel free to

Sunday, April 12, 2015

Raspbian - Stream - Webcam+Motion Or Pi Camera+MMAL Motion

Raspbian v2015-02-16
Motion
MMAL Motion




Status:

  • 20150412 - It's working.
Notes:
  • Pi camera works at 10~14fps.
  • Webcam works at 30?fps.
  • Using 50% for jpeg quality and size: 256x144px (Pi Camera).
  • With this configuration, CPU use is about  33%~96% for motion with webcam, and about 19%~53% for mmal-motion and Pi Camera.
  • It only works with firefox (Windows and Android? version).

Installing Motion for Webcam:

  • Install Motion:
  • sudo mkdir /home/webcam
  • sudo chmod 777 /home/webcam
  • cd /home/webcam
  • sudo apt-get install motion
  • Configure Motion:
  • sudo nano /etc/motion/motion.conf
  • Changing config file:
  • daemon on
  • framerate 15
  • threshold 500
  • gap 10
  • max_mpeg_time 30
  • output_normal center
  • ffmpeg_video_codec msmpeg4
  • target_dir /home/webcam
  • webcam_motion on
  • webcam_maxrate 30
  • webcam_port 8085
  • webcam_localhost off
  • Configure autostart of Motion:
  • sudo nano /etc/default/motion
  • Start Motion:
  • sudo motion
  • Troubleshooting:
  • "cannot create process id file ..."
  • mkdir /var/run/motion
  • chmod a+rwxt /var/run/motion

Testing Motion for Webcam:

  • http://<Raspberry-pi_IP-address>:8085

Installing MMAL Motion for Pi Camera:

  • Install Motion, dependencies and MMAL Motion:
  • sudo apt-get install motion libjpeg62
  • cd ~/
  • mkdir mmal
  • cd mmal
  • wget https://www.dropbox.com/s/jw5r1wss32tdibb/motion-mmal-opt.tar.gz
  • tar -zxvf motion-mmal-opt.tar.gz
  • cd ./motion-mmal
  • Configure Motion:
  • nano motion-mmalcam.conf
  • Changing config file:
  • daemon on
  • gap 10
  • mmalcam_secondary_buffer_upscale 2
  • stream_secondary off  (ON to use with mmalcam_secondary_buffer_upscale)
  • output_secondary_pictures off  (ON to use with mmalcam_secondary_buffer_upscale)
  • ffmpeg_output_secondary_movies off (ON to use with mmalcam_secondary_buffer_upscale)
  • Start MMAL Motion:
  • cd ~/mmal/motion-mmal/
  • ./motion-mmal -n -c motion-mmalcam.conf
Testing  MMAL Motion for Pi Camera:
  • http://<Raspberry-pi_IP-address>:8081


References:

Other options for Streaming:
If you like this content, feel free to

Sunday, April 5, 2015

Raspbian - Pi Camera - MJPG-Streamer and Raspistill

Raspbian v2015-02-16
MJPG-Streamer v182
Raspistill


Status:

  • 20150505 - Its working. 
Notes:
  • Since pi camera is 5Mpx and HD, we're using 854x480 resolution.
  • Pi camera works at 1~2fps.
  • Using "Sport" exposure option to reduce distortion generated by the moviment.
  • Using 50% for jpeg quality (file size = +- 200kb. If use 10% then +-23Kb, else if 34% then +-150kb, else if 75% then +-240kb, else if  1280x720x50% than +-510kb).
  • With this configuration, CPU use is about  2%~3% for raspistill and +-2% for mjpg-streamer.
  • Using 640x360x50% results in 100kb file size.
  • It works with firefox and chrome (Windows and Android versions).

ToDo:

  • Compare performances (mjpg-streamer-raspistill / motion).

Installing:

  • Enabling Pi Camera:
  • sudo raspi-config
  • Select Enable camera and hit Enter, then go to Finish and you'll be prompted to reboot.
  • Install build dependencies:
  • sudo apt-get install libjpeg8-dev imagemagick libv4l-dev
  • Add missing videodev.h:
  • sudo ln -s /usr/include/linux/videodev2.h /usr/include/linux/videodev.h
  • Download MJPG-Streamer:
  • wget http://sourceforge.net/code-snapshots/svn/m/mj/mjpg-streamer/code/mjpg-streamer-code-182.zip
  • Unzip the MJPG-Streamer source code:
  • unzip mjpg-streamer-code-182.zip
  • Build MJPG-Streamer:
  • cd mjpg-streamer-code-182/mjpg-streamer
  • make mjpg_streamer input_file.so output_http.so
  • Install MJPG-Streamer:
  • sudo cp mjpg_streamer /usr/local/bin
  • sudo cp output_http.so input_file.so /usr/local/lib/
  • sudo cp -R www /usr/local/www
  • Start the camera and MJPG-Streamer:
  • mkdir /tmp/stream
  • raspistill --nopreview -w 640 -h 480 -q 5 -o /tmp/stream/pic.jpg -tl 100 -t 9999999 -th 0:0:0 & LD_LIBRARY_PATH=/usr/local/lib mjpg_streamer -i "input_file.so -f /tmp/stream -n pic.jpg" -o "output_http.so -w /usr/local/www"
  • Cleanup (removing source code files):
  • cd ../../
  • rm -rf mjpg-streamer-182

Testing:

  • http://<Raspberry-pi_IP-address>:8080

References:

Other options for Streaming:
If you like this content, feel free to

Saturday, December 6, 2014

Raspberry Pi - Using eSpeak with Pidora

Raspberry Pi
Pidora 2014
eSpeak 1.47.11


Status:

  • It's working.
Install:
  • login as root:
  • yum install espeak
Test:
  • Login as an user (not root):
  • espeak "testing with espeak"
  • espeak testing,with,espeak
  • espeak -vpt "testando a voz da lingua portuguesa"
Troubleshotting:
  • Don't run espeak with root user, it will freeze and only will work again after reboot;
  • eSpeak was interfered by alsa-tools*, xdotool and libxdo;
  • Sometimes espeak freezes when it's trying to speak a word with incorrect syntax;
  • Sometimes espeak freezes, or just don't tell anything, if it receives two commands in a short time.
References: