Using Seeeduino XIAO and TFT SPI ST7735 display

A New Miniature Arduino Module

I should make it clear that I am not an Arduino expert so read on at your peril or your amusement.

Myself and a colleague ‘play’ with Arduino devices.   We were impressed by the new tiny module from  Seeeduino called the XIAO.   It has just 14 pins, all of which double or triple up in their use.   See DroneBots blog for more info on the device’s capability.

seeeduino xiao miniature arduino module
The Seeeduino XIAO miniature Arduino module. The connector is a USB-C.

We had some SPI driven ST7735 displays from Adafruit which we had successfully used on conventional Arduino devices.  We wondered if we could drive them from the XIAO.   This resulted in many many hours of frustration.   The SPI bus uses 5 connections and two of these pins (SCK and MOSI) on a normal Arduino device are hardware defined ports with specific pin numbers.  These pin numbers did not match the hardware defined ports on the XIAO and it seemed as a result that it did not want to talk.

Many hours later we seem to have got a solution.   To save others having the same frustration here is the header information we ending up using that brought success.  This is followed by the connections from the XIAO to the display. 

#include <Adafruit_GFX.h> // Include core graphics library
#include <Adafruit_ST7735.h> // Include Adafruit_ST7735 library to drive the display
#include <SPI.h> //Include SPI control library

//Define pins :
static const int TFT_CS = 3;
static const int TFT_RST = 2;
static const int TFT_DC = 1;

// Create display:
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);
0    -    nc
1    -    DC  (to display pin 4)
2    -    RST (to display pin 3)
3    -    CS (to display pin 6)
4    -    nc
6    -    nc
7    -    nc
8    -    SCK (to display pin 8)
9    -    nc
10   -    MOSI (to display pin 7)
11   -    3V3 output (to display LITE (pin 10)
12   -    GND (to display pin 1)
13   -    5V output (to display power (pin 2)

I believe by using static const int the pins are locked against any further occurrences of these labels downstream in the code.   What isn’t clear is how the SPI protocol knows that the hardware pin numbers for MISO and SCK are not the usual hardware pins as per other Arduino devices.

Similar or related subjects : –

    Vice soft jaws and then soft soft vice jaws

    A Different Approach to Soft Jaws

    A comment that I often make is about how having varied resources available to do a job creates on the one hand a quandary as to what route to take but on the other hand it can lead to a light bulb moment. Having a 3D printer available along side a CNC machine often creates this dilemma and often to advantage. 

    Stick with me on this.

    I am currently immersed in creating parts for an old turret (church) clock as pictured below.   My wife put it down as a JSN job but once again the challenge it presented won the day.  

    view of the church clock as delivered to me to work on
    Not a pretty sight but things do seem to move and things are certainly missing.

    The client found me from my blog entry about creating the Brocot wheel in CNC.   His clock as you can see is missing the pallet arbor, pallets, crutch and arbor suspension bracket.  If that wasn’t enough it also needs a new escape wheel.  This is very similar to the aforementioned Brocot wheel but smaller in size.  Fortunately the old escape wheel was still in place but in poor shape with the teeth ends fairly battered and one tooth partially missing.

    I created the CAM for the new escape wheel in Fusion 360 and then from the wheel design created the geometry for the pallets.  (There is a great document created by the BHI as part of their DLC called ‘Drawing Clock and Watch Escapements’ that helped on this as did W.J. Gazeley’s book ‘Clock and Watch Escapements’). In order to check the pallet design I decided to first of all print a 3D model.   The printed part looked like it would work when tried against the original battered escape wheel.

    Next step in my evolutionary process was to make an aluminium version on the Tormach CNC.   I used a superglue mounting block and cut the pallet profile for the full 10mm stock depth and down to the blue mounting masking tape.   Because the aluminium was so soft and I kept the DOC gentle this turned out well.

    Although the aluminium version worked very well and helped me prove the working of the clock,  aluminium is too soft for clock pallets.   A steel set would now needed and I opted for 20mm ground flat stock as the ideal material.  

    Side #1 was cut while being held in the machine vice on parallels.  A 2mm thickness of stock was left as the gripping layer.   All went to plan.

    running side 1 of the clock pallets designed in fusion 360 and running on the Tormach 440 CNC mill
    Side one machining of the clock pallet. An 8mm 3D Adaptive has completed and a 4mm follow on is now being run to clean up the finish.  Note the newly installed second Fogbuster nozzle.
    Side one of the clock pallets completed showing the residual stock to leave as a side two operation
    Finished side 1 operations and ready to invert to remove the residual stock used to grip in the vice jaws

    Side #2 now became the headache.   I could have used the super glue bonding of the stock as per the aluminium version. My twitch was that this would leave very little of the pallet material remaining to act as a secure bonding face with the superglue.  Given I was cutting steel there was every chance of things parting company.  I could hold the model inverted in the vice but there was a real danger of the nib tips getting crushed.   Not a good idea.

    Clearly the right solution was to make a pair of soft jaws to grip the pallet shape while I was decking off the side #2 residual 2mm.

    Now here is the light bulb moment.   I designed the soft jaws in Fusion so they would swap out the existing steel jaws on my machine vice.   This is a straightforward process using the Project function.   The best demo of this that I have seen is by Cough42 and is worth a watch.

    pictorial view of the pallet soft jaws to allow side #2 material to be removed
    The jazzed up Fusion view of the soft jaws (red and green) and the finished pallet shape that gets gripped in them.

    I was about to order some aluminium stock to make the soft jaws when the 3D printer winked at me from the corner of the workshop.  Could I print the soft jaws on the printer and get enough grip to allow the last 2mm to be decked off ?  This had to be worth a try and had the advantage that I could be getting on with another of the clock components while they were printing.

    Taking this route I decided I would need to modify the design in Fusion.   The 3D printer always leaves cavities a bit under size.  I used Fusion’s Offset Faces to increase the profile shape by 0.2mm all around.  I set the gap between the two jaws at 1mm.

    Print time was around 2.5 hours for each each jaw.   With CAM and setup time, running them in aluminium would have been similar.   I gained the 5 hours to do something else.  (i.e. Drink tea watching the mill ….)

    The idea worked.   The PLA tightly gripped the inverted Side #1 profile while I decked off the 2mm residual stock.  I didn’t go too aggressive on DOC.

    finished pallets with PLA soft jaws
    View of the finished pallets with the PLA soft jaws in the background mounted in the machine vice

     A set of PLA soft jaws – not a radical idea but food for thought.   

    Aluminium soft jaws are essential if you are going to be undertaking detailed feature machining of Side #2 but if it is a simple decking skim then PLA would seem more than adequate.  Soft jaws are 1 off items dedicated to a particular part.   They are consumable as is the PLA but the PLA versions are overall quicker to produce.

    This has been another situation where what would have been a no brainer ‘this is how we normally do this’ turned into a ‘how else could I do this with the resources at my disposal and make life easier ? ‘.  It is that lazy side of me shining through yet again …..   

    Onwards to the next phase of the clock activity.

    Similar or related subjects : –

    Mach3 alternative GUI

    A Refreshing New GUI

    It seems that many user of Mach3 CNC control software love the concept but hate how it is presented as a user interface.   I tend to agree as I used to tolerate it on my small CNCEST milling machine.  It is certainly not a patch on Tormach’s PathPilot.

    While browsing YouTube I came across Physics Anonymous and enjoyed a rant by them about Mach4 and then the joy of seeing their version of a Mach3 GUI which I have to say was a breath of fresh air improvement.

    If you hate your Mach3 GUI then have a look at what they are offering as a free download.   It isn’t totally bug free but an upgrade is promised.

    Similar or related subjects : –