Nokia 3310/5110 3.3V Display with 5V Arduino

For my sous-vide arduino project I also needed a nice display, and I stumbled upon a 5110/3310 Nokia display which are sold for under 5€ (here). Since its based on a PCD8544, there are many libraries for arduino, so I gave it a try.

Wiring

After reading the first tutorial, I realized, that the 3110 uses 3.3V input, while the arduino has 5V output.There are several solution to this:

  • Logic Converter: One possibility is to use used a logic level converter like this to reduce the signals from 5 to 3.3V. Since I didn’t have one of those, and wanted to get started right away, I tried the second approach:
  • Grow some balls: Some people claim, that the maximum input voltage the 3110 can take is 5V, so it should be ok, to run it directly with the arduino, but it supposedly reduces the lifetime of the display. I gave it a shot following this tutorial. (They used 1-10kOhm to limit the current through the display). It worked out of the box, and I played around a bit with my display. On the long term, I didn’t feel good with the 5V though, so I kept looking for other solutions.
  • Voltage Dividers: I found a post, where someone used a voltage devider with 100 and 150 Ohm, to drive the display. That’s what I’m using now, and since I didn’t find a good tutorial for it online, I wrote this post:

Since the 100/150 Ohm resistors would draw a lot of power, I decided to go for higher ones, and chose 3.6kOhm and 2.2kOhm (mainly because I had a huge bunch of those on the table, maybe higher resistance are even better). Since my 3110 already had pins to put it onto a bread board, my setup looks a bit different:

nokia3310

Since there are some other things wired into my bread board, the actual image is a bit more crowded:

Nokia 3310 on breadboard

Nokia 3310 on breadboard

As you can see, the display works fine, but I wasn’t brave enough to connect the backlight LEDs until now. Currently I’m working on other parts of the project, but once those are finished, I might give the backlight a try.

Code

To get it working, I used the adafruit library but there are plenty of others available as well. You just have to be careful, the naming and ordering of the pins varies with different display versions, so for my version of the display, I had to initialize like this:

Adafruit_PCD8544 display = Adafruit_PCD8544(3,4,5,7,6);

The adafruit library is quite comfortable to use, but requires you to display a splash screen, so maybe a freer library would be nice in the long term.

Please let me know, if you have any comments or found the post useful 🙂

Advertisements
Posted in Arduino | Tagged , , , | Leave a comment

Arduino PID Frontend Library

For my current project – an Arduino Sous-vide cooker – I needed a PID-Controller for Arduino.  Brett Beauregard wrote two really nice libraries that are really helpful for this task:

PID Library

PID Front-End using Processing.org

The PID Library worked nearly out of the box for me, but for the Front-End a short tutorial would have been helpful. Since I didn’t find one, I managed to figure out how to get it working myself, but here is a reminder on how to do it for my future me, and everyone else who is new to Arduino and/or processing.

The Components

  • The PID Library: This part will run on the arduino and will have the actual PID logic
  • The PID Font-End: This is a tool using the processing.org framework, which will connect to your arduino, get the PID-values from there and display it nicely. You can also update the PID-variables like setpoint or Kp, Ki and Kd. It uses serial connection to communicate with the arduino. The package consists of two parts: A demo code for arduino, and the Front-End code itself.
  • Processing.org is a framework that lets you write and run small software packages with GUIs in an easy way. The PID Front-End is written using processing.org, so we need to install it as well
  • ControlP5 is a library for processing.org that is needed by the Front-End. I don’t actually know what it does 😉

Installation process

    • Download 32-bit version Processing.org (On windows, you need the 32-bit version, because serial communication will not work with 64-bit version, I don’t know if the same restriction applies to linux.)
    • Install it by unzipping the content to a place where you’ll be able to find it again
    • Start processing.org by executing the processing.exe and exiting again (this is necessary to make processing create the folders for the ControlP5 library)
    • Download ControlP5 and install it by unzipping it to the processing library folder (on windows this is ~/Documents/Own Documents/Processing/libraries
    • Download the PID Front-End using Processing.org and unzip it somewhere.
    • Open processing again, and open the Front-End Sketch in “PID_Frontend_v03/PID_Frontend_v03.pde”.
    • Use the sample in ArduinoSampleCode to update your arduino code. It basically needs to be able to receive and send the pid-variables via serial.
    • Connect your arduino and run your arduino code
    • Start the Front-End sketch in processing. You will get an output listing all the available COM-ports:
      =========================================
      Native lib Version = RXTX-2.1-7
      Java lib Version   = RXTX-2.1-7
      [0] "COM3"
      [1] "COM4"
      [2] "COM5"
      [3] "COM6"
      [4] "COM11"
      ControlP5 2.0.4 infos, comments, questions at http://www.sojamo.de/libraries/controlP5

      On my machine my arduino is connected to COM11, not on COM3, but the Front-End tries to connect to the first available comport. Thus I had to change line 93 in the Front-End sketch from:

myPort = new Serial(this, Serial.list()[0], 9600);   //   Communication with

to

myPort = new Serial(this, Serial.list()[4], 9600);   //   Communication with
  • Now you’re set up to watch your PID at work, and change the parameters from your PC. The red line is the Input Value, green is the Setpoint and blue is the PID Output. The spikes are due to some problems with my temperature-sensor, that I might address in a later post.

    Example of PID Front-End

    Example of PID Front-End

Have fun using the PID libraries. Since this is my first blogpost ever, feedback would be nice 🙂

Posted in Arduino | Tagged , , , , | 3 Comments