Cayenne IoT Platform – complete steps to Connect the Raspberry Pi with Cayenne IoT Platform

Cayenne cloud and Raspberry Pi Connectivity establishment link attached with this post. Check out the below mentioned link and follow the steps to Launch your first IoT Project within a minutes

http://www.instructables.com/id/Cayenne-Raspberry-Pi-IoT-Simple/

Below link will talk about the cayenne IoT platform rules and triggers

https://pimylifeup.com/raspberry-pi-cayenne/

A quick start – Cayenne IoT Platform

Advertisements

change the baudrate of HC-05 Bluetooth module in an easy way within a short time – complete procedure

If you want to change some of the settings of your HC-05 Bluetooth module, like baud rate, password or the name of the Bluetooth module, you can do it easy and fast with your Arduino.

There are different HC-05 modules on the market, but it should work with all of them. On the picture below you can see a bare HC-05 module, 5V tolerant HC-05 module and 6V tolerant HC-05 module with a button. I prefer the last one, as the button makes the changing of the settings even easier.

IMG_9290

To change any settings of the module, it should be in the so called “AT Mode”. How to put the Bluetooth module in AT Mode: The “Key Pin” of the module should be set to “High”. This means we should apply voltage to this pin at the same time we power the module. On the last module, the button does this job. It should be pressed when powering the module with 5V. On the module without button, we need to supply 3.3V to the “Key Pin” when powering on.

Here is an example how to connect the module to the Arduino Nano v3. Note that there should be an jumper on GND and RST pin. By doing this, the Arduino will only act as a simple FTDI adapter.

IMG_9291

First connect the Arduino to the PC over USB. Then connect the cables in the following way:

  • TX Bluetooth –> TX Arduino
  • RX Bluetooth –> RX Arduino
  • GND Bluetooth –> GND Arduino

… and at last the 5V Bluetooth to 5V Arduino by keeping the button of the Bluetooth pressed. Or on the module without button, connect the Key Pin Bluetooth to 3.3V on Arduino.

If the HC-05 is in AT Mode, the red LED will blink at every 2 seconds.

Then start the PuTTY program configure the right COM Port (Check it in the Device Manger) and set the Baud Rate to 38400. This is the baud rate for AT Mode. Then click “Open”.

HC-05.over.PuTTY

In the newly opened black window type “AT”, press Enter and you should get “OK” as a result. Note that you want see what you type in the windows… Here some of the commands to change the settings you wish:

Change baud rate to 57600, 1 stop bit, 0 parity AT+UART=57600,1,0
Change module name AT+NAME=YOURNAME
Change pairing code AT+PSWD=0000

Note: You can use other similar terminal applications such as teraterm, Hyperterminal, Docklight these all were supported by windows. For ubuntu users you can use gtkterm terminal.

Python Regular expression – r’^$’  explanation and it’s use

In Python, r’^$’  is a regular expression that matches an empty line

This looks like a regular expression (regex) commonly used in Django URL configurations.

The ‘r’ in front tells Python the expression is a raw string. In a raw string, escape sequences are not parsed. For example, ‘\n’ is a single newline character. But, r’\n’ would be two characters: a backslash and an ‘n’.

Raw strings are handy in regex, in which the backslash is used often for its own purposes. Using ‘[\\w]’ versus r'[\w]’ results in easier to read expressions. This is more salient when you’re escaping backslashes within your regular expression: ‘[\\\\]?’ (shudders).

The ‘^$’ is the actual regular expression, and represents an empty line. The ‘^’ indicates the start of a line, and the ‘$’ indicated the end of a line. Having nothing between the two therefore matches an empty line.

In Django this expression will usually appear at the bottom of your urlpatterns list. It will catch all URLs that weren’t matched by the preceding patterns.

For this particular case, the raw string was unnecessary. Having it here will make it more consistent with urlpatterns that do benefit from being a raw string.

Example: The example code below attempts to explain this, the two entries in the list that match are the completely empty string and the string with just a newline character:

 import re
 regexp = r'^$'
 example_strings = [
   'this regular expression should just match empty lines',
   'the r prefix just denotes a raw string (to ignore special charcters)',
   'the ^ looks for the start of a line',
   'the $ looks for the end of a line',
   'lets try an empty line to test that theory',
   '',
   'and a line with just a newline character',
   '\n']
 for eg in example_strings:
    print('checking: ' + eg)
    if re.match(regexp, eg):
       print(' it matches')
    else:
      print(' no match')

Python & pip Windows installation

Python install

At the time of this writing is Python 2.* compatible. This could be/probably will be changing in the future (spring 2015?).

Installation of Python itself should be fairly straight-forward.

  • Download and execute the latest Python 2.* installation package from here.
    At the time of this writing, Python 2.7.8 is the latest.
    While either 32-bit (x86) or 64-bit (x86-64) versions should work just fine, I tend to gravitate to 32-bit installs as I have encountered other libraries/modules in the past that only offered 32-bit versions. I have no idea if those modules that pushed me to 32-bit in the past still do not support 64-bit, but I’m a creature of habit.
  • Verify a successful installation by opening a command prompt window and navigating to your Python installation directory (default is C:\Python27). Type python from this location to launch the Python interpreter.
    Microsoft Windows [Version 6.2.9200]
    (c) 2012 Microsoft Corporation. All rights reserved.
    
    C:\Users\Username>cd C:\Python27
    
    C:\Python27>python
    Python 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)] on win
    32
    Type "help", "copyright", "credits" or "license" for more information.
    >>>
    
  • It would be nice to be able to run Python from any location without having to constantly reference the full installation path name. This can by done by adding the Python installation path to Windows’ PATH ENVIRONMENT VARIABLE
    *In Windows 7 and Windows 8, simply searching for “environment variables” will present the option to Edit the system environment variables. This will open the System Properties / Advanced tab
    *In Windows XP, right click on My Computer->Properties to open System Properties and click on the Advanced tab.
  1. On the System Properties / Advanced tab, click Environment Variables to open User Variables and System Variables
  2. Create a new System Variable named Variable name: PYTHON_HOME and Variable value: c:\Python27 (or whatever your installation path was)
  3. Find the system variable called Path and click Edit
  4. Add the following text to the end of the Variable value:;%PYTHON_HOME%\;%PYTHON_HOME%\Scripts\ 
  5. Verify a successful environment variable update by opening a new command prompt window (important!) and typing python from any location
    Microsoft Windows [Version 6.2.9200]
    (c) 2012 Microsoft Corporation. All rights reserved.
    
    C:\Users\Username>python
    Python 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)] on win
    32
    Type "help", "copyright", "credits" or "license" for more information.
    >>>
    

Pip install

The easiest way to install the python modules and keep them up-to-date is with a Python-based package manager called Pip

There are many methods for getting Pip installed, but my preferred method is the following:

  • Download get-pip.py to a folder on your computer. Open a command prompt window and navigate to the folder containing get-pip.py. Then run python get-pip.py. This will install pip.
  • Verify a successful installation by opening a command prompt window and navigating to your Python installation’s script directory (default is C:\Python27\Scripts). Type pip freeze from this location to launch the Python interpreter.
    pip freeze displays the version number of all modules installed in your Python non-standard library; On a fresh install, pip freeze probably won’t have much info to show but we’re more interested in any errors that might pop up here than the actual content

    Microsoft Windows [Version 6.2.9200]
    (c) 2012 Microsoft Corporation. All rights reserved.
    
    C:\Users\Username>cd c:\Python27\Scripts
    
    c:\Python27\Scripts>pip freeze
    antiorm==1.1.1
    enum34==1.0
    requests==2.3.0
    virtualenv==1.11.6
    
  • It would be nice to be able to run Pip from any location without having to constantly reference the full installation path name. If you followed the Python installation instructions above, then you’ve already got the pip install location (default = C:\Python27\Scripts) in your Windows’ PATH ENVIRONMENT VARIABLE. If you did not follow those steps, refer to them above now.
  • Verify a successful environment variable update by opening a new command prompt window (important!) and typing pip freeze from any location
    Microsoft Windows [Version 6.2.9200]
    (c) 2012 Microsoft Corporation. All rights reserved.
    
    C:\Users\Username>pip freeze
    antiorm==1.1.1
    enum34==1.0
    requests==2.3.0
    virtualenv==1.11.6

How to use Filezilla client with Intel Galelio Board to upload and download the files from local machine to board, vice-versa

Here we are transferring the file with an SFTP client called FileZilla. FileZilla Client is a free, open source and multiplatform FTP client that supports SFTP. You can download and install it here: http://filezilla-project.org.

Once you have installed and executed FileZilla Client, you must follow the next steps to add the SFTP server running on the board in with the application’s Site Manager:

1. Select File | Site Manager.
2. Click New Site on the Site Manager dialog box. Enter the desired name, such as IntelGalileo2 to easily identify the board’s SFTP service.
3. Enter the board’s IP address in Host. You don’t need to enter any value in Port because the SFTP server uses the default SFTP port, that is, the same port in which the SSH daemon listens: port 22.
4. Select SFTP – SSH File Transfer Protocol in the Protocol dropdown.
5. Select Normal in the Logon Type dropdown.
6. Enter root in User. The next screenshots shows the configuration values for a board that has 192.168.1.107 as its assigned IP address.

Capture17. Click Connect. FileZilla will display an Unknown host key dialog box, indicating that the server’s host key is unknown. It is similar to the information provided when you established the first connection to the board with an SSH client. The details include the host and the fingerprint. Activate the Always trust this host, add this key to the cache checkbox and click OK.
8. FileZilla will display the /home/root folder for the Yocto Linux running on the board at the right-hand side of the window, under Remote Site.
9. Navigate to the folder in which you saved the Python files you want to transfer in your local computer under Local site.
10. Select the file you want to transfer and press Enter to transfer the file to the /home/root folder on the board. Another way is to right-click on the desired file and select Upload. FileZilla will display the uploaded file in the /home/ root folder under Remote Site. This way, you will be able to access the Python file in the default location that Yocto Linux uses when you login with an SSH terminal, that is, in your home folder for your root user. The following picture shows many Python files uploaded to the /home/root folder with FileZilla and listed in the contents of the /home/root folder.

CaptureThe next time you have to upload a file to the board, you don’t need to setup a new site in the Site Manager dialog box in order to establish an SFTP connection. You just need to select File | Site Manager, select the site name under Select Entry and click Connect.

 

GitHub Complete understanding for professional developer

What is remote and origin in git?

remote” is just some git repository not on your computer (e.g. on github). “origin” is the repository you cloned your repository from (e.g. the one on your github). “master” is just the name of the default branch.

What is downstream and upstream in git?

As far as Git is concerned, every other repository is just a remote. Generally speaking, upstream is where you cloned from (the origin). Downstream is any project that integrates your work with other works. The terms are not restricted to Git repositories

What is a GitHub fork?

 A fork is a copy of a repository. Forking a repository allows you to freely experiment with changes without affecting the original project. Most commonly, forks are used to either propose changes to someone else’s project or to use someone else’s project as a starting point for your own idea.

Syncing a fork

Sync a fork of a repository to keep it up-to-date with the upstream repository.

Before you can sync your fork with an upstream repository, you must configure a remote that points to the upstream repository in Git.

  1. Open Git Bash.
  2. Change the current working directory to your local project.
  3. Fetch the branches and their respective commits from the upstream repository. Commits to master will be stored in a local branch, upstream/master.
    git fetch upstream
    remote: Counting objects: 75, done.
    remote: Compressing objects: 100% (53/53), done.
    remote: Total 62 (delta 27), reused 44 (delta 9)
    Unpacking objects: 100% (62/62), done.
    From https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY
     * [new branch]      master     -> upstream/master
  4. Check out your fork’s local master branch.
    git checkout master
    Switched to branch 'master'
  5. Merge the changes from upstream/master into your local master branch. This brings your fork’s master branch into sync with the upstream repository, without losing your local changes.
    git merge upstream/master
    Updating a422352..5fdff0f
    Fast-forward
     README                    |    9 -------
     README.md                 |    7 ++++++
     2 files changed, 7 insertions(+), 9 deletions(-)
     delete mode 100644 README
     create mode 100644 README.md

    If your local branch didn’t have any unique commits, Git will instead perform a “fast-forward”:

    git merge upstream/master
    Updating 34e91da..16c56ad
    Fast-forward
     README.md                 |    5 +++--
     1 file changed, 3 insertions(+), 2 deletions(-)

Configuring a remote for a fork

You must configure a remote that points to the upstream repository in Git to sync changes you make in a fork with the original repository. This also allows you to sync changes made in the original repository with the fork.

  1. Open Git Bash.
  2. List the current configured remote repository for your fork.
    git remote -v
    origin  https://github.com/YOUR_USERNAME/YOUR_FORK.git (fetch)
    origin  https://github.com/YOUR_USERNAME/YOUR_FORK.git (push)
  3. Specify a new remote upstream repository that will be synced with the fork.
    git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git
  4. Verify the new upstream repository you’ve specified for your fork.
    git remote -v
    origin    https://github.com/YOUR_USERNAME/YOUR_FORK.git (fetch)
    origin    https://github.com/YOUR_USERNAME/YOUR_FORK.git (push)
    upstream  https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git (fetch)
    upstream  https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git (push)

Changing a remote’s URL

The git remote set-url command changes an existing remote repository URL.

The git remote set-url command takes two arguments:

  • An existing remote name. For example, origin or upstream are two common choices.
  • A new URL for the remote. For example:
    • If you’re updating to use HTTPS, your URL might look like:
      https://github.com/USERNAME/REPOSITORY.git
      
    • If you’re updating to use SSH, your URL might look like:
      git@github.com:USERNAME/REPOSITORY.git

Which remote URL should I use?

Refer the link:  https://help.github.com/articles/which-remote-url-should-i-use/

GITHUB PULL REQUEST, Branching, Merging & Team Workflow