Parametric Screw to Zip Tie Adapter

By ctherouxNo Comments
view4

A “Parametric Screw to Zip Tie Adapter” is now available. More details at Parametric Screw to Zip Tie Adapter .

3D Printing, object

Customizable Small Linear Carriage

By ctherouxNo Comments
Small Carriage Top

A “Customizable Small Linear Carriage Generator” is now available. More details at Customizable Small Linear Carriage .

3D Printing, object

Script to create a shared git project

By ctherouxNo Comments

This script creates a git project to be shared among the users of the Unix group $GIT_GROUP. Every git project will be created into the directory $REPOSITORIES_BASE_DIR.

#!/bin/bash

# Base directory where the shared git project are.
REPOSITORIES_BASE_DIR="/home/git"
# Group in which the user's of the repositories must be a member of
GIT_GROUP=git

if [ $# -ne 1 ]; then
        echo 'Usage:' `basename $0` 'project-name'
        exit 1
fi

PROJECT_NAME=$1

cd "$REPOSITORIES_BASE_DIR"
git init --shared --bare "$PROJECT_NAME"
cd ..
find git/$PROJECT_NAME -type d | xargs setfacl -R -m d:g:$GIT_GROUP:rwX
sudo setfacl -R -m g:$GIT_GROUP:rwX git/$PROJECT_NAME
GIT, Linux, Ubuntu, Unix

VirtualBox fails on startup

By ctherouxNo Comments

Result Code: NS_ERROR_FAILURE (0x80004005) / Kernel driver not installed (rc=-1908) are the errors displayed when the kernel driver needs to be recompiled. It usually happens when updates to Ubuntu are installed.

The kernel driver can be recompiled by issuing one the following commands:

sudo /etc/init.d/vboxdrv setup

or

sudo /sbin/rcvboxdrv setup

The former one works for Ubuntu versions prior to Ubuntu 16.04. If the first one is not found on your system, try the second one.

Ubuntu, Virtual Box

Port forwarding using SSH

By ctherouxNo Comments

SSH port forwarding let you connect to a server using another server a relay.

For example, if you host a web server in a DMZ behind your office router, you will not be able to access it using its public URL if your workstation is behind the same router.

You can easily implement a workaround if you have access to a server on the Internet. Issue this command on one of the machines connected on the same network as your workstation.

ssh -fN -t -C -D 192.168.1.50:2080 example.com

where

  • 192.168.1.50 is the address of the machine that will accept connections from your LAN on port 2080.
  • example.com is the machine on the Internet that will establish connections to the final destination

You may need to add the port number on which example.com listen to using the -p option. If SSH listens to port 8787 on example.com, the command would be:

ssh -p 8787 -fN -t -C -D 192.168.1.50:2080 example.com

You may also need to supply a user name to connect to example.com. The command would then look like:

ssh -p 8787 -fN -t -C -D 192.168.1.50:2080 remoteuser@example.com

You can use this setup with a browser if you configure it to use a proxy to connect to the Internet. For example, access the proxy configuration of Firefox: preferences >> advanced >> network >> settings. Choose Manual proxy configuration and fill-out the SOCKS host parameters.

SSH Port Forwarding

The result will be that Firefox will open the URLs you type-in using the server example.com.

SSH, Ubuntu, Unix

Reset Unity Top Menu Bar Widget Panel

By ctherouxNo Comments

Sometimes, widget disappears from the Top Menu Bar Widget Panel of Unity. The Widget Panel can be reset using the following command:

killall unity-panel-service
Ubuntu, Unity

Make Linux use the hardware clock set to local time

By ctherouxNo Comments

Ubuntu sometimes assumes that the hardware clock of the computer is set to GMT. If the hardware clock is set to local time, set UTC=no in /etc/default/rcS.

Linux, Ubuntu

Move and secure the MySQL data directory

By ctherouxNo Comments

By default, the data directory of MySQL is /var/lib/mysql. This can be a security issue, especially on a laptop. If your home directory is encrypted, you can easily secure you MySQL data. Backup you data before using this information. Read the procedure until the end before doing anything.

First, follow these steps to move the data directory of MySQL.

  1. Stop MySQL.
  2. sudo service mysql stop
  3. Copy the current database to its new location /home/yourhomedir/mysql.
  4. sudo mv /var/lib/mysql /home/yourhomedir/
  5. Create a link to prevent issues with innoDB tables
  6. ln -s /home/yourhomedir/mysql /var/lib/mysql
  7. Change the value of datadir in the file /etc/mysql/mysql.conf.d/mysqld.cnf for your new data directory location /home/yourhomedir/mysql
  8. Modify the two occurences of /var/lib/mysql with /home/yourhomedir/mysql in /etc/apparmor.d/usr.sbin.mysqld
  9. Reload apparmor
  10. sudo service apparmor reload

If you moved the MySQL data directory to an encrypted home directory, you will need to perform these supplementary steps.

  1. Disable MySQL from starting at system boot.
  2. sudo update-rc.d mysql remove
  3. Add MySQL to the group related to the user that owns the encrypted home directory
  4. sudo usermod -a -G yourhomedir mysql
  5. Change the permissions of the encrypted directory
  6. sudo chmod 750 /home/yourhomedir

In this scenario, you will need to start MySQL after you logged on and shut it down before loggoff which include shutting down the system. To start mysql, use the following command:

sudo service mysql start

To stop MySQL, use the following command:

sudo service mysql stop

If everything works fine, you can remove the original MySQL data directory using this command:

sudo rm -fr /var/lib/mysql
Linux, MySQL, Ubuntu

hwclock: ioctl(RTC_RD_TIME) to /dev/rtc to read the time failed: Invalid argument

By ctherouxNo Comments
ARPI600

This error occurred on Raspbian Jessie using an ARPI600. I was trying to set up the real-time clock. I could resolve the issue by running the following command:

hwclock --systohc -D --noadjfile --utc

after enabling it with the command

echo pcf8563 0x51 > /sys/class/i2c-adapter/i2c-1/new_device

0x51 may differs on you installation. Run i2cdetect -y 1 to find the right value.

ARPI600, Raspberry PI, Raspbian

Extrusion Rail Customizable Fastener

By ctherouxNo Comments
view1

A “Extrusion Rail Customizable Fastener” is now available. More details at Extrusion Rail Customizable Fastener .

3D Printing, object

Customizable Linear Carriage Generator

By ctherouxNo Comments
view4

A “Customizable Linear Carriage Generator” is now available. More details at Customizable Linear Carriage Generator .

3D Printing, object

Fix “The Update Information Is Outdated”

By ctherouxNo Comments

Sometimes, the message “The Update Information Is Outdated” is displayed when you click on a red warning red icon in the status bar. It happened to me last week. This time, it was caused by a Google Chrome update that failed. First, open a terminal (Control + Alt + T) and run the command

sudo apt-get update

If you get an error message related to Google, you can fix it by editing the /etc/apt/sources.list.d/google-chrome.list file. You can do so by issuing the previously opened terminal window

sudo gedit /etc/apt/sources.list.d/google-chrome.list

Make sure that the repository line looks like

deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main
Ubuntu, Ubuntu 14.04, Ubuntu 15.04

Parametric utility box

By ctherouxNo Comments
DSCN2057

A “Parametric Utility Box” is now available. More details at Parametric utility box .

3D Printing, object

Maximum Frequency of a ESP8266 – Revisited

By ctherouxNo Comments

The ESP8266 can yield a 163 kHZ wave using the Arduino IDE and writing the code in C.  The code used is:

int pin = 5;
void setup() {
  pinMode(pin, OUTPUT);
}
void loop() {
  digitalWrite(pin, HIGH);
  digitalWrite(pin, LOW);
}

Nevertheless the wave form is far from being square as show on the picture below.  Click on the picture to enlarge it.

ESP8266 generated wave In C

By adding a 5 uS delay, we get a pretty good square wave.  The frequency is then 85.6 kHZ.  The code used is:

int pin = 5;
void setup() {
  pinMode(pin, OUTPUT);
}
void loop() {
  digitalWrite(pin, HIGH);
  delayMicroseconds(5);
  digitalWrite(pin, LOW);
}

The yielded wave form is given below.  Click on the picture to enlarge it.

ESP8266 generated wave In C with correction

The frequency is 60 times higher than running a similar code on the ESP8266 with NodeMCU.

ESP8266, Internet of Things, IoT

Maximum Frequency an ESP8266 can yield

By ctherouxNo Comments

An ESP8266 running NodeMCU can yield maximum frequency of 1.44 kHz with a duty cycle of 61%.  The wave form is given below.  The code used to perform this test is:

pin = 8
gpio.mode(pin, gpio.OUTPUT);
while true do
 tmr.wdclr()
 gpio.write(pin, gpio.LOW)
 gpio.write(pin, gpio.HIGH)
end

Without clearing the watch dog (tmr.wdclr), the device can yield a frequency of 1.84 kHz.  Without clearing the watch dog, the device reboots after a few seconds.

ESP8266 Wave Form

Click on the picture to enlarge it.

ESP8266, Internet of Things, IoT, NodeMCU

Interrupt NodeMCU init.lua

By ctherouxNo Comments

It can be sometimes challenging to regain control of the NodeMCU running on a ESP8266 when init.lua has a tight loop in it.  To do so,  first, download esptool.py from GitHub.

Execute the following command

python esptool.py --port /dev/ttyUSB0 --baud <baud-rate> erase_flash

where

<baud-rate> is the baud rate of the connection between the ESP8266 and your PC.  Typically, 9600.

<serial-port> is the serial port the ESP8266 is connected to.  Typically,  /dev/ttyUSBn on Linux.

After having done this, you will need to re-install NodeMCU.  It can be done using the following command:

python esptool.py --port /dev/ttyUSB0 --baud <baud-rate> 
     write_flash 0x00000 <nodemcu-path>

where

<baud-rate> is the baud rate of the connection between the ESP8266 and your PC.  Typically, 9600.

<serial-port> is the serial port the ESP8266 is connected to.  Typically,  /dev/ttyUSBn on Linux.

<nodemcu-path> is the filename an path of the NodeMCU image.  Example: ../nodemcu_float_0.9.6-dev_20150704.bin

ESP8266, Internet of Things, IoT, Linux, NodeMCU

ESP8266 Resources Page

By ctherouxNo Comments

I have written a page that contains many useful links about the ESP8266 platform.  You can display this page either using the top menu option “ESP8266 Resources” or by cliking on this link.

ESP8266, Internet of Things, IoT, NodeMCU

ESP8266 – Remarkable free book

By ctherouxNo Comments

NodeMCU LUA base ESP8266 Development Kit

A remarkable book about the ESP8266 is freely available.  It can be downloaded from Kolban’s book on the ESP8266.  It contains more than 300 pages of information.  This book is a very good overview of the technology and a great starting point if you want to develop around this device.

Table of Contents

  • Introduction
  • Overview
  • Connecting to the ESP8266
  • WiFi Theory
  • AT Command Programming
  • Assembling circuits
  • Programming
    • Boot mode
    • The ESP8266 SDK
    • Compiling
    • Linking
    • Debugging
    • Architecture
    • WiFi at startup
    • Working with WiFi
    • Working with TCP/IP
    • ESP-NOW
    • Working with I2C
    • Hardware SPI
    • Working with serial
    • Task handling
    • Timers and time
    • Working with memory
    • Working with flash memory
    • Pulse Width Modulation – PWM
    • Analog to digital conversion
    • Sleep modes
    • Watchdog timer
    • Security
    • Mapping from Arduino
    • Partner TCP/IP APIs
    • Programming using Eclipse
    • Programming using the Arduino IDE
    • Programming with JavaScript
    • Programming with Lua
    • Programming with Basic
    • Integration with Web Apps
    • Mobile apps
    • Sample Snippets
    • Sample applications
    • Sample Libraries
    • Reference materials
    • C++ Programming
    • Simple class definition
    • Lambda functions
    • Ignoring warnings
    • Eclipse
    • ESPFS breakdown
    • ESPHTTPD breakdown
    • Makefiles
    • Forums
    • Reference documents
    • Github
    • SDK
  • Heroes
  • Areas to Research
ESP8266, Internet of Things, IoT, NodeMCU

EGit does not shows project decorations

By ctherouxNo Comments

EGit

Decorations are not displayed when some commits are not pushed EGit within the Eclipse IDE. These are the UP and DOWN arrows shown to the right of the project name in Eclipse Project Explorer. This issue can be resolved by going into the properties of the GIT repository in the Git Repositories view. Then click on Add Entry and add the following keys and values:

branch.master.remote = origin
branch.master.merge = refs/heads/master
Eclipse, GIT

Hard reset a Cree Connected light bulb

By ctheroux3 Comments

Hard Reset Cree Connected Light Bulb

I acquired a few days ago a Wink Hub along with a few Cree Connected light bulbs. I couldn’t pair them. Out of 5 bulbs, I was able to pair only one of them! After reading many posts on the Internet, I have made sure that the Wink Hub is not near my router, the light bulb was in range of the Wink Hub, and so on. I found out that one possible solution was to reset the light bulbs. I found the same recipe on many web sites, which were saying: “Turn the bulb off for 2 seconds, then on for 2 seconds. Repeat three more times. After the fourth cycle, the bulb will flash, indicating that the reset was successful.” It wasn’t working.

I contacted the technical support of Wink. They gave me the following method which worked right away. The method they gave me is:

1. Begin with the bulb turned off
2. Turn the bulb ON for 1 second
3. Turn the bulb OFF for 2 seconds
4. Repeat steps 2 and 3 until the bulb momentarily dims (about 4 or 5 times)
5. It will only dim for a second, signaling that it has been factory reset

Notice on step 2, 1 second, not 2. I could pair my 4 other bulbs without any problem.

automation, Cree, Wink
Blue Taste Theme created by Jabox