Newbie stuck with robotics - Pibrella, Adafruit VCNL4000 Proximity sensor and Nokia 5110 screen

Hello! I’m rather new to robotics, and am trying to make a robot using the Raspberry Pi (model b).
I’ve had a few problems though, mainly with using the Nokia screen (I have tried installing various different things, but none of them seem to be working) and am also having problems wiring the sensor to the correct GPIO pins, and would love some advice on how to code with both in Python if possible please. I am currently also using a Pibrella, which seems to be working, although I’m switching them around each time (although I plan to use a Piborg/Triborg board to link them eventually) It’d be great if there was a way around this!
Thank you.

For the Nokia 5110, this should be the canonical guide: https://learn.adafruit.com/nokia-5110-3310-lcd-python-library/overview

I used one ages and ages ago, but that was probably with Ruby and not Python! I’ll try digging it up so I know what I’m talking about.

As for the Sensor, its an i2c device and should be connected to GPIO 2 and GPIO 3 shown here: http://pi.gadgetoid.com/pinout/i2c

You should connect Vin to a 3.3v pin on the Pi, and GND to a ground pin.

Once set up, you can verify that it’s available with i2cdetect like so:

sudo i2cdetect -y 1

It should show up as 0x13.

There’s Python code for driving this sensor in Adafruit’s python code library:

https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code/blob/master/Adafruit_VCNL4000/Adafruit_VCNL4000.py

To get this on your Pi you should probably clone the whole repo:

git clone https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code

@gadgetoid Thank you very much!
I’ve had a go with the guide for the screen, but with the wiring, it says to connect from one pin to “CS”. On the screen, there’s “CLK” (which is connected to a different pin) or the two remaining empty ones, CE or BL, which I am not sure which to connect to.
An error comes up when I run the test code, or the shapes.py, as it says that it cannot install “mock from Mock”, or an IO error message; but its got a lot further than I did before!
Thanks again - I’ll try the sensor code out now

CS stands for “Chip Select” which is how you tell the display that the SPI bus is currently talking to it- the closest acronym to that is CE, which usually stands for “Chip Enable” and has exactly the same effect. So assume your CE pin is the CS pin mentioned in the guide.

As for BL, I’m going to guess that’s the Back Light!

I’m not sure about the mock stuff! I’ll have to look into it, have you tried:

sudo pip install mock

Thank you very much - I’ve wired it up to CE, and the BL to another 3.3v pin, and the backlight is now lit!
I’ve attempted sudo pip install mock/Mock and sudo apt-get install mock/Mock, although “Unable to locate package” or “No distributions at all found”.
In the code, I’ve managed to get Shapes.py to work up to the part where “disp” is defined, when I get “IOError: [Errno 2] No such file or directory” as a response.

Ah, your i2c may not be enabled, give this a try:

curl get.pimoroni.com/i2c | bash

And then look for an i2c device like so:

ls /dev/i2c*

Thank you. It comes up with "curl: (6) couldn’t resolve host ‘get.pimoroni.com’ ".
I’ve also tried editing the blacklist file to enable both, and have rebooted, but I’m not sure whether I had done it properly…

Ah, no network connection on your Pi? Host should resolve!

Try using raspi-config to enable it, and also:

sudo modprobe i2c-dev

Thank you very much! They both seem to be working!
The parts now work individually, and I was just wondering if it would be possible to have some more help please?
I would quite like to be able to use both at once, and have tried writing code, and saving it in leafpad to run in LX terminal, but the pibrella immediately exits? Is there any way to avoid this please, and to use all three at once?
Thank you.