This is just a collection of notes and links that I have found useful in getting to know the Arduino products.
The Uno only has one serial port. It is possible to simulate additional serial ports in software, though latency issues can make this impractical.
The Mega has 4 serial ports. One of those (Port 0) is shared with the on-board ISP circuit. So if you have an external device (such as a MAX232 converting TX0 and RX0 from TTL to EIA levels), you MUST disconnect the external RX0 connection before attempting to “upload” a Sketch to the Mega. If you fail to do this, the upload operation will fail.
The Mega appears as a regular USB-to-RS232 COM Port in Windows 8. So you can connect to this using PuTTY (or similar terminal emulation program).
The Arduino IDE also has a built-in Serial Port Monitor that communicates with the Mega’s Serial Port 0. This works really well for sending debugging information from your Sketch to the outside world. However, it is NOT ANSI-compatible, so if you try to send formatting commands (such as those used by the DEC VT100 terminal) to Serial Port 0, they will not be interpreted and acted on by the Serial Port Monitor.
Manually configuring the timers and PWM
You can manually configure timers and PWM outputs without the need for any libraries.
Here are some links I found helpful when coding an LTC output (switchable 50Hz or 60Hz 50% duty cycle):
Things to be aware of
Here are a few things about the Arduino that are not intuitive:
- Many shields from the Uno will work on the Mega, without modifying the software. However, the pinouts for the two boards are very different. Let’s look at Pin 0 for example. On the Uno, this is PD0. On the Mega, this is PE0. So even though it is in the same position on the PCB, it is actually connected to a very different ppin on the microcontroller. For this reason, it is important that your code reference the Arduino pin rather than the microcontroller pin.
- SPI Incompatibilities: Unfortunately the SPI pins are in different locations on the Uno and the Mega, This means that an Uno shield that uses SPI will not work on the Mega unless you re-route these pins.
- A 320×240 pixel full colour display
- Resistive touch screen
- Micro SD slot mounted underneath
- Mounted on an Arduino Uno sized shield, ready to plug and play
- aspect_kbv: Very simple program. Shows some text at one fixed size. Then clears the screen and re-draws the text with the display rotated 90 degrees. Repeats until all 4 orientations have been demonstrated. Works fine.
- GLUE_Demo_320x240: Impressive graphical display. Shows lines, sine waves, boxes, dots, etc.
- graphictest_kbv: Another impressive text/graphics demo. Works fine.
- graphictest_slim: Doesn’t run.
- LCD_ID_readreg: Just gives white screen. But Serial Monitor shows lots of info, including the ID of 77 83.
- readpixel_kbv: Impressive demonstration of very small text. Approximately 30 lines by 40 chars in landscape mode. Also shows portrait mode.
- scroll_kbv: Just shows a message on line 1 that says “ID = 0x7783” and then line 2 says “can NOT scroll”.
- showBMP_kbv_as7: PROBABLY SHOWS A BITMAP FROM SD CARD. HAVEN’T TESTED IT YET.
testcard_kbv: Shows a picture similar to a TV test pattern.
- Touch_shield_kbv: Show a sign-on page. Yellow test says “Touch screen for loo”. But it doesn’t respond. Perhaps not suitable for this display?
- Touchscreen_Calibr_kbv: Some sort of calibration routine. Opening screen comes up, but doesn’t respond to touch.
- UTouch_Calibr_kbv: Identical to above, but advances to second screen. Can’t seem to get it to work beyond that.
Duinotech 2.8″ TFT LCD with resistive touchscreen
I purchased this LCD from Jaycar in June 2017 for about $30.
As a novice LCD experimenter, this seems to be a nice product. It offers:
Jaycar’s webpage for this product is here.
The LCD is driven by an 8-bit parallel interface (plus 5 control lines), and the Micro SD card uses the Arduino’s SPI interface. Having a parallel interface to the LCD makes it relatively quick, but one downside of this product is that it uses virtually all available I/O pins on the Arduino Uno. Only 3 or 4 pins are left for you to use for other purposes.
The LCD will apparently also work on an Arduino Mega (which will of course provide many spare I/O pins). However, be aware that the Micro SD card reader will not work on the Arduino Mega, as the SPI pins are on a different connector. I have read that you can re-configure the Arduino IDE so that the Arduino Mega instead uses a “SOFT SPI” option, but I haven’t tried this yet.
It seems this product is in fact a re-badged version of the “mcufriend” product that is very common (and very cheap) on eBay.
Both the Duinotech and mcufriend products seem to be derived from Version 1 of the Adafruit 2.8″ TFT LCD (Adafruit Product #376). Adafruit’s Product 376 has since been discontinued by Adafruit and replaced with 2 improved 2.8″ TFT LCD products, each of which now use an SPI interface instead to drive the LCD controller. One of these V2 products uses resistive touch (Product 1651), and the other one uses capacitive touch (Product 1947).
Adafruit provided libraries for Product 376 (see the links as the bottom of Adafruit’s product page). However, the Adafruit TFT LCD library was written to support the controllers used in Product 376 (being ILI9325, ILI9328 or HX8347). The Duinotech/mcufriend product instead uses an ST7781 controller (which reports an ID number of 7783). This controller is NOT compatible with Adafruit’s stock TFT LCD library and is also NOT compatible with the stock Adafruit example TFT LCD programs that are included in the library subdirectory.
So you must use the Duinotech/mcufriend libraries AND their associated example programs instead.
There are several web posts that provide modified TFTLCD libraries that are supposed to work with this board. None of them worked for me.
However the good news is that I was able to get this board to work using the libraries and example sketches that were provided on the Jaycar product page (I just didn’t look closely enough there to notice them at first).
Here are the files from Jaycar’s product page:
[DESCRIBE WHAT IS DIFFERENT IN THE JAYCAR-SUPPLIED LIBRARIES]
NOTE: The example sketches that you want to use are those in the “XC4630v2” directory of the above ZIP file.
[INSERT A LIST OF THOSE EXAMPLES AND THEIR DESCRIPTION]
There are more examples in the individual library directories. The examples in “Adafruit_TFTLCD” and “TouchScreen” directories don’t work at all. The ones in the “MCUFriend_kbv” directory mostly work (see descriptions below).
Here is a brief description of the example sketches in the libraries/MCUFRIEND_kbv/examples directory:
NOTE: Adafruit’s compatibility page says that the 2.8″ TFT Touch Shield can be used on the Mega by editing the file C:\Program Files (x86)\Arduino\libraries\SD\src\utility. You just change the line that says “#define MEGA_SOFT_SPI 0” to “#define MEGA_SOFT_SPI 1”. I haven’t tried this yet.