This is my first Instructable so apologies for any lack of clarity, factual errors or typos!
Even if you don't build the remote controller the code at the end has examples of lots of stuff including:
- Driving stepper motors using an A4988 module
- Driving multiple servo motors
- Creating multiple instances of objects (stepper motors and servos)
- Creating arrays of objects for easy processing
- Driving an LCD display over the I2C bus
- Driving a 4 x 4 membrane keypad over the I2C bus
- Writing data to, and reading data from, the additional 32KB of EEPROM
- Reading and writing SD files over the SPI bus
- Storing variables (LCD messages in this case) in program memory to save SRAM
- Using software to reset the Atmega328p
The hand held controller described here may be used with anything that supports I2C - though you will also need SPI if you want to use the SD card slot - Arduinos support both of course.
For anyone who has got this far but is not into microcontrollers, both I2C (Inter Integrated Circuit) and SPI (Serial Peripheral Interface) are ways for one device to communicate with another - they define the wires and signals to be used.
Sad to say, the world of computing is full of TLAs (Three Letter Abbreviations) - there are a few FLAs and SLAs but we frown on them.. "EEPROM" started as a TLA ("ROM"), became an FLA ("PROM"), then another FLA ("EPROM") until settling down as an SLA: "Electrically Erasable Programmable Read Only Memory" - which is not true anyway because it is no longer "Read Only" - you can write to it! Sorry, I'm rambling.
Two friends and I are semi-retired (meaning we don't go in to work anymore - whoopee!) and we decided to do something to keep our brains active! We have decades of software and electronics experience (actually, over 100 years between us!) so we decided to call ourselves "Quite Useful Stuff" because we enjoy developing quite useful things. We came up with a series of boards to help with Arduino Pro Mini development - we call them "SmartMini".
We like the Pro Mini because it is very small and very low cost - blow one up (which I have done several times!) and it doesn't cost an arm and a leg to buy another.
The SmartMini family of boards can be used for projects and products; I have used them for driving servo motors, stepper motors and lots of other stuff. We set up a web site, "qustuff.com", for SmartMini and the family is still growing - it now includes WiFi and Bluetooth BLE daughter boards!
I wanted a neat hand-held controller to use with lots of projects - especially when moving things with motors.
The finished controller consists of a 20 x 4 LCD and 4 x 4 membrane keypad connected to a SmartMini-EB Expansion Board which also provides an SD card slot and 32KB of EEPROM.
The controller can be used with SmartMini boards, Arduinos or anything else because communication is via SPI for the SD card slot and I2C for everything else.
I hope to publish future Instructables showing how SmartMini boards can be used to make all sorts of useful stuff. For example, I have made a very tasty fully automatic CNC box jointer for my woodworking workshop - driven by a SmartMini-MA board and this remote control.
Step 1: Parts List
When the controller was finished, I used a SmartMini-HI board (on the right of the first photo) linking to the SmartMini-PS (Power Supply - on the left of the first photo) to test it. SmartMini boards can be daisy-chained and even used for distributed processing! The Power Supply takes up to 12V input (I use a 12V lead battery for most of my projects). The 12V is cut down to 5V for the Arduinoi Pro Mini and is also available to drive stepper motors - though up to 35V can be connected for motor power if required.
For the controller I used the SmartMini-EB (second photo) and the SmartMini-EBC - an extension board for the keypad.
- 1 off - set of SmartMini controller acrylic plates - I have a small laser cutter so I cut these from 3mm acrylic using the .DXF files from the QUS web site. They can be purchased from the SmartMini store.
- 1 off - 2004 20 column x 4 row LCD display
- 1 off - 4 x 4 membrane keypad
- 1 off - SmartMini-EB Expansion Board
- 1 off - SmartMini-EBX keypad Extension Board
- 1 off - 300mm 10 way Multiport ribbon cable with connectors
- 6 off - 30mm x 3mm pozi head machine screws and nuts
- 6 off - plastic feet
- 4 off - round nylon spacers: 5mm long, 6mm diameter with 3mm bore
- 4 off - round nylon spacers: 12mm long, 6mm diameter with 3mm bore
- 2 off - round nylon spacers: 18mm long, 6mm diameter with 3mm bore
Step 2: Building Up the EB Board.
- Build up theSmartMini-EB Expansion board. All the surface mount parts are in place so I just had to solder the headers and the contrast potentiometer - all in the SmartMini-EB kit.
- Solder SmartMini-EB to the back of the 2004 display.
- You can purchase 1602 and 2004 LCD displays with an I2C interface on the back but the SmartMini-EB is an I2C board on steroids! As well as driving the display it adds support for an SD card socket (driven by SPI), 32K bytes of I2C EEPROM, local keypad (via I2C - plugged directly into the EB board - as in this project) and a remote "flying") keypad (via I2C - plugged into a mini-USB socket on the EB board). It is linked back to the SmartMini-HI/SA/MA boards via a 10 way ribbon cable and what QUS call a "Multiport".
Step 3: Fitting the Keypad
- Use a finger nail (nothing harder or you will scratch the acrylic) to remove the protective backing paper from both sides of the acrylic plates. The protective covering is there - though sometimes it is difficult to see.
- Gently wash the acrylic plates in warm soapy water to remove all traces of stickiness. Dry well.
- Remove the protective backing from the 4x4 membrane keypad.
- Pass the connector end of the cable through the small rectangular hole in the top acrylic sheet. Make sure the plate is the correct way up!
- Carefully align the keypad with the marked area on the top acrylic sheet and stick it in place. Take care with alignment.
Step 4: Connecting the Keypad
- Fit the SmartMini-EBX extension board to the keypad pins on the SmartMini-EB board. Make sure the EBX board it is the correct way up.
- Fit the keypad connecter to the pins on SmartMini-EBX board.
- Insert one end of the Multiport cable to the SmartMini-EB board as shown.
Step 5: Preparing the Base
- Insert the six 3mm screws into the holes on the acrylic back and place it upside down on your work surface.
- Put the 12mm spacers on the top four screws (where the LCD will fit) and the 18mm spacers on the other two screws.
Step 6: Fitting It All Together
- Place the LCD onto the top four screws.
- Place the 5mm spacers on top of these screws.
- Place the acrylic top, with the keypad, onto of all six screws
- Fit the 3mm nuts.
- Remove the protective cover from the plastic feet and fit them to the bottom of the controller.
- The Quite Useful Stuff web site has snippets of code that can be used to test the finished controller.
Many thank for reading this far - I will try to publish an Instructable about the woodworking CNC box jointer as soon as possible.
The final step is some code!
Step 7: Sample Code
The sample code tests the remote controller (LCD, keypad, SD card slot and 32KB of additional EEPROM), stepper motor(s) and servo motor(s).
The code, in the form of an Arduino sketch, is quite long and may be downloaded from the QUS web site.