Difference between revisions of "Blog 03"

From BitWizard Wiki
Jump to navigation Jump to search
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
Hello,
Hello,


I wanted to make it possible to show the temperature + time on a Raspberry Display. Before that I am going to try other little things so that I can get some experience. What I am now going to make possible is that text that I write in the shell as code will be printed on screen.
I wanted to make it possible to show the temperature + time on a Raspberry Display. Before that I am going to try other little things so that I can get some experience. What I am now going to make possible is that text that I write in the shell as code will be printed on display.


( So that I know how to print text on the display )
( So that I know how to print text on the display )
Line 8: Line 8:
git clone https://github.com/rewolff/bw_rpi_tools.git
git clone https://github.com/rewolff/bw_rpi_tools.git


(after reboot)
After a reboot add i2c in the group
reboot
Add it in the i2c the group

For adding user pi to group i2c:
sudo gpasswd -a pi i2c
sudo gpasswd -a pi i2c
For adding user pi to group i2c


To look if it is added:
To look if it is added:
groups
groups


Which will give as result
At my it gave the result:
pi adm dialout cdrom sudo audio video plugdev games users netdev gpio i2c spi input
pi adm dialout cdrom sudo audio video plugdev games users netdev gpio i2c spi input
(Your list can of course be bigger or smaller. If it atleast has the i2c everything is fine)
(Your list can of course be bigger or smaller. If it at least has the i2c everything is fine)


sudo -s
sudo -s
This code is for getting in the root, so that I don't have to type: sudo anymore.
This code is for getting in the root, so that I don't have to type: sudo any more.

This is handy because many commands need sudo.


This is a handy command because many commands need sudo.


apt-get install i2c-tools
apt-get install i2c-tools
Line 42: Line 42:
When you then reboot the raspberry he will directly use the code.
When you then reboot the raspberry he will directly use the code.
With the code he then knows he I connected to the i2c display.
With the code he then knows he I connected to the i2c display.
(To reboot you just have to type: reboot)
(To reboot you just have to type: reboot as I said before)


To finally look when rebooted if he actually can see him:
To finally look when rebooted if he actually can see him:
Line 48: Line 48:
i2cdetect
i2cdetect


[[File:I2cdetecty.jpg|500px|thumb|left|]]
[[File:I2cdetecty.jpg|500px|thumb|none|]]


To check if it works. I will look if it show the location of the i2c.















To check if it works:
It will show the location of the i2c.
modprobe i2c-dev
modprobe i2c-dev
i2cdetect -y 1
i2cdetect -y 1



Which should give as result:
Which should give as result:
[[File:I2cdetect.jpg|500px|thumb|left|]]
[[File:I2cdetect.jpg|500px|thumb|none|]]
























reboot if it doesn't appear this can happen if you didn't activate the right code.
reboot if it doesn't appear this can happen if you didn't activate the right code.
If that doesn't help go to:*
If that doesn't help go to: "Change A: X to A: 94"




Line 119: Line 80:


To remove all the printed text from the screen use the code:
To remove all the printed text from the screen use the code:
# bw_tool -I -D /dev/i2c-1 -a 94 -w 10:0
bw_tool -I -D /dev/i2c-1 -a 94 -w 10:0


(for other commands go to the the wiki from the [http://www.bitwizard.nl/wiki/index.php/User_Interface user interface]:
(for other commands go to the the wiki from the [http://www.bitwizard.nl/wiki/index.php/User_Interface user interface]:
Line 141: Line 102:
Later I want to get with these the possibility to get a temperature visible.
Later I want to get with these the possibility to get a temperature visible.



* also experienced that this all eventually didn't work on my display the raspberry was saying:
== Change A: X to A: 94 ==


I once experienced that rebooting didn't help for me getting to see A: 94. On my Display was the text visible:
I2C_rpi_ui 1.6
I2C_rpi_ui 1.6
A: 94
A: 1




[[File:94.png|300px|thumb|none|]]
[[File:94.png|300px|thumb|none|]]


As you can see on the image
On the image you can see how it normally has to look like.


But if you don't have that and have that the raspberry is saying something like;
A: 1


you have to change this or always write to
If you have A:1 you have to write:
-a 1
a -1 to say Hello, Dave.
instead of:
-a 94


Example:
Example:
bw_tool -I -D /dev/i2c-1 -a 1 -t "Hello, Dave."
bw_tool -I -D /dev/i2c-1 -a 1 -t "Hello, Dave."


with i2cdetect you will also get this:
When you do i2cdetect as above you will get the same result but than without the 4a visible:
modprobe i2c-dev
sudo modprobe i2c-dev
i2cdetect -y 1
sudo i2cdetect -y 1


but then without the 4a displayed on your screen.
but then without the 4a displayed on your screen.


But you can change the problem with these commands:
You can change A: 1 to A: 94 with these commands:
bw_tool -I -D /dev/i2c-1 -a 0 -w f1:55 F2:aa f0:94
bw_tool -I -D /dev/i2c-1 -a 0 -w f1:55 F2:aa f0:94

and to remove and connect the display again.
After this command: remove and connect the display.


bw_tool -I -D /dev/i2c-1 -a 94 -W 14:0
bw_tool -I -D /dev/i2c-1 -a 94 -W 14:0
to restart the display
The above command is to reconnect the display.

Now it is fixed we can explore the things we can do with the Raspberry interface!

Note:
At I2c the values are in hexadecimals and get divided by two. That explains why 94 is 4a in i2cdetect.
If you want to change an address with an hexadecimal letter you can use capital and lower case letters.


Now we can explore the things we can do with the Raspberry interface.
Go to [[Blog 04]], where I will make it possible to use the Raspberry interface as clock.

Latest revision as of 14:36, 30 November 2015

Hello,

I wanted to make it possible to show the temperature + time on a Raspberry Display. Before that I am going to try other little things so that I can get some experience. What I am now going to make possible is that text that I write in the shell as code will be printed on display.

( So that I know how to print text on the display )

For getting it to work I first had to get the latest BitWizard tool.

git clone https://github.com/rewolff/bw_rpi_tools.git 

After a reboot add i2c in the group

reboot

For adding user pi to group i2c:

sudo gpasswd -a pi i2c 

To look if it is added:

groups 

At my it gave the result:

pi adm dialout cdrom sudo audio video plugdev games users netdev gpio i2c spi input 

(Your list can of course be bigger or smaller. If it at least has the i2c everything is fine)

sudo -s 

This code is for getting in the root, so that I don't have to type: sudo any more.

This is a handy command because many commands need sudo.

apt-get install i2c-tools 

To install the i2c-tools you downloaded.

To make the raspberry in boot modes:

cd /boot 
/boot/config.txt 
nano config.txt 

In the config.txt you have to remove the # from:

#dtparam=i2c_arm=on 

( you have to scroll down to find it )

When you then reboot the raspberry he will directly use the code. With the code he then knows he I connected to the i2c display. (To reboot you just have to type: reboot as I said before)

To finally look when rebooted if he actually can see him:

sudo -s 
i2cdetect 
I2cdetecty.jpg

To check if it works. I will look if it show the location of the i2c.

modprobe i2c-dev 
i2cdetect -y 1 

Which should give as result:

I2cdetect.jpg

reboot if it doesn't appear this can happen if you didn't activate the right code. If that doesn't help go to: "Change A: X to A: 94"


cd bw_rpi_tools/ 
cd bw_tool/ 
make 
make install 
cp bw_tool /usr/bin 

These steps are for to install the bw_tool


( If you have a Raspberry pi 1, you have to replace /dev/i2c-1 with /dev/i2c-0 ) To write the text:

bw_tool -I -D /dev/i2c-1 -a 94 -t 'Hello' 
bw_tool -I -D /dev/i2c-1 -a 94 -t ' Dave' 


HelloDave.png


To remove all the printed text from the screen use the code:

bw_tool -I -D /dev/i2c-1 -a 94 -w 10:0 

(for other commands go to the the wiki from the user interface:

Read example: In write ports: If you have 0x13 – set backlight ( b has to be after the code to say that it is in byte )

you should type:

bw_tool -I -D /dev/i2c-1 -a 94 -w 13:90

To give a high backlight

bw_tool -I -D /dev/i2c-1 -a 94 -w 13:10 

To get a really low backlight.


HelloDaveDark.png

So now I have printed my first text on the raspberry display. Later I want to get with these the possibility to get a temperature visible.


Change A: X to A: 94

I once experienced that rebooting didn't help for me getting to see A: 94. On my Display was the text visible: I2C_rpi_ui 1.6 A: 1


94.png

On the image you can see how it normally has to look like.


If you have A:1 you have to write:

-a 1 

instead of:

-a 94

Example:

bw_tool -I -D /dev/i2c-1 -a 1 -t "Hello, Dave."

When you do i2cdetect as above you will get the same result but than without the 4a visible:

sudo modprobe i2c-dev 
sudo i2cdetect -y 1 

but then without the 4a displayed on your screen.

You can change A: 1 to A: 94 with these commands:

bw_tool -I -D /dev/i2c-1 -a 0 -w f1:55 F2:aa f0:94 

After this command: remove and connect the display.

bw_tool -I -D /dev/i2c-1 -a 94 -W 14:0

The above command is to reconnect the display.

Now it is fixed we can explore the things we can do with the Raspberry interface!

Note: At I2c the values are in hexadecimals and get divided by two. That explains why 94 is 4a in i2cdetect. If you want to change an address with an hexadecimal letter you can use capital and lower case letters.

Go to Blog 04, where I will make it possible to use the Raspberry interface as clock.