วันอาทิตย์ที่ 8 มีนาคม พ.ศ. 2558

Control Raspberry Pi using Windows ( Over VNC Network )



Control Raspberry Pi using Windows ( Over VNC Network )

ควบคุม Raspabrry Pi ผ่านทาง Windows ใช้ VNC Network

You will see the desktop of the Raspberry Pi inside a window on your computer. You'll be able to control it as though you were working on the Raspberry Pi itself. Using VNC.


VNC ( Virtual Network Computing )

VNC is a graphical desktop sharing system that allows you to remotely control the desktop interface of one computer from another. It transmits the keyboard and mouse events from the controller, and receives updates to the screen over the network from the remote host.


For your Raspberry Pi Board

Install the TightVNC package

 $ sudo apt-get install tightvncserver 

Install already then start TightVNC Server which will prompt you to enter a password and an optional view-only password.

 $ tightvncserver 

Then Start VNC Sever

 $ vncserver 


On on your Computer PC or Notebook , install and run the VNC client.
Download VNC

When the installation is complete. You shuld find TightVNC Viewer on the start menu.
Open TightVNC Viewer.
You need power on your raspberry pi and connect to the same network already and you must know your raspberry pi IP Address and screen number ( :0 or :1 )  For example 192.168.0.104:1




Click the Connect button and you will be prompted for the password that was specified when configuring the VNC server on the Raspberry Pi earlier. You should then find yourself at the Raspberry Pi desktop.




Now, you remote control on your raspberry pi board.



<< บทความต่อไป >>


My Website
email : info@softpowergroup.net   Tel .081-6452400



วันเสาร์ที่ 7 มีนาคม พ.ศ. 2558

Python Remote Development on Raspberry Pi with PyDev and Eclipse

Python Remote Development on Raspberry Pi

with PyDev and Eclipse

เขียน Python PyDev บน Raspberry Pi ด้วย Eclipse



Download and Install



Install Eclipse Python plugin


Open eclipse goto menu Help --> Install New Software



Install New Software
use Pydev Plug in Link "http://pydev.org/updates" then Next


New Software Plug in to install
Show "PyDev for Eclipse"  and Version  then Next


Installing  wait for a minute


When Install already
Goto Menu  Window --> Preferences
It show PyDev Menu
Now Install Plug-in Already ! after that need to config in Eclipse.


Configuration of Eclipse

Goto Menu  Window --> Preferences -- > PyDev --> Interpreters --> Python Interpreter
Then Click  New...



Browse your Python Interpreter Executable
Then OK


System Python Path OK


When PyDev  and Python path Ok.
Now need to Setup Remote System for connect eclipse to raspberry pi board.


RSE - Remote Systems Explorer

Goto menu Help --> Install New Software 
1 .Work with  change to All Available Sites
2. Use type filter text  = remote


Then Select General Purpose Tools
and Select  Remote System Explorer End-User Runtime
and Remote System Explorer User Actions
then Next to Install

Finish the installation and restart Eclipse.



Connect to Raspberry Pi
Goto Menu Window --> Open Perspective  -- > Other
Double click Remote System Explorer



Then Right Click on Local
and New -- > Connection


New Connection
Select SSH only


Remote SSH only System Connection
Host Name your Raspberry Pi IP Address


Now Connect and Remote to Raspberry Pi



So,you can open python file and write code in Raspberry Pi using eclipse





<< บทความต่อไป >>


My Website
email : info@softpowergroup.net   Tel .081-6452400

วันพฤหัสบดีที่ 5 มีนาคม พ.ศ. 2558

Raspberry Pi Tools

Raspberry Pi Tools


Remote Access to Raspberry Pi Tool
( เครื่องมือ โปรแกรมรีโมท ไปยัง Raspberry Pi )
You can remotely gain access to the command line of a Raspberry Pi from another computer on the same network using  SSH (SECURE SHELL).

Note you only have access to the command line, not the full desktop environment. For full remote desktop use VNC.
You can enable or disable the SSH server on your Raspberry Pi (it is enabled by default). This is done using  raspi-config.

Use Program  PuTTY ( For Windows )






Transfer Files to Raspberry Pi Tool.
เครื่องมือ โปรแกรมโอนย้ายไฟล์ ไปยัง Raspberry Pi และสามารถแก้ไข file ได้
Transfer Files Across Your Network from Windows to a Raspberry Pi.


Use SCP ( Secure Copy )
Copies a file from one computer to another using ssh. 

Download WinSCP for Windows
http://winscp.net/eng/download.php








WinSCP use sudo

In the WinSCP login options window:


  • Click Advanced options

  • Go to Environment --> SCP/Shell (on left)

  • Select Shell: "sudo su -"



For MAC OSX user for Raspberry Pi Command line.

Use Terminal ( don't need external program )


Then you'll need to know Raspberry Pi IP address to connect it.

ssh pi@<IP>



<< บทความต่อไป >>


My Website
email : info@softpowergroup.net   Tel .081-6452400


วันจันทร์ที่ 8 ธันวาคม พ.ศ. 2557

Raspberry Pi connect TFT LCD with Python Library


Raspberry Pi connect TFT LCD 

with Python Library from Adafruit

Hardware
  1. Raspberry Pi Board ( we use raspberry pi model B )
  2. TFT LCD ( Adafruit  Chip Set ILI9341 or compatible)  we use 2.2" TFT LCD from Elec Freaks  



Feature:
  • TFT01_2.2 SP is a 2.2 "SPI TFT LCD Screen Module, 10pins interface, compatible LCD5110 interface. Not just a LCD break but include SD card (2GB),
  • The LCD in the TFT01 is ILI9341. It's a 240 * 320 (resolution), 2.2S inch TFT LCD screen.The LCD has a wide viewing angle, the contrast is also very suitable.
  • The display interface is serial, it just needs 5 wires (CS, RS, SCL, SDA, RST) for controlling.
  • Replace LCD5110, Support direct plug in ElecFreaks Joystick shield, EFCom, Key Pad Shield etc
  • SDcard use hardware SPI interface (CS / MOSI / MISO / SCK), Not solder pins.
Parameter:
  • SDO: Serial clock output
  • LED: 3.3V IO and Power Supply pin
  • SCL: Serial clock input
  • SDA / SDI: Serial data input
  • DC: Data / Command selection
  • RST: Reset, Low level active
  • CS: Chip Selection, Low level active
  • GND: Ground
  • VDD33: 3.3V Power Supply pin
  • UTFT Support

Wiring Diagram

Raspberry Pi ( Model B )
TFT LCD
Pin 3.3V 
Pin VCC
Pin GND 
Pin GND
GPIO18
Pin DC
GPIO23
Pin Reset
GPIO10 ( SPI0 MOSI )
Pin SDI(MOSI)
GPIO11 ( SPI0 SCLK )  
Pin SCK
GPIO08 ( SPI0 CE0 )
Pin CS



TFT LCD Pinout




Raspberry Pi Pinout






Software

use Python ILI9341 TFT LCD Library from Adafruit
https://github.com/adafruit/Adafruit_Python_ILI9341

Python Code image.py


import Image

import Adafruit_ILI9341 as TFT
import Adafruit_GPIO as GPIO
import Adafruit_GPIO.SPI as SPI


# Raspberry Pi configuration.
DC = 18
RST = 23
SPI_PORT = 0
SPI_DEVICE = 0

# BeagleBone Black configuration.
# DC = 'P9_15'
# RST = 'P9_12'
# SPI_PORT = 1
# SPI_DEVICE = 0

# Create TFT LCD display class.
disp = TFT.ILI9341(DC, rst=RST, spi=SPI.SpiDev(SPI_PORT, SPI_DEVICE, max_speed_hz=64000000))

# Initialize display.
disp.begin()

# Load an image.
print 'Loading image...'
image = Image.open('cat.jpg')

# Resize the image and rotate it so it's 240x320 pixels.
image = image.rotate(90).resize((240, 320))

# Draw the image on the display hardware.
print 'Drawing image'
disp.display(image)


Python Code shapes.py


import Image
import ImageDraw
import ImageFont

import Adafruit_ILI9341 as TFT
import Adafruit_GPIO as GPIO
import Adafruit_GPIO.SPI as SPI


# Raspberry Pi configuration.
DC = 18
RST = 23
SPI_PORT = 0
SPI_DEVICE = 0

# BeagleBone Black configuration.
# DC = 'P9_15'
# RST = 'P9_12'
# SPI_PORT = 1
# SPI_DEVICE = 0

# Create TFT LCD display class.
disp = TFT.ILI9341(DC, rst=RST, spi=SPI.SpiDev(SPI_PORT, SPI_DEVICE, max_speed_hz=64000000))

# Initialize display.
disp.begin()

# Clear the display to a red background.
# Can pass any tuple of red, green, blue values (from 0 to 255 each).
disp.clear((255, 0, 0))

# Alternatively can clear to a black screen by calling:
# disp.clear()

# Get a PIL Draw object to start drawing on the display buffer.
draw = disp.draw()

# Draw some shapes.
# Draw a blue ellipse with a green outline.
draw.ellipse((10, 10, 110, 80), outline=(0,255,0), fill=(0,0,255))

# Draw a purple rectangle with yellow outline.
draw.rectangle((10, 90, 110, 160), outline=(255,255,0), fill=(255,0,255))

# Draw a white X.
draw.line((10, 170, 110, 230), fill=(255,255,255))
draw.line((10, 230, 110, 170), fill=(255,255,255))

# Draw a cyan triangle with a black outline.
draw.polygon([(10, 275), (110, 240), (110, 310)], outline=(0,0,0), fill=(0,255,255))

# Load default font.
font = ImageFont.load_default()

# Alternatively load a TTF font.
# Some other nice fonts to try: http://www.dafont.com/bitmap.php
#font = ImageFont.truetype('Minecraftia.ttf', 16)

# Define a function to create rotated text.  Unfortunately PIL doesn't have good
# native support for rotated fonts, but this function can be used to make a
# text image and rotate it so it's easy to paste in the buffer.
def draw_rotated_text(image, text, position, angle, font, fill=(255,255,255)):
    # Get rendered font width and height.
    draw = ImageDraw.Draw(image)
    width, height = draw.textsize(text, font=font)
    # Create a new image with transparent background to store the text.
    textimage = Image.new('RGBA', (width, height), (0,0,0,0))
    # Render the text.
    textdraw = ImageDraw.Draw(textimage)
    textdraw.text((0,0), text, font=font, fill=fill)
    # Rotate the text image.
    rotated = textimage.rotate(angle, expand=1)
    # Paste the text into the image, using it as a mask for transparency.
    image.paste(rotated, position, rotated)

# Write two lines of white text on the buffer, rotated 90 degrees counter clockwise.
draw_rotated_text(disp.buffer, 'Hello World!', (150, 120), 90, font, fill=(255,255,255))
draw_rotated_text(disp.buffer, 'This is a line of text.', (170, 90), 90, font, fill=(255,255,255))

# Write buffer to display hardware, must be called to make things visible on the
# display!
disp.display()


Don't forget Disable blacklist 

blacklist file
 /etc/modprobe.d/raspi-blacklist.conf  
nano /etc/modprobe.d/raspi-blacklist.conf    
# blacklist spi and i2c by default (many users don't need them)  
#blacklist spi-bcm2708  
#blacklist i2c-bcm2708  


Reference
Adafruit 2.2” TFT connect BeagleBone Black ( or Raspberry Pi )

Adafruit Raspberry Pi TFT Python Library _ILI9341

2.2" TFT LCD from Elec Freaks

Wiring Diagram

Code form GitHub

Enable SPI for Raspberry Pi
http://www.brianhensley.net/2012/07/getting-spi-working-on-raspberry-pi.html


<< บทความต่อไป >>


My Website
email : info@softpowergroup.net   Tel .081-6452400