Category Archives: Solution Center

Enable I2C on rPi

1-
sudo nano /etc/modules

2-
To the bottom
snd-bcm2835
i2c-bcm2708
i2c-dev

3-
If so check blacklist file. It depends on your board type
sudo nano /etc/modprobe.d/raspi-blacklist.conf

Comment out following lines as follows;
#blacklist spi-bcm2708
#blacklist i2c-bcm2708

4-
sudo apt-get install python-smbus
sudo apt-get install i2c-tools

5-
sudo nano /boot/config.txt
Add these line at the bottom of the file
dtparam=i2c1=on
dtparam=i2c_arm=on

sudo raspi-config

->Advanced options->enable i2c

6-
Do not forget to reboot
sudo reboot

7-
Check whether it works or not
sudo i2cdetect -y 0 (for a Revision 1 board like mine)
or
sudo i2cdetect -y 1 (for a Revision 2 board)

8-
then you should see output showing any I2C devices that are attached and their addresses

0 1 2 3 4 5 6 7 8 9 a b c d e f
00: — — — — — — — — — — — — —
10: — — — — — — — — — — — — — — — —
20: — — — — — — — — — — — — — — — —
30: — — — — — — — — — — — — — — — —
40: — — — — — — — — — — — — — — — —
50: — — — — — — — — — — — — — — — —
60: — — — — — — — — 68 — — — — — — —
70: — — — — — — — —

Install Samba Server on Raspberry Pi to access over network

1-
sudo apt-get install samba samba-common-bin

2-
The directory that we will share out will act as a mount point for external storage. So we will need to create the directory and set appropriate permissions to the directory. Using mkdir(/bin/mkdir) we can both create the directory and set the permissions in the one command. The -m option will allow you to set the mode or permissions of the directory.

sudo mkdir -m 1777 /data

From the above command we can see the easy part, creating the directory /data. As it is at the root of the file-system we will need administrative permissions to do this so we run it prefaced with the sudo command. The mode of the directory is set with the -m option:

1: sets the sticky bit. This set on a directory ensures that users can only delete files they own.
7: sets RWX read , write and execute for the user owner
7: sets RWX read , write and execute for the group owner
7: sets RWX read , write and execute for others
This directory will be empty at the moment and, of course, the root file-system is limited in size on the Pi to that available from the SD cards. We can use an external drive connected to the USB ports and have this mounted to the /data directory. This then can provide effective storage for your network

3-
Backup conf file and edit as following;
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.old
sudo rm /etc/samba/smb.conf
sudo nano /etc/samba/smb.conf

Add the following lines;
[global]
workgroup = HOME
netbios name = KINETIC
server string = Kinetic Server %v
map to guest = Bad User
log file = /var/log/samba/log.%m
max log size = 50
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
preferred master = No
local master = No
dns proxy = No
security = User

wins support = yes

[Data]
comment= Pi Home
path=/home/pi
browseable=Yes
writeable=Yes
only guest=no
create mask=0777
directory mask=0777
public=yes

4-
Restart Samba Server
sudo service smbd restart
sudo service nmbd restart

5-
Create users
The last part of this tutorial will involve us creating samba users. These users must represent Linux users but their password can and should be different to the Linux password for security. This is not enforced though. Using the command smbpasswd(/usr/bin/smbpasswd) as the root user we can add new samba users. A user must have a password in samba to access shares.

sudo smbpasswd -a root
sudo smbpasswd -a pi

6-
Restart Samba Server
sudo service smbd restart
sudo service nmbd restart

Access Raspberry Pi over your network

RaspberryPi_Logo1- Plug Raspberry Pi to HDMI, keyboard, network cable (cat5) SD card with the OS

2- connect PU 5 volt 2.1 amp

3- Select Rasbian OS to install

4- Wait for the installation to finish

5- If everything is ok, you should see a screen as follows

16- Now, you can plug off your HDMI cable.

7- Open Terminal in your Mac OS X.

8- Find the ip of your Raspberry Pi from your router’s GUI (Type : 192.168.x.x – whatever yours…Login and find a menu named LAN. Right there, you should see the local ip address of your Raspberry Pi – e.g. Mine is 192.168.2.34)

9- In terminal window type as follows to connect your Raspberry Pi with SSH over network:
ssh pi@192.168.2.34

Screen Shot 2015-01-25 at 21.55.56

pi is the default username and raspberry is the default password of your Raspberry Pi. Hit the Return and enter the password.

You should see something like this:

Screen Shot 2015-01-25 at 21.56.09

10- Now, type sudo raspi-config sudo is for administrator
authorization.
1

Move the cursor to the Advanced Options hit Return. Then move cursor to SSH hit Return. Enable it.
SSH
Screen goes black and the it says “SSH enabled”. Hit OK.

11- If you mind to use your Raspberry Pi as a NAS only, you don’t need much GPU power. So, it’s better to make it lower. Goto Advanced Options->Memory Split. Type the lowest value which is 16 and OK.
GPU

12- Few commands to use with your Raspberry Pi over network;
sudo halt – to shutdown
sudo reboot – to restart

How to connect Arduino + 74HC595 + LCD 16×2

I put necessary files at the bottom o f the post.

There are different kinds of 16×2 LCDs on the market. So, the placement of the pins can be varied. There are some tutorials on the web which are showing how to connect Arduino+LCD+74HC595, however I couldn’t make any of them work. Because, my LCD’s pins placements are not same as the tutorials that I found.

I put a note in the Fritzing file. It shows the order of the pins. So, you can make the correct connections using the diagram.

Another issue is the Arduino’s LiquidDisplayLibrary. You need to update it in order to use the LCD library. You need to update or replace it from Aduino library.

Here is the steps how to connect Arduino + 74HC595 + LCD 16×2 together with only 3 pins on Arduino board;

1- Make your connections according to Fritzing file as follows. Click to download
Screen Shot 2014-09-28 at 6.43.16 PM2 – Download the LCD library. And place it into Arduino

– Download and unzip the new LiquidDisplay folder.

– Open Applications folder in Finder

– Right click onto Arduino and select Show package Content. Then goto Contents>Resources>Java>libraries

– Copy/replace the downloaded folder into that folder.

– Close Arduino App.

3- Download the example code. And upload to your Arduino.

 

 

 

 

How to install packages/extensions/plugins for Sublime Text 2?

Sublime_Text_Logo

Formerly, I was using Coda. It was a nice editor for me. But, I left working with Coda after the last updates. I couldn’t be comfortable with the new UI design. So, I started searching a new editor and came across with Sublime Text 2. I think, it is one of the best code editors that I’ve ever used in terms of app launching speed, smart UI design (actually it’s so minimal, the magic is the key bindings) and opens with your last projects and etc…

I have been working with Sublime Text 2 for two years nearly. After some time, I need to enhance it to save much more time while I’m coding. There will be another post about extension / plugins which I use with Sublime Text 2 in the future by the way…

Anyways, I mean if you’re looking for a new code editor, suggest you to check Sublime Text. It supports every language, scripts that I know.

Installing extensions is an easy process actually. But sometimes it can be hard to find pure and correct information about the context you are searching for. And I don’t understand why So here is the steps for Mac OS X;

1- Download the package/plugin/extension (whatever you say)

2- Unzip it as usual

3- Open Sublime Text 2 and navigate to Sublime Text 2 >Preferences > Browse Packages…

Screen Shot 2013-08-13 at 12.55.00 AM

 

 

 

 

 

 

 

 

4- Copy the extracted folder into Packages folder and restart Sublime Text 2. That’s it.

Screen Shot 2013-08-13 at 12.56.58 AM

 

 

 

 

 

 

 

 

5- To change settings or define new key bindings goto Sublime Text 2 >Preferences > Page Settings > Downloaded_Package_Folder_Name

Screen Shot 2013-08-13 at 1.04.33 AMIf you want to change setting or key bindings DO NOT edit the default files! There are extra user files for your customizations. By doing this you can avoid yo loose your settings after updates…

openframeworks – Xcode 4 on os x lion

I’m sure there lots of programmers around who don’t know about anything c++, xcode and openframeworks technologies…So, sometimes we loose tons of time in order to get over very small issues like defining folder paths, potting files into correct place, or doing some operations in correct sequence, etc… And the funny part is, most of the time you can’t find any sources on the web in such situations. Don’t know why. May be it’s just related with me 🙂

First of all I need to tell my exact system running on my computer, so you check everything and be sure what’s going wrong..

1- donwload the 007 version release of openframeworks

2- my OS is OS X LION

3- Xcode 4

Installing Xcode4 is the most easy part as you expect… There is nothing tricky parts. After installation, place the “of_preRelease_v007_osx” folder anywhere in your hard drive. Xcode 4 is different then previous Xcode versions in terms of GUI. Don’t know it’s good or bad, but after some days I get used to new GUI. I think, it’s really comfortable to manage things easly…

Anyways, to copile and openframeworks examples;

1- Navigate to of_preRelease_v007_osx-> apps -> examples

2- Select one of the example project that you desire and double click to *.xcodeproj file

3- Here is the tricky part 🙂  “of_preRelease_v007_osx”  was released before Xcode4 so it doesn’t know anything about the osx 10.7 SDK. Firstly, you need to change BASE SDK for the project. To do that click onto project file and set BASE SDK to MAC OS X 10.6 as follows;

 

 

 

 

 

 

 

 

 

 

 

 

 

4- Hit the Run button to compile and debug the project

In the next tip I’ll explain how to create a new project from scratch..and add addons folders libraries to the header files…

Font Embed Bug on Flash Builder 4.5

Embedding fonts in Flash Builder is so easy as follows. However, in some cases that I have no idea, Flash Builder changes the fonts in your application. To fix that, just goto topbar Project->Clean…Then Flash Builder refreshes your project and everything is gonna be fine 🙂 This is just a reminder for myself. I’m sure, I’ll forget the fix for this issue when I exprience it again.

[Embed(source="com/alptugan/assets/font/HelveticaNeueLTPro-Roman.otf", embedAsCFF="false", fontName="roman", mimeType="application/x-font")]
public var Roman:Class;

[Embed(source="com/alptugan/assets/font/HelveticaNeueLTPro-Bd.otf", embedAsCFF="false", fontName="helvetica-bold", mimeType="application/x-font")]
public var Bold:Class;

[Embed(source="com/alptugan/assets/font/HelveticaNeueLTPro-ThCn.otf", embedAsCFF="false", fontName="helvetica-thin", mimeType="application/x-font")]
public var Thin:Class;