This is a project to get real time (near enough) currency rates and display them on a LCD screen.
This is fully autonomous but does need to connect to a WiFi access point. The selected currency rates will scroll across the bottom of the display every 60 seconds and gets the rates from the free api.fixer.io.
- 20x4 LCD
- Stripboard about 25 strops x 29 holes
- Voltage regulator (optional)
- BV507 with WiFi *
- Zip file containing project resources
* Any ByPic part can be used it is just that the BV507 has 'built in' (on the PCB) WiFi so it is most convenient.
The voltage regulator is optional as it can be supplied form a regulated 5V supply, similar to the Wall wart USB type.
To make things easier, a stripboard was used and designed on VEECAD the paid for version but there is a free version as well. There are lots of stripboard design software out there but this one, although not really intuitive is the best. You can print out to a scale of 1:1 and stick that over the stripboard to reduce mistakes.
It is quite possible to simply wire on a bread board but to make things a bit neater a stripboard was used.
Use this pdf file and print out at 1:1 on sticky back paper, then stick it on the actual stripboard, the blue crosses are cuts in the stripboard track which can be made with a stripboard cutter or a drill bit.
The green lines are wires that connect the strips together.
Connection to the LCD is via a 16 pin socket, but of course wires will do. This is a bit awkward as the socket has to be soldered on the same side.
When finished apply power and check the voltage on the appropriate pins before plugging in any components.
The WiFi is provided by a ESP8266 programmed with ByVac serial bridge. If using a ByVac product then this will be on the ESP8266 already however if not the firmware is freely available.
When programmed, with the power on, connect GPIO0 to ground for 10 seconds. This will make the built in http server and turn the ESP8266 into an access point. Then see the details of connecting to your own access point.
Start the IDE, copy the link below into the IDE.
constant BASERATE$ "GBP" // base rate
constant RATES$ "EURUSDAUDCZK" // rates to scroll
constant THISPORT 1 // change to either port 1 or 2 (UART)
Adjust these three constants at the top of the file if necessary
UART1 or UART2
The ESP8266 can be connected to either UART, it is far better to use UART1 for this application but it will work on UART2. The problem with using UART2 is that is also the UART used for the main programming interface and so there are clashes, but manageable.
If different pins are used for the LCD then change them in oz.init().
How it Works
The LCD is driven by the library LCD driver, the pins used for the LCD are set up in oz.init() and so other pins can be used if required, just change the top of that function.
Scrolling is quite difficult to do for just 1 line but that is also taken care of by the LCD library, it uses a task which is set, again in oz.init() by lcd.scrollInit(3,20,150). 3 is the line to scroll on, 20 is the number of columns on the display and 150 is the number of mS between each scroll.
The actual text to scroll is done by lcd.scrollText(string$).
The data for the display is obtained from api.fixer.io/rates. If you put that url in a a browser address bar you will see a list of current rates. This is all the program does, it gets the rates from that site, strips the desired currencies and displays them.
There are two constants that can be changed:
constant BASERATE$ "GBP"
constant RATES$ "EURUSDAUDCZK"
The first is the base at which the other currencies will be values and the second is the number of currencies to be displayed.
NOTE: Corrections not required for new layout
The BV507 has solder jumpers to select UART