Experiments – Experiment – Enjoy – See it working – Share http://pagealh.com Wed, 28 Mar 2018 11:07:57 +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 Experiments – Experiment – Enjoy – See it working – Share http://pagealh.com 32 32 RASPBERRY PI EXPERIMENT 13: Anemometer based on sensors F200-201/2 v2 http://pagealh.com/2016/02/20/raspberry-pi-experiment-13-anemometer-based-on-sensors-f200-2012-v2/ Sat, 20 Feb 2016 23:08:04 +0000 http://pagealh.com/?p=1603 Continue reading

]]>
Related Experiments:

Experiment Goals:

1. Create one more anemometer instance after the first was installed

2. Optimize power delivery cirquit by externalizing of main AC-DC converter and using new very small DC-DC converter.

Conclusion:

Definitely with that power solution the contents of the electronics box looks much more clean.

Components:

  • new component was used for 5V to 12V conversion up: mini DC-DC Boost Module Converter 3V 3.3V 5V to 12v 1200mA Step-up (ebay)

Story: 

Previous anemometer instance was installed near Tavor mountain

[youtube=https://www.youtube.com/playlist?list=PLWvbA9xESZLaXZawtp89yo5xciInFzLqT]

Some pictures from that location:

IMG-20160212-WA0002 IMG-20160212-WA0003 IMG-20160212-WA0007 IMG-20160212-WA0017

This is how the process of new anemometer instance building was look like:

]]>
Raspbery Pi [streaming]: Stationary Recording/Playback Training Assistance System http://pagealh.com/2016/01/02/rpi-stationary-recordingplayback-training-assistance-system/ Sat, 02 Jan 2016 14:07:33 +0000 http://pagealh.com/?p=1438 Continue reading

]]>
Goal: 

To create a mini-system for sportsmen that allows:

  • to sportsmen (ex. wrestlers) to record their training routines with purpose to analyse it right after the routine completion by observing on a tv-screen. This is supposed to assist in fixing of the mistakes yet during the same training session.
  • to play pre-recorded training video-materials (requires large enough hard drive)

Additional requirements:

    • wireless communication between recording and playback of mini-system
    • using same remote control for recording and playback part

Components:

  • Camera:
  • MediaCenter for playback:
    • Raspberry Pi Model 2 (ebay)
    • USB PC Remote (ebay)
    • SONNICS 750GB EXTERNAL PORTABLE HARD DRIVE 2.5″ USB 2.0 (ebay)
    • Plastic DIY Box (ebay)
    • 5v Power Adapter (ebay)

Terminology:

LIRC – Linux Infrared Remote Control

SW:

https://github.com/intelmakers/training_session_recorder/blob/master/session_recorder.py

Recording:

IR interface stand-alone testing

by http://wiki.openelec.tv/index.php/OpenELEC_FAQ to ssh OpenElec:

 - user: root
 - password: openelec

at camera at /etc/fstab define mount of openelec

//192.168.1.35/videos /home/pi/videos_share cifs username=root,password=openelec,uid=0,gid=0,rw,file_mode=0777,dir_mode=0777,iocharset=utf8 0 0

20160102_092149

Assembled camera (RPi+PiCam+IR+WiFi)

20160102_113123

Recording using raspivid

raspivid -t 0 -o file.h264

Recording stop

pkill raspivid

Conversion to mp4 with MP4Box

sudo apt-get update
sudo apt-get install gpac
MP$Box -add file.h264 file.mp4

Playback:

Limitations: USB2 only drive might be used here (USB3 drives weren’t recognized by RPi)

20151010_145649 20151016_195547 20151010_164702

All together:

20160102_140059

 

AUXILIARY SUBSYSTEM: Video streaming to another floor through Wireless-LAN

Rpi Camera Wifi -> WLAN router->wire between floors->WLAN router->Rpi Rceiver -> HDMI TV Set

Based on: Getting started with RPi Camera

Video transmission from RPi camera through LAN to RPi connected to TV by HDMI:

This is to let parents observe the training from outside of the training-room

 

 

]]>
Raspbery Pi. Getting Started with IR receiver using lirc-rpi overlay http://pagealh.com/2015/12/20/raspbery-pi-getting-started-with-ir-receiver/ http://pagealh.com/2015/12/20/raspbery-pi-getting-started-with-ir-receiver/#comments Sun, 20 Dec 2015 03:45:15 +0000 http://pagealh.com/?p=1403 Continue reading

]]>
really?

no coLIRC – Linux Infrared Remote Control

tsop34838

  • Make sure you are connected to Internet: ‘ping google.com’ should produce answers from some IP address
  • After connected to Internet, install ‘lirc’: sudo apt-get install lirc
  • To enable lirc-rpi overlay (on that pin you connected) add the following line to config.txt (sudo nano /boot/config.txt):

dtoverlay=lirc-rpi,gpio_in_pin=18,gpio_out_pin=17

  • reboot with for this new configuration to have effect
  • After reboot, configure GPIO pin you just connected (assign gpio_out_pin to not connected one)

modprobe lirc-rpi gpio_in_pin-18 gpio_out_pin=17

  • check the connection succeeded:
    • ‘dmesg’ command should show the messages like below
    • and you should have lirc0 device: ‘ls /dev/lirc0’
[ 4.791065] lirc_dev: IR Remote Control driver registered, major 246
[ 4.928351] lirc_rpi: module is from the staging directory, the quality is unknown, you have been warned.
...
[ 5.968099] lirc_rpi: auto-detected active low receiver on GPIO pin 18
[ 6.028343] lirc_rpi lirc_rpi: lirc_dev: driver lirc_rpi registered at minor = 0
[ 6.032275] lirc_rpi: driver registered!
  • kill the loaded lirc-rpi

‘ps aux | grep lirc’ – to know if lirc process exists


pi@(none) ~ $ ps aux | grep lirc
root 393 0.0 0.4 3644 1548 ? Ss 14:18 0:00 /usr/sbin/lircd --driver=default --device=/dev/lirc0
pi 3149 0.0 0.4 3556 1776 pts/0 S+ 14:20 0:00 grep --color=auto lirc

In case ‘lirc’ process is there, use one of the following commands to kill it:


sudo /etc/init.d/lirc stop
sudo pkill lirc

Note: Just using ‘kill -QUIT <PID>’ will not help as the process lirc changes its PID constantly

    • start sensing key signals by

mode2 -d /dev/lirc0

Now if you press any button on your remote you is supposed to get a sequence on your screen that describes timing diagram of that specific signal

 

20151220_070023 20160102_092149

    • Teach LIRC about specific buttons of your remote control.

– First, save for yoursef LIRC’s default key-names


irrecord --list-namespace > ~/lirc_keys.txt

– Then, provide key-presses to the ‘irrecord‘ command: follow the instructions provided by the command and use your ~/lirc_keys.txt when asked to give names for specific buttons.

# Stop lirc to free up /dev/lirc0
sudo /etc/init.d/lirc stop

# Create a new remote control configuration file (using /dev/lirc0) and save the output to ~/lircd.conf
irrecord -d /dev/lirc0 ~/lircd.conf

# Make a backup of the original lircd.conf file
sudo mv /etc/lirc/lircd.conf /etc/lirc/lircd_original.conf

# Copy over your new configuration file
sudo cp ~/lircd.conf /etc/lirc/lircd.conf

# Start up lirc again
sudo /etc/init.d/lirc start

 

– After you are done lircd.conf will look like below


# Please make this file available to others
# by sending it to <lirc@bartelmus.de>
#
# this config file was automatically generated
# using lirc-0.9.0-pre1(default) on Sat Jan 9 11:49:38 2016
#
# contributed by
#
# brand: ./lirc.conf
# model no. of remote control:
# devices being controlled by this remote:
#

begin remote

name ./lirc.conf
bits 8
flags SPACE_ENC|CONST_LENGTH
eps 30
aeps 100

one 272 1843
zero 272 786
ptrail 272
pre_data_bits 8
pre_data 0xE2
gap 50265
toggle_bit_mask 0x0

begin codes
KEY_A 0xC4
KEY_B 0x44
KEY_C 0x84
KEY_D 0x04
end codes

end remote

 

  • Add lirc-pi to the configuration:

– change LIRC configuration (sudo nano /etc/lirc/hardware.conf) as following:


# /etc/lirc/hardware.conf
#
# Arguments which will be used when launching lircd
LIRCD_ARGS=""

#Don't start lircmd even if there seems to be a good config file
#START_LIRCMD=false

#Don't start irexec, even if a good config file seems to exist.
#START_IREXEC=false

#Try to load appropriate kernel modules
LOAD_MODULES=true

# Run "lircd --driver=help" for a list of supported drivers.
DRIVER="default"

# usually /dev/lirc0 is the correct setting for systems using udev
DEVICE="/dev/lirc0"
MODULES="lirc_rpi"

# Default configuration files for your hardware if any
LIRCD_CONF=""
LIRCMD_CONF=""
  • To have you lirc starting at RPi boot add the following line to your /etc/rc.local (sudo nano /etc/rc.local):
sudo /etc/init.d/lirc start
  • To see how LIRC decodes the keys you configured use ‘irw’ command and then press the buttons your LIRC learned.

Example:


pi@(none) ~ $ irw
000000000000e2c4 00 KEY_A ./lirc.conf
000000000000e2c4 01 KEY_A ./lirc.conf
000000000000e2c4 02 KEY_A ./lirc.conf
000000000000e284 00 KEY_C ./lirc.conf
000000000000e284 01 KEY_C ./lirc.conf
000000000000e284 02 KEY_C ./lirc.conf

Useful Links:

]]>
http://pagealh.com/2015/12/20/raspbery-pi-getting-started-with-ir-receiver/feed/ 3
GETTING STARTED: Dynamic DNS (DDNS) http://pagealh.com/2015/08/08/getting-started-dynamic-dns-ddns/ Sat, 08 Aug 2015 12:04:16 +0000 http://pagealh.com/?p=1193 Continue reading

]]>
Ingredients:
  • Router with DDNS feature support. Ex: RT-AC66R ( ebay )
  • DDNS provider (ex: no-ip)
  • http-server exposing some service at some port and running using static-IP

Steps:

  • Sing-up for DDNS server provision and specify your host-name (ex: intelmakers.ddns.net)
  • Configure your router’s DDNS settings

IMG_20150808_142228

  • At your router, add your service to port forwarding table

IMG_20150808_142303

 

  • Try to access your service using host-name and service port. Any Internet browser shall be fine for that. Mozilla FireFox is most recommended for custom HTTP servers.

IMG_20150808_142445

20150808_151538

Useful links:

]]>
Arduino: Self-switching corridor lamp (motion detector, relay) http://pagealh.com/2015/05/09/arduino-self-switching-corridor-lamp/ Sat, 09 May 2015 12:58:35 +0000 http://pagealh.com/?p=984 Continue reading

]]>
Project Idea and Requirements by: Masha Lipshits

Goals:

– to learn using Arduino uC, relay and motion sensor

– using Arduino Pro mini, to make our corridor lamp automatically switching ‘On’ if motion is detected in the area of the entrance-hall. Switch ‘Off’ – by timeout.

– finally installed prototype shall be extendable (ex. by RF components sending motion detection to central PC) and allowing easy and safe maintenance and upgrade.

Note: As a result of this post being reviewed and discussed at Hackaday, I’d like to note (thanks the reviewers) that using Arduino in this experiment is NOT necessary, as the project was not finally extended with RF transceiver as planned. RF transmission of “LAMP-IS-OF” activated IR sensor and turned the lamp back ON, and lack of time were making me finishing this experiment in the middle. Thus, the not is as following, again:  for just lamp switch on-off solution Arduino is actually not necessary. The reason is a presence of “Time Delay Adjust potentiometer at HC-SR501 Motion Detection sensor used here, which sets how long the output remains high after detecting motion (anywhere from 5 seconds to 5 minutes) so that it may be used for driving of the enable pin at the relay.

Components:

– HW: Arduino Pro Mini’s clone Funduino

– HW: Relay (one relay is enough, but I had only two-channel relays) Theory 

– HW: Motion Detection sensor

– HW: 220V->5V AC to DC converter (taken from old power supply)

– SW: sketch

– Mech: old plastic box

– Mech: spare Raspberry-Pi camera case (for motion detection sensor)

Wiring:

wiring_01

Description:

– Learning to use Arduino lead to creation of the appropriate ‘Getting-Started’ page

– Then was a turn to try and use relay with Arduino GPIO.

IMG_20150508_232948IMG_20150508_232952

– motion detector also was connected to another GPIO pin configured to be treated as input.

IMG_20150508_205956IMG_20150509_112549

– after enabling of the components,  bread-board based complete prototyping and after completion of the Arduino SW sketch, there stage of  final assembling begun.

– motion detector sensor was placed into special case which will allow to install it at some distance from the switching module and the lamp itself so that the sensor will provide sufficient coverage of the entrance hall and will not react on motion at the adjacent guest-room

IMG_20150509_121047 IMG_20150509_120721

– AC-related components were attached to the top cover of the box and connected to the 220V AC source

IMG_20150509_124938 IMG_20150509_131358

IMG_20150509_131332

– then digital components and wires were prepared at the bottom cover of the box

IMG_20150509_134312 IMG_20150509_134300

– then all was assembled in place and sealed.

IMG_20150509_141201 IMG_20150509_141330

IMG_20150509_141335 IMG_20150509_141411

– all appears to be working as expected

And here how the final product looks like

IMG_20150614_193512IMG_20150614_193659

IMG_20150614_193437IMG_20150614_193619

]]>
Raspberry Pi experiment 17: RF 433Mhz with SMAKN Tx/Rx Kit http://pagealh.com/2015/04/25/raspberry-pi-experiment-17-rf-433mhz-with-smakn-txrx-kit/ Sat, 25 Apr 2015 15:14:39 +0000 http://pagealh.com/?p=914 Continue reading

]]>
Goal: Learn using RF 433Mhz with SMAKN Amplitude-Shift-Keying Tx/Rx Kit

Components:

SMAKN 433MHx Transmitter and Receiver modules (ebay) (scarce data is downloadable)

IMG_20150425_081423  IMG_20150425_082118

– RPi and its GPIO pins

– Tool: http://www.zeitnitz.eu/scope_en described also here

Wiring:

rpi_tx_rx_01

SW:

Virtual wire from here by abyz with a bug fixed by me (the tx gpio pi wan’t set to 0 after transmission completion thus a sometimes lots of strong noise was observed at the receiving side).
This utility code uses pigpio module also from abyz

– Code from mine experiment

Conclusions:

– Even bad scope gives eyes when dealing with signals and especially RF
– In case of this SMA RF kit at least one antenna is essential (either at transmitting or receiving side) to improve signal strength (and consequently signal to noise ratio – SNR).
– Receiver has small coiled antenna soldered on it. The antenna we add just extends the default antenna coming with the module. The expanded antenna also amplifies noises. Thus, spoken of signal-to-noise-ratio (SNR) ,  it appears to me to me (based on this experiment) that the best configuration with these modules is: straight-wire antenna  at the Transmitter and default antenna at the Receiver.

Experiment Description:

– this is a constellation with antennas at both sides transmitting and receiving: transmitter – 21sm of straight wire, receiver – 36sm of wire coiled into 3.5sm long antenna
IMG_20150423_094704 IMG_20150424_150458 IMG_20150424_213919

– DATA pin sensed at the receiver
IMG_20150424_212410IMG_20150424_212955

– DATA pin sensed at sender. I’ll never sense this pin anymore at this experiment. At all the antenna constellations I sent the same data and the signal is always clear and strong as it is sensed before modulation and distortion in radio.
IMG_20150424_212745 IMG_20150424_212810

– this how noise looks at the receiver side when data pin is forgotten to be cleared to 0 at the sending side
IMG_20150425_063859 IMG_20150425_064123 IMG_20150425_064127

– this time antenna at the receiving side was expanded to 72sm of coiled wire forming 7sm antenna; transmitter still having an antenna of 21sm of straight wire

the noise:
IMG_20150425_073318

the data:
IMG_20150425_073609

the antenna at the receiver:
IMG_20150425_074447

 

–  this time sending side has no antenna, while receiving has 7sm of coiled wire
IMG_20150425_075415 IMG_20150425_080332 IMG_20150425_080357

– here the receiver has no antenna while sender’s antenna is 21sm of straight wire
the noise at the receiver:
IMG_20150425_074500

the data at the resiver:
IMG_20150425_074615

the antenna at the sender:
IMG_20150425_075330

– now how it looks without antennas at all. Data signal at both pictures looks much more distorted and having lower amplitude. In both the case the data packed was not received at the end, while it was received with configurations having some antenna at least at one side
IMG_20150425_080506 IMG_20150425_080523 IMG_20150425_080726

 

Related Links:

–  How to control power outlets using RPi/Wireless power outlets

Wireless RF links and noise reduction tutorial

pigpio Python module

GPIO virtual wire

Adding 433 to your RPi

 

]]>
Camera prototype improvements http://pagealh.com/2014/12/27/camera-prototype-improvments/ http://pagealh.com/2014/12/27/camera-prototype-improvments/#comments Sat, 27 Dec 2014 21:06:35 +0000 http://pagealh.com/?p=289 Continue reading

]]>
Reviewed by Editor: Jack Allison

Today day was mostly filled by soldering among other activities such as traveling with family etc. 🙂

Improvements:
– Raspberry Pi model A+ (instead of model B) which is smaller, consumes less power, has one USB instead of two, and a micro-SD slot instead of a regular SD-card slot.
– New (smaller, lighter) voltage converter: 220-12V
– Converter 12 V -> 5V x 2 (3 A): 5V – for RPi power, 5V – for cellular dongle spare power (further extension). This reduces two external converters 220V->5V and 220V->12V (for the array of IR LEDs) to a single external converter 220V -> 12V (one power cable to camera). Of course there is 12V->5 converter instead but it is located internally within the case (in my eyes, more elegant solution).
– Large plastic bread-board is replaced with smaller prototyping board and soldered down parts.
– All connectors now  detachable, allowing better maintenance. This required making custom length wires and attaching  appropriate connectors.

Related experiments: 

Achievements:

– Overall smaller size of internal components.
– Improved Maintainability .
– Having several RPi board allows me to keep several prototypes working simultaneously without a need to detach a board from a prototype for side experiments.
– Auto-initialization (on power-up) of camera’s WiFi-interface enabled today. This allows work on Camera SW with closed case.

A few pictures from today:

– The following four pictures show how the larger bread board is replaced with a smaller prototyping board and soldered down parts. This freed more space within the case. Also the connectors visible from the side allow easy detaching  when necessary.

20141227_083801 20141227_08374620141227_083642 20141227_083618

– The picture below shows the smaller RPi A+ board which allows more optimal usage of the space within the case and pushing the 12V->5V converter inside. Also we see spare USB female-connector going from the converter – preparation for plugging of cellular dongle’s spare-power side of Y-cable. Together with USB splitter (that is to buy yet) this will allow cellular model (with backup power) connected in parallel to Wi-Fi.

20141227_214045

– The next picture shows components almost ready to be put in the case. After adding additional wires for the IR array, and more wires were prepared, the components were put into the case. Already here this may be seen that from the two power adapters 220V-12V and 220V-5V only 12V remained.

20141227_085338

– This photo shows the wire preparation process from components bought separately: wire, metal and plastic part of the connector.

20141227_162914

– The following pictures show how accurate the camera looks with only one brand-new 220V-120V smaller adapter and consequently only one power cord running to the camera. RPi’s logo on the first picture means that the camera is powered up. Subsequently, I have tested the streaming SW and all functionality appeared to be working as before today’s changes in HW.

20141227_22071720141227_220645

]]>
http://pagealh.com/2014/12/27/camera-prototype-improvments/feed/ 5
Raspberry Pi Experiment 01: PiCam Video Streaming via WiFi http://pagealh.com/2014/10/30/raspberry-pi-experiment-01-picam-video-streaming-via-wifi/ http://pagealh.com/2014/10/30/raspberry-pi-experiment-01-picam-video-streaming-via-wifi/#comments Thu, 30 Oct 2014 17:00:00 +0000 http://pagealh.com/?p=17 Continue reading

]]>
Video [No Voice]

 

Experiment Goal:

To enable the following features:
– capturing of live video by means of Raspberry Pi Camera module
– streaming of the captured video to custom PC Client

Constellation:

1) RPi PI running Raspbian
2) Server side is running on PI (Python script) waiting for 1 client to connect (TCP)
3) Video streams to connected client (Linux/Windows) in mjpeg (configurable # of frames)
4) C# client application using VLC WPF-control to display the video inside the application window. Start stop streaming commands are send to RPi trough TCP-IP

Components:

– Board: Raspberry Pi model B or higher (RPi-Model-B ebay/RPi2-Model-B ebay)
– OS SD-card: NUBS (preinstalled/self-made after download)
– Camera: Raspberry Pi Camera module  (ebay) or PiNoIr Camera module (ebay)
– Wi-Fi:  EdiMax EW-7811Un (ebay) dongle

Constellation: 
exp1_wifi_01


Useful Links:

]]>
http://pagealh.com/2014/10/30/raspberry-pi-experiment-01-picam-video-streaming-via-wifi/feed/ 2
RASPBERRY PI: Getting Started with Cellular modem http://pagealh.com/2014/10/29/getting-started-with-cellular-modem/ http://pagealh.com/2014/10/29/getting-started-with-cellular-modem/#comments Wed, 29 Oct 2014 14:39:26 +0000 http://pagealh.com/?p=206 Continue reading

]]>
Reviewed by Editor: Jack Allison

I’m using the ZTE MF190 modem (ebay), but the instructions are valid also for many other tested cellular dongles. I would propose to use the tested ones at your initial experiments, as the problems you may run into (extreme power consumption, stability, heat pollution, support-ability and connectivity issues etc.) may be unpredictable and are on your own risk.
ZTE MF190 led-indicator legend:
– Red – turned On, but not registered to no cellular network
– Green – registered to GSM, GPRS, EDGE, UMTS, HSDPA,
– Green Twinkling – connected to GSM, GPRS, EDGE, UMTS, HSDPA

Note: Although you will see three additional logical USB devices after plugging the dongle into a USB slot, ONLY the third logical USB device is useful for data communication (ttyUSB2 in case of  ttyUSB0/1/2), when we talking about referencing this modem in your scripts. This is relevant only to the ZTE MF190 only. For other modems this may be different.

Electrical Setup

You will likely be able to proceed with the steps below without this additional recommendation. However, you  may run into a stability issues with your cellular data channel unless you find some way to provide additional spare power to your USB-dongle.

The way I would propose is a minimalistic one – usage of USB Y-cable with 2 male a 1 female connectors. At the picture below you can see a single-cable solution.

This one USB Y-cable carries out dual function:
– powering your RPi board
– giving that additional power to your cellular dongle that it needs sometimes and that RPi’s pretty WEAK power regulator cannot provide.

That is apparent, that in case of such a solution, at least one 220V to 5V power-adapter is needed with an option to plug at least 1 USB device into it. The adapters with ability to provide 2A of current are preferable.

Note: Be attentive to connect that USB Y-cable correctly. There is one male connector at the thick end of the cable. This end is for data and power transmission and is to be connected to RPi’s USB slot. Data comes from the female connector’s side of the cable where the cellular dongle should be connected. The remaining male connector at the thin end of the cable is designed to transmit power ONLY and if you connect this one into the 220Vto 5V power converter everything starts to power-up and should work in stable manner from electrical point of view.

UsbYCable220V_5V_USB

exp2_cell_01

Step-By-Step

    1. Plug the cellular dongle into RPi’s USB slot
    2. Install relevant Python packages
      sudo apt-get -y install ppp eject wvdial usb-modeswitch
    3. Use auto-detection command for the case the modem was not detected. This command creates default /etc/wvdial.con wvdialconf
    4. Edit/Create /etc/wvdial.conf according to your SIM-card’s Access Point Name (APN). See the example for ZTE MF190. This example is achieved by editing of default version of wvdial.conf created at the earler steps:

[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Modem Type = Analog Modem
; Phone = <Target Phone Number>
ISDN = 0
; Password = <Your Password>
; Username = <Your Login Name>
Modem = /dev/ttyUSB1
Baud = 9600

[Dialer check]
Phone = *99#
Init3= AT+CPIN=?
Init4= AT+CPIN?
Init5= AT+CFUN=?
Init6= AT+CFUN?

[Dialer youphone]
Init1 = ATH
Init2 = ATE1
Init3 = AT+CGDCONT=1,”IP”,”data.youphone.co.il”
Modem = /dev/ttyUSB2
Modem Type = Analog Modem
Baud = 9600
;Carrier Check = no
ISDN = 0
Dial Command = ATD
Phone = *99#
APN = data.youphone.co.il
Username = youphone3G
Password = ” “
Stupid mode = yes
New PPPD = yes
;AutoDNS = yes
Auto Reconnect = on

      • use sudo to put this configuration to the /etc
        sudo cp /<your_folder>/wvdial.conf /etc/wvdial.conf
      • Allow access to pppd directories

sudo chown root:dip /usr/sbin/pppd
sudo chmod 7777 /usr/sbin/pppd
sudo chmod 777 /etc/ppp/pap-secrets
sudo chmod 777 /etc/ppp/chap-secrets
sudo chmod 777 /etc/ppp/peers

      • To dial, use sudo wvdial <Dialer_name>, where  <Dialer_name> is form /etc/wvdial.conf. For example:

sudo wvdial youphone

  • If you want to initialize your cellular modem during the RPi boot use the same command ending by ‘&’ at ~/.bashrc. This will run the command in background. The command ‘wvdial’ is blocking command – it doesn’t allow the shell to continue to other command, no matter what the execution result is. While this is fine when you are working at the terminal window and you want to see the log messages at the terminal’s window, this becomes a problem for an auto-start shell-script. The usage example:

sudo wvdial youphone &

Related References

]]>
http://pagealh.com/2014/10/29/getting-started-with-cellular-modem/feed/ 2
Raspberry Pi: Getting started with Wi-Fi http://pagealh.com/2014/10/28/getting-started-with-wi-fi/ Tue, 28 Oct 2014 14:34:06 +0000 http://pagealh.com/?p=202 Continue reading

]]>
Reviewed by Editor: Jack Allison

To have you RPi connected through Wireless LAN (Wi-Fi) you will need an appropriate USB-dongle.

I used EdiMax EW-7811Un (ebay). Although it has lower data-rate specification (150 Mb), there are some advantages: – small form-factor (size): good for small products/prototypes – fully supported (in plug-and-play fashion) by Raspbian – widely available at local stores in Israel for affordable price

Step-by-step (first usage)

To make your RPi connected to your home Wi-Fi Router do the following steps: – Plug the Wi-Fi dongle into RPi (powered-on or switched off) – If necessary, power-on your RPi – Use RPi’s WiFiConfig utility (on your desktop) to configure the WLAN settings: network name and password of your home Wi-Fi router. For that do the following 2 steps:

1) scan for available WLAN networks

2) chose your home network and enter the password

Auto-initialization (on power-up) of WiFi-interface.

Among the rest of connectivity benefits, Wi-Fi allows working on the RPi SW while the board is closed in a case. Instead being connected to RPi with a monitor trough HDMI cable, you can see RPi desktop remotely using VNC, TightVNC or Microsoft Remote Desktop utilities. In order to do this, you need the Wi-Fi dongle  initialized and to have valid IP address automatically assigned immediately after the RPi boot. The following steps describe how to achieve this goal: – Once you configured your RPi’s Wi-Fi interface to connect to your network (as described above), the connection details are saved and preserved at /etc/wpa_supplicant/wpa_supplicant.conf – To have the Wi-Fi initialization happen at the RPi’s boot add the following command to etc/rc.local :

sudo ifup wlan0

or

sudo ip link set wlan0 up

We are done with Wi-Fi and can start to enjoy our Wireless RPi  🙂

Static IP

It may be necessary to create a static IP address for RPi so that the router, via DHCP, does not assign different IP addresses which can cause problems when accessing RPi from the internet.  To create a static IP address for RPi, two files ned to be edited as follows:

1. /etc/network/interfaces

Add the rows as below replacing with your LAN addresses and netmask

The first parameter after iface command is interface name that you will use later so chose something meaningful

iface weather_station inet static
 address 192.168.0.120
 netmask 255.255.255.0
 gateway 192.168.0.1

2. /etc/wpa_supplicant/wpa_supplicant.conf

Add id_str variable that will link your wi-fi dongle to the static IP defined earlier

network={
 ssid="<name of your WLAN>"
 psk="<your WLAN password key>"
 proto=RSN
 key_mgmt=WPA-PSK
 pairwise=CCMP
 auth_alg=OPEN
   id_str="weather_station"
 }

Power Management

By default power saving feature may be On for Wi-Fi adapters. So that they go to sleep when aren’t used for a long time. As a result it takes a time (if possible at all) to awake this interface by ping command.

You may check if this feature is enabled by using a command:

iwconfig

If it is enabled and this is annoying and you would like immediate connectivity, you can disable this feature by adding of the  following line to the /etc/network/interfaces file

wireless-power off

After power reset use iwconfig command again to check if the new setting helped

Additional useful commands

sudo iwlist scanning
sudo allow-hotplug wlan0 eth0
sudo ifdown wlan0
sudo ifup --force wlan0 (note that DOUBLE-minus should appear before the 'force' parameter: at some web-browsers this example may show only one minus)

ipaddress reading

ifconfig

or

ip addr

Related References

]]>