Counter Top LCD to display next bus times

I am never on time to catch my bus to work. By the time I pull out my phone to check the bus prediction it is either too late or too early. I have created a prototype for a counter top LCD display that will tell me either to quickly eat my breakfast or to take my time getting ready. With a quick glance at this I am able to just time when I should leave my apartment.

This is just a prototype. I am using another Arduino to power the LCD ( I did not read the voltage requirements when I ordered it on eBay). I also had a create a small circuit that will convert 3.3V to 5V for the serial control.

Thank you SparkCore team for this wonderful little device.

Pic: http://imgur.com/ykjo3gL

4 Likes

Cool project @gtg662w! Isn’t it wonderful having the power of the internet in such a small device? :blue_heart: :spark: Spark Core!

Check out this similar project: https://community.spark.io/t/bus-stop-light-code-review/1176

And for images, there is no upload persay, but if you upload to http://imgur.com and paste a link in here to the direct image URL and it should automatically display it in your post. I believe it has to be on a new line by itself, then hit return and you’ll see it in the preview. Side note, I’ve noticed some images seem to upload to Spark’s website in the background and then the system edit’s my post with the new link… kinda freaky.

Actually, there is an upload icon for uploading images. I’ve done it several times and it hosts the file on the community.spark.io domain. In fact, I’ll use it to upload a screenshot with an arrow pointing to the icon. :wink:

2 Likes

LOL Where did that button come from!? haha… thanks @wgbartley

Hi @gtg662w, why can't you use the 5V for the LCD also?

@PaulRB… I was able to power up the LCD with 3.3V (although the contrast was significantly lower), but the serial data line needs to be 5V. With using just the TX out from the SparkCore, my LCD was not able to read the commands.

This is the LCD I am using: http://www.nkcelectronics.com/16x2-Serial-LCD-Module-Blue-with-White-backlight_p_347.html

Thanks @BDub @wgbartley…apparently New users cannot upload pics…so imgur it is.

Could you just use a couple of ordinary npn transistors as a level shifter?

Like this!

Yes! That is exactly what I am doing, If you look at the image, there are 2 NPN transistor on the breadboard right below the Core.

Oh, I get it now. Sorry!

So (at risk of asking another dumb question) why use the Arduino to provide 5V supply for the LCD? Why not just take 5V from the Vin pin on the Spark?

@gtg662w That’s awesome!
Are you planning on making the source code available to the community?

Another really simple logic level converter:

Available at Sparkfun for cheap:

1 Like

"There are no dumb questions".

So Vin is used to power up the Core. It does not output voltage. As per the documentation the core and handle upto 6V and the onboard voltage regulator will lower it to 3.3V, which is the voltage the Core operates at. In the picture, I am powering the Core using the USB cable and I can also connect it directly to the 5V of the Arduino.

If I had a 3.3V LCD, I would use the 3.3V pin to power the LCD. I would not need my other Arduino.

Again I was just being lazy here. Later this week I will just connect this thing to 4 AA batteries so it can work by itself.

@mohit Thanks a lot. Yes I will be sharing that soon. I just want to fancy it up a bit. I’ll post a link here once I’m done.

@BDub Thanks! Time to order some MOSFETs.

hmm…would this schematic also work the other way round, to bring 5V to 3.3V (by turning the FET of course)? Have some problems here with an UART Transmitter (sending on TX works perfect, but noisy signals on TX>RX, “ASCII jam” at Core’s RX), maybe be solved by keeping the core on 3.3V (it’s anyway on 3.3V, even when powered with NON-USB supply, right?), but powering the UART transmitter with 5V. I’m not the FET-expert, sorry! (UART FS20)

@mf2105 yes it does work in the opposite direction :smile: you can read about it here:

A simpler way of just going from 5V to 3.3V is like this:

If you need high speed conversion from 5V to 3.3V try the DIP 74LVC245! Doesn’t work from 3.3V to 5V though.

thanks! where does “high speed” start? is 9600 Baud already high speed (just to make sure) ?

@mf2105 Well it kind of depends on the capacitance of your 3.3V input. The more capacitance it has, the slower your rise and fall times will be, and that’s not good for data integrity. There are ways to calculate it pretty easily but it depends on a lot of factors, so it’s really easiest just the take a look at your waveforms on an oscilloscope. If you don’t have one of those, then it’s probably best to over design your circuits… i.e., use a high speed method even if you don’t think you need it.

Depending on what’s driving your 5V to 3.3V level shifter, you can can increase the speed capability by lowering the resistor values. This lowers the overall impedance that is creating a time constant with your input capacitance.

Another effect of capacitance on your input is that the faster you switch it on and off, the lower it’s capacitive reactance will be, effectively reducing your signal to a point where your input doesn’t register it anymore. This is typically referred to as the the Cut-Off frequency of your RC circuit, and is calculated with Freq(cut-off) = 1 / (2 x π x R x C). Driving your RC circuit at this frequency will reduce your output voltage to about 70% of the input, based on the fact that the capacitive reactance is now forming a voltage divider with your series resistance. Series resistance is basically the Thevenized value of your resistor divider, which is simply the two resistors in parallel. 10k || 20k = 6.6k. STM32 general I/O capacitance is listed as 5pF. So the cut-off frequency would be: 1 / (2 x 3.141592 x 6600 x 0.000000000005) = ~4.8MHz.

Keep in mind 4.8MHz is the speed at which your output will be 70% less than your input (which in this case is 3.3V)… This means when your signal is high, it’s really only 3.3V x 0.7 = 2.31V.

Is that bad? Well it can be… let’s see… so we look at the minimum Vih (voltage input level high) needed for general I/O of the STM32. The equation is the craziest one I’ve seen (0.41 x (Vdd - 2V) + 1.3V) or 1.833V. So 2.31V is still above that, so it should register as high.

So it seems like up to 4.8MHz is ok… however… that’s not all you have to consider.

Your square waveform may not be so square anymore, and with rounded leading edges, you may have lower voltages at points where the hardware modules may sample the level of the input signal. This is especially true for any clocked signal, but also true for things like asynchronously clocked data like TTL UARTS (aka your serial driven stuff).

So without looking at it, I’d probably stay under 2Mhz with that resistor divider.

The fastest waveform you can make with 9600 Baud is a 0xAA or 0x55 pattern of 0b10101010 or 0b01010101. This is actually Baud / 2. Baud is essentially = Frequency for our TTL 8 N 1 None stuff.

So if we say 2MHz is the limit. Baud / 2 <= 2Mhz. or Baud = 2 x 2Mhz, 4,000,000 Baud.

So, you’re good! But always double check with a scope if you can!

hmm, i have “googled” :smile: for my old scope (a Hameg 206, 20MHz, about 30 yrs old) in the basement and looked at the waveform, seems to be ok, saw no “grass” on the screen. Moving the UART away 0.5m didn’t help. In between I’m in doubt about my u.fl antenna and it’s EMI to the UART’s TX wire, so I ordered a new one to get rid of my cannula antenna https://community.spark.io/t/make-an-u-fl-antenna-within-seconds-using-a-cannula/1152 (yes, I know…). Maybe some shielding is necessary, but the UART is a 868MHZ, receiver, … So let’s wait for new wifi antenna and restart. Many thanks for your explanation!