LCD compatible with FONA 32u4

Adafruit cellular platform - SMS and IoT over celluar

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
patoberli
 
Posts: 16
Joined: Thu Jul 12, 2018 4:38 am

LCD compatible with FONA 32u4

Post by patoberli »

Hi all
I'm in the middle of doing a nice little project with the FONA 32u4. I sadly just discovered that my Arduino LCD (https://www.arduino.cc/en/Tutorial/LiquidCrystalDisplay) requires 5V to display something and thus doesn't work with the 3,3 V from the FONA :(
I checked the Adafruit shop, but was unable to find an easy LCD which runs on 3,3 V. Did I miss a compatible product or do you have an easy solution for my problem?
I still have some https://www.aliexpress.com/item/IIC-I2C ... UBMuyc&s=p at home, but I actually never used them, because (for another project) I bought 3,3 V Arduinos at that time. As far as I can see, the old Arduino LCD isn't I2C, so I guess this part isn't compatible.

Thanks for inputs :)
Patrick

User avatar
patoberli
 
Posts: 16
Joined: Thu Jul 12, 2018 4:38 am

Re: LCD compatible with FONA 32u4

Post by patoberli »

Found one on aliexpress, I guess it will work. In any case, it would be nice if Adafruit could also stock one :) Maybe the I2C variant, so that we don't use that many pins.
Search term: 16x2 Character LCD 3.3v

Will know in around 3 weeks if it will work.

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: LCD compatible with FONA 32u4

Post by adafruit_support_mike »

It's kind of hit-and-miss. Some LCDs need at least 5V to make the liquid crystal move enough to produce a visible display, while others are made to work at lower voltages.

The ones we carry are made for 5V system, but some people have said they work when powered from 3.3V. It doesn't seem to be 100% though.

User avatar
patoberli
 
Posts: 16
Joined: Thu Jul 12, 2018 4:38 am

Re: LCD compatible with FONA 32u4

Post by patoberli »

Good to know.
I await now the delivery of the special 3.3V unit.

One more thing, I try to monitor if there is input voltage on the USB. Currently I do this by monitoring the voltage of the battery, but the value is oscillating a lot and not very precise.
I can see that there is a PIN called USB with the description "this is the positive voltage to/from the micro USB jack if connected".
Is there a safe way to monitor if there is input voltage on the USB port by wiring this port to an analogue input? I assume I need to use at least a resistor, but how high does it need to be to not destroy the board with the 5V? Sadly my electronics knowledge is not very good.
Here's my current project: https://github.com/patoberli/arduino-aquarium-alarm (my first GIT project, I've just setup the page).

Thanks
Patrick

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: LCD compatible with FONA 32u4

Post by adafruit_support_mike »

Connect a 22k-33k voltage divider between the USB pin and GND, and measure the voltage with one of the Feather's ADC pins.

The voltage divider will produce 3V at the ADC pin when the USB pin's voltage is 5V, which will keep the microcontroller safe. You can scale the reading up to the actual voltage to see if the Feather is running from a LiPo or is connected to an external 5V power source.

User avatar
patoberli
 
Posts: 16
Joined: Thu Jul 12, 2018 4:38 am

Re: LCD compatible with FONA 32u4

Post by patoberli »

Thanks, I'm trying it now with two 1 Mohm resistors. Based on the info here that should work: https://learn.sparkfun.com/tutorials/voltage-dividers or do I have to use much stronger resistors?

[edit]
I've now built the circuit for the USB measure:

Code: Select all

  // read voltage on USB pin, to check of power is still supplied.
  // read the input on analog pin 0:
  int sensorValue = analogRead(A0);
  // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
  float voltage = sensorValue * (5.0 / 1023.0);
  // print out the value you read:
  Serial.print("Measured power on USB: ");  Serial.println(voltage);
  if (voltage <= 3.4)
  {
	  digitalWrite(13, HIGH);
  }
  else
  {
	  digitalWrite(13, LOW);
  }
What confuses me though, if I have the cable not plugged into A0, it still measures 0.15 - 0.22V, is that correct?
Oh and is the division of the 5 V correct? I supposed not and it's more like 2.5 V (because I use two resistors with 4700 Ohm).

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: LCD compatible with FONA 32u4

Post by adafruit_support_mike »

The microcontroller’s ADC pin will draw a small amount of current from the voltage divider every time it measures the voltage. Hand-waving some of the more complicated details away, that makes the ADC look like another resistor connected between the center of the voltage divider and GND.

That new hypothetical resistor sits in parallel with the lower resistor in the voltage divider, and the resistance of both in parallel will be lower than the resistance of either one on its own. You generally want the resistors in the voltage divider to be less than 1/10th of the ADC’s effective resistance so the current flowing into the ADC produces less than a 10% error.

150mV to 220mV is much lower than the voltage I’d expect at the center of a 1M-1M voltage divider connected between 0V and 5V. Post a photo showing your hardware and connections and we’ll take a look. 800x600 images usually work best.

User avatar
patoberli
 
Posts: 16
Joined: Thu Jul 12, 2018 4:38 am

Re: LCD compatible with FONA 32u4

Post by patoberli »

I've drawn it in Fritzing, is that also ok?
https://github.com/patoberli/arduino-aq ... 2.0_bb.png
Please note, the sketch in that folder is outdated.

If I unplug the USB, I still have around 2-3V on the A0 (with my 5V code sample from before), but less than when plugged the USB in. As I can't measure it while it's unplugged, I simply light the red LED if it's below 3.4. It doesn't light up if I set it to <2.5 though.
Once I get my 3.3V display I should be able to tell what value is measured without the USB plugged in.

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: LCD compatible with FONA 32u4

Post by adafruit_support_mike »

The drawing looks good, but schematics only show how a circuit should be built. The hardware shows what's actually there, including all the things that didn't make it into the drawing.

Please post a photo when you get a chance.

User avatar
patoberli
 
Posts: 16
Joined: Thu Jul 12, 2018 4:38 am

Re: LCD compatible with FONA 32u4

Post by patoberli »

Thanks for your help. Here the image, I hope it's clear enough.
IMG_20180726_100750_small.jpg
IMG_20180726_100750_small.jpg (79.25 KiB) Viewed 299 times

User avatar
cry4brk
 
Posts: 180
Joined: Tue Oct 09, 2012 3:14 pm

Re: LCD compatible with FONA 32u4

Post by cry4brk »

patoberli wrote:Thanks for your help. Here the image, I hope it's clear enough.
IMG_20180726_100750_small.jpg
Why that huge ferrite bead on the antenna cable? Dose it do any good?

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: LCD compatible with FONA 32u4

Post by adafruit_support_mike »

Try dropping the resistors from 1M to 10k. That will give the analog input a much more stable reading.

User avatar
patoberli
 
Posts: 16
Joined: Thu Jul 12, 2018 4:38 am

Re: LCD compatible with FONA 32u4

Post by patoberli »

cry4brk wrote: Why that huge ferrite bead on the antenna cable? Dose it do any good?
I didn't have a smaller around in the office :)
In my case, the fona always rebooted when trying to send an sms, sometimes even when just booting up while the antenna was attached. Since I added the ferrite bead, no more reboots.

User avatar
patoberli
 
Posts: 16
Joined: Thu Jul 12, 2018 4:38 am

Re: LCD compatible with FONA 32u4

Post by patoberli »

I found an error in my wiring (received a new 3.3V display, which so far doesn't work) which pointed me to the wiring error. I had the Disp5 of the display in the KEY of the FONA, instead of the D0 and the Disp6 in the D0 instead of D1.
Checking now if that has changed the power measurement and afterwards I continue to get the new display to work. I still suspect a wiring error, although I've checked it now 5 times.

User avatar
patoberli
 
Posts: 16
Joined: Thu Jul 12, 2018 4:38 am

Re: LCD compatible with FONA 32u4

Post by patoberli »

Fixed the display, was a bad solder point (after I corrected the wiring).

Now that I can display the measured voltage, with the USB in I get 3.81, with the USB unplugged I measure 3.04. I measure = that is what the FONA is measuring.
Here the (part) sketch again:

Code: Select all

  // read voltage on USB pin, to check of power is still supplied.
  // read the input on analog pin 0:
  int sensorValue = analogRead(A0);
  // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
  float voltage = sensorValue * (5 / 1023.0);
  // print out the value you read:
  Serial.print("Measured power on USB: ");  Serial.println(voltage);

  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(9, 1);

  // print the temperature on the LCD:
  lcd.print(voltage);

  if (voltage >= 3.25) // power ok, the 3.25 might need some finetuning, depending on resistors and cable lengths
  {
	  digitalWrite(13, LOW);
	  VOLTAGESMSREQ = 0;
	  VOLTAGESMSSENT = 0;
	  noTone(10);
	  delay(5000);

  }
  else // no power from USB
  {
	  digitalWrite(13, HIGH);
	  //VOLTAGESMSREQ = 1; // comment this while testing, to disable sending SMS
	  //tone(10, 5000, 1000); // Audio alarm, add piezo to Pin 10, frequency 5000 Hz, 1 second beep duration
	  delay(4000);
  }
It is absolutely stable enough for my project, I'm just confused that the measured unit is not much closer to <0.5 when the USB is unplugged.

With the A0 unplugged it's 0.00 - 0.07, so that is also ok. I have not tested with lower resistors.

Locked
Please be positive and constructive with your questions and comments.

Return to “FONA”