ESP8266 based examples to get started with Internet of Things

Recently I’ve started to use an ESP8266 based development board, WeMos D1R2. It’s nice and most importantly easy to get started with. That too with Arduino IDE. Sample programs are available everywhere on the internet and the projects using it are abundant. What the really problem was a the guides to the tools and web apps.

My public repository for IoT projects are here on Github.com

I’ve referred following tutorials to get starting with WeMos board. Some links are mutually exclusive (;-))

Mydevices.com is an IoT web dashboard app, easy to configure, supported by IoT protocols (MQTT, of course) and plug & play support for Arduino and other common platforms, features are endless. You need to experience it to know the actual power of it.

Free SSL from Let’s encrypt for Odoo in Apache2

Let’s encrypt is a non-profit organization certificate authority established to provide SSL. Their service completely free of cost. The certificates are valid for 3 months, but we can automate the renewal process.
Before doing this, please note that following things need to be replaced by relevant values. I don’t think it needs further explanation.

  • MyServerName
  • MyAdminEmailAddress
  • MyServerAddress

This is tested on Ubuntu 14.04 server running Odoo 9.

Install Apache2

First we need to install the Apache2 server. If you already running it, good – skit these.

Install Let’s Encrypt SSL

Below is an excellent article on this, install it and come back.
https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-ubuntu-14-04

  • Download certbot
  • Setup certificate – Use your erp domain name for generating certificate.
  • setup auto renewal – don’t forget to do this step.

Add Odoo.conf file

  • Add following lines in odoo.conf

Edit Ports.conf

  • Add following content in ports.conf

Enable Odoo configuration

Add following content to the last line of apache2.conf

Additional security and testing

Configuration file in Odoo

The configuration file of Odoo can be located at /etc/odoo-server.conf. It contains the very basic settings of Odoo instance. Let’s look at the contents of a file.

Most of the contents on the file are pretty straight forward. admin_password is the password of the admin user. db_host,db_port and db_user is for connecting to remote databases. Here I’ve used a local database. db_password is for setting database password. I haven’t set a password for db.

Next addons_path is for including the addons and logfile to set log file location.

Changing port

xmlrpc_port sets the port of Odoo. you change the port here.

If you are changing any settings in the file, you need to restart the Odoo service to take the settings in to effect. There are some important things if you are changing port. Please read here.

To restart the service

How to install Odoo 9 on Ubuntu 14.04 – Digital Ocean

Digital Ocean is a very good cloud hosting provider considering the cost and simplicity. It provides some click to install apps too for the easy installation. But Odoo (formerly OpenERP) is not one of them. That’s ok. It is very easy to install Odoo with required modules.

Note: This tutorial is applicable to any VPS providers, not only Digital Ocean

Droplet/VPS setup

This tutorial considers that you’ve already setup a droplet with Ubuntu 14.04 LTS. If not please refer this tutorial: How to setup your first droplet.

Now we have to get inside the VPS, you have three different options to login to a remote server:

  1. Use SSH to connect to droplet
  2. Use PuTTy to login for windows
  3. Use the console in Digital Ocean dashboard

Installation

Now you are in the server. Lets download the script for installing Odoo. This script also installs many dependencies with it. So it is very easy. First download the script. Enter the droplet password when asks.

Now edit the script to change some settings.

The first section contains settings like where to install, port, admin password etc.. Following is the first part of shell script.

Default settings – changes

In the settings, only two things matters for us right now.

The OE_PORT variable is the port which is going to use for accessing Odoo. The default value is 8069, that means your Odoo address will be http://ip-address-of-vps:8069. This can be changed as per your requirement.

OE_SUPERADMIN is variable storing the password of the super admin user. This user will manage the installation and setup of various apps in Odoo. The default username and password is “admin”.
Both of these settings can be changed even after installation, so don’t worry if you are confused.

Let’s make the script executable.

Then install the script and it will take some minutes to complete.

After installation, following output will print i screen.

You can check it by visiting http://ip-address:8069/. If you have changed the default port, you should use that instead of 8069. First screen will be to create the database. Give a name to your database, and enter username and password. Congratulations, you’re seeing the dashboard of Odoo. Go to apps to install applications.

Odoo database naming