gettingstarted – Experiment – Enjoy – See it working – Share http://pagealh.com Thu, 26 Oct 2017 19:09:20 +0000 en-US hourly 1 https://wordpress.org/?v=6.6.2 http://pagealh.com/wp-content/uploads/2017/10/1_Primary_logo_256-150x150.jpg gettingstarted – Experiment – Enjoy – See it working – Share http://pagealh.com 32 32 Getting Started with Arduino Pro Mini http://pagealh.com/2015/05/08/getting-started-with-arduino-pro-mini/ http://pagealh.com/2015/05/08/getting-started-with-arduino-pro-mini/#comments Fri, 08 May 2015 03:36:06 +0000 http://pagealh.com/?p=958 Continue reading

]]>
Reviewed by Editor: Jack Allison

HW Components:

Arduino/Funduino Pro Mini (ebay). It comes without programming related HW on it (as at other Arduino products), but pre-programmed with boot-loader. The boot-loader allows to upload new code to Arduino Pro mini without the use of an external smart hardware programmers, but just using different TTL RS232 to USB converters and Arduino IDE (which uses ATmel STK500 protocol).

PL-2303HXD USB to Serial Bridge Controller (ebay) is USB to RS232 auto-converter module (PL-2303HXD spec). Also (according to this video) devices like FTDI FT232RL (ebay) and USB to TTL UART Silicon Labs CP2102 (ebay) are useful for same purpose.

– USB extension cable (to make PC USB port closer to you on your table)

SW Components:

– IDE – Arduino IDE

– Blink Arduino example sketch. At Arduino IDE, use File\Examples1.Basic\Blink menu to open the sketch at the IDE

Step-by-step:

– connect the PL-2303HX converter to your Arduino as following

* Arduino TX -> PL’s RX

* Arduino TR -> PL’s TX

* Arduino GND (one of the two) -> PL’s  GND

* Arduino GND (another one) -> GND from 5V power supply (usually black)

* Arduino VCC (of Funduino VBUS) -> 5V power supply wire (usually red)

Note: You may have your Arduino working from the  PL-2303HX power pins, but this is not enough for your device programming. To program your sketch into your Arduino you have to have it connected to stable external DC power source. So, when programming/uploading, leave the 5V and 3V pins at PL-2303HX not connected to the Arduino power rails

Note: No additional load (except of that necessary fro programming) shall be applied on Arduino power rails during programming. So, you should separate the programming and the product activation stages: first program your Arduino and then test it in the final circuit with all the necessary connections to sensors, relays and so on.

IMG_20150508_062225

– Stup Arduino IDE with appropriate parameters:

* chose appropriate board by menu Tools\Board\Arduino Pro or Pro mini

* check Tools\Processor shows ATmega328 (5V, 16, MHz)

* using menu Tools\Port chose the Serial port (UART) on which programming will be performed. Once you connect  your PL-2303HX to your windows PC appropriate driver (from Prolific) should be found by Windows (no additional work should be needed).

* use default programmer: Tools\Programmer\AVRISP mkII

– For your own LED’s blinking rate… At the Arduino IDE, change the delays in the default Blink sketch (File\Examples1.Basic\Blink) to appropriate values in milliseconds

// the loop function runs over and over again forever

void loop() {
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}

– Use ‘Verify’ button to check the sketch still be compiling

– To Upload your sketch to your Arduino do the following:

* Click the Upload button and follow notifications at the IDE’s notification area

* You will see “Compiling sketch…” notification

* Wait ‘Uploading…’ notification appeared

* Shortly press and release (toggle) the ‘Reset’ HW button on your Arduino Pro Mini: the only available button. This should initiate the actual uploading.

* After few seconds you should see  ‘Done uploading’ notification. If process is going to fail you will wait for about minute or two and then you will get some failure notifications in alarming colors.

– If all  went well you will see the red LED blinking at the rate you have specified at the Sketch

– if NOT try to recover and to repeat the uploading.

Recovery: 

As to my understanding, with such a constellation as described at this page there may be problems with boot-loader or with Prolific driver.

For me the following recovery process always worked:

– Disconnect  Arduino from power and let its LEDs turn off

– disconnect the  PL-2303HX from the USB port so that it is also powered off

– Then, FIRST connect the Arduino back to power, let its led to blink few seconds and only after that connect the PL-2303HX back to the USB port.

– Usually after this process the upload suceeded.

I suspect, that  periodic failures may relate also to the length of the USB extension cable. So that if you still having things not working, try to use shorter cable or to manage without such a cable at all.

Related links:

Uploading Sketch to Arduino Pro mini using PL2303

Arduino Pro Mini – Uploading Skatches

Arduino Pro Mini – Description

 

]]>
http://pagealh.com/2015/05/08/getting-started-with-arduino-pro-mini/feed/ 1
Getting Started with Raspberry PI (RPi) board http://pagealh.com/2014/10/25/getting-started/ Sat, 25 Oct 2014 14:02:44 +0000 http://pagealh.com/?p=188 Continue reading

]]>
Reviewed by Editor: Jack Allison

RPi-Zero ebay/RPi-A+ ebay/RPi-B ebay/RPi2-B ebay

Step-By-Step Start (for RPi Model B, B+)

  1. Clone (make a backup copy) of your pre-installed NUBS SD-card (or create OS SD card from your downloaded image)
  2. Using HDMI cable, connect the board to your TV/monitor.
  3. Connect USB keyboard and mouse to your Raspberry Pi board (starting with B-model you have 2 and more USB ports).
  4. Plug micro-usb power supply into the board.
  5. Long Shift-button at first boot -> Install Raspbian (recommended option)
  6. Boot for the first time with Raspbian and enter configuration.
    – Enable Advanced\SSH
    – Enable Pi Camera
    – Enable boot to desired startup screen: Boot with Pi user to graphical screen; to command line etc.
    – Reboot
  7. Connect to your home LAN with Ethernet cable and check your RPi’s IP address: ‘ifconfig‘ in command line

Access to RPi configuration (after first boot)

Access to the configuration screen is possible at any time after you booted with RPi. This is useful in case something went wrong or was forgotten at first boot (ex. to set SSH enabled to be able to connect with Putty) or whenever you want to enable/disable additional advanced options.

At the Terminal’s command prompt, type:

sudo raspi-config

Connect from your home PC

This may be necessary if you plan to use a single monitor+keyboard+mouse set for working with both your Raspberry Pi and for your PC while both are connected to the same LAN router which has DHCP Server (all modern routers), which assigns IP addresses automatically.

Depending on your RPi usage model, you may need to switch between the following work-modes in as fast and comfortable ways as possible:
– working on your PI/PC directly with the same monitor+keyboard+mouse
– working on RPi from your PC through some Remote Control Utility (ex.to see all on one screen for simultaneous observation and capturing of results)

To allow this fast switch, I would recommend connecting both your RPi and your PC to KVM switch. This will also allow you to manage with a single monitor only.

Once we connected all our HW and we know the IP address of our Raspberry PI (from the above step: ifconfig command) we can use at least 4 ways to connect and work remotely described below.

However, there is one problem with some remote access methods described further. Remote Desktop and TightVnc Server don’t work with main desktop, but only with the secondary desktop (Raspbian has 2 desktops by default) and I was unable to figure out how to make it working with main desktop.

Although working with a secondary desktop may be enough for many use-cases, there are cases where you would like to see what is displayed on the main desktop. In this case x11vnc server is recommended.

  • SSH:

  1. Download Putty SSH and FTP utilities on your Win/Unix PC machine
  2. Open a terminal session to your RPi with Putty (using SSH protocol). Login name: pi password: raspberry
  3. Update your RPi (through Pytt’s SSH command line)

– Check your /etc/apt/sources.list contains the following lines (as described here):

deb http://archive.raspbian.org/raspbian wheezy main contrib non-free
deb-src http://archive.raspbian.org/raspbian wheezy main contrib non-free

– sudo apt-get update
– sudo apt-get dist-upgrade
– Raspberry Pi firmware updater: sudo rpi-update

  • Remote Desktop (Secondary RPi Desktop):

    1. To install the remote desktop execute the following commands at the Terminal commend line (at your Raspberry Pi if you are using TV/monitor or at Putty’s SSH terminal)
sudo apt-get install -y xrdp

sudo service xrdp stop
sudo service xrdp start

2. Start Remote Desktop application (mstsc.exe in Windows) to access your RPI

  • TightVnc Server (Secondary RPi Desktop):

sudo apt-get install -y tightvncserver

Access to main desktop with TightVnc Server is possible with TightVNC Viewer or  Android VNC Client

  • VNC (Main RPi Desktop):

After installing and configuring VNC server (x11vnc) you will have access to RP’s main desktop from Windows/Linux with standard VNCClient or TightVNC Viewer

– install

sudo apt-get install -y x11vnc

– create the VNC start-up configuration file, stored in home directory

sudo nano ~/.xsessionrc

– in nano editor edit the text as follows:

x11vnc -bg -shared -forever -tightfilexfer -nopw -display :0

– press CTRL+O then ENTER to write (save) the file then CTRL+X to exit

– make the file executable

sudo chmod 775 ~/.xsessionrc

– to configure HDMI resolution open /boot/config.txt

sudo nano /boot/config.txt

– in nano editor

hdmi_force_hotplug=1
 ;SVGA 1024×768@60Hz:
 hdmi_group=2
 hdmi_mode=16
 ;Full HD 1920×1080@60Hz:
 hdmi_group=2
 hdmi_mode=82

– Press CTRL+O then ENTER to write (save) the file then CTRL+X to exit

– restart your RPi

Security

If you plan expose your RPi to the Internet (using NAT virtual server feature for example) you may want to protect your RPi from being accessed by strangers. The following actions may be taken for this purpose.

  • Change your RPi password

For this, use ‘sudo raspi-config’ command’s menu ‘Change User Password’

  • Protect VNC service with password

For information on how to do this you may use this link or x11vnc help command which is quoted below.

"... You can create an x11vnc password file by running:
 'x11vnc -storepasswd password /path/to/passfile'
 or 'x11vnc -storepasswd /path/to/passfile'
 or 'x11vnc -storepasswd
 the last one will use '~/.vnc/passwd'

x11vnc

x11vnc -rfbauth /path/to/passfile
 an existing '~/.vnc/passwd' file from another VNC application will work fine too. @#

You can also use the -passwdfile or -passwd options. Note -passwd is unsafe if local users are not trusted. Make sure any -rfbauth and -passwdfile password files cannot be read by untrusted users.

Use x11vnc -usepw to automatically use your '~/.vnc/passwd' or '~/.vnc/passwdfile' password files.
 and prompt you to create ~/.vnc/passwd if neither file exists. Under -usepw, x11vnc will exit if it cannot find a password to use... "

Recommended References:

]]>