
Limited time download: Follow us on “Microcontroller”, reply “Tutorial” to get the microcontroller e-book, reply“Simulation” to get Proteus simulation materials. Continuously updated…
When it comes to wearable devices, the first thing that usually comes to mind is the smartwatch. Buying a stylish smartwatch is certainly nice, but as a maker, you can choose to make one yourself like I did! I named this DIY smartwatch the Retro Watch. The whole project is based on Android and Arduino development boards, and all hardware and software designs for the project are open-source. You can download the source code on GitHub or contribute your own efforts. Additionally, it is worth mentioning that Retro Watch already supports u8glib, which allows you to choose any screen you want to use (including OLED), and the RAM used by the screen can be reduced as well.Step 1: System Architecture DesignAs shown in the figure, the structure of the Retro Watch is relatively simple: the hardware platform is based on Arduino, and there is only one control button on it. In addition, I also developed an Android-based application that allows the watch to connect to Android devices via Bluetooth, so we can use Retro Watch to view RSS feeds and system notifications from Android devices.Step 2: Component PreparationSince we are making a smartwatch, ensuring the compactness of each component is also key.
For the Arduino microcontroller, I chose the smallest Arduino, the Pro Mini, which is a lightweight version of the Uno R3. There is not even a USB interface chip on it, so an additional USB to UART module is needed. This Arduino has two versions with different operating voltages (3.3v/5v), and I chose the 3.3V version because both the Bluetooth module and the display support 3.3V, and the 3.7V LiPo battery can also be used normally. The working frequency of the 3.3V version of Arduino is 8MHz, while the 5V version has a working frequency of 16MHz, but 8MHz is sufficient. Generally, the core processor of Arduino Pro Mini is the ATmega328 microcontroller with 2KB of RAM; while the Arduino version with only 1KB of RAM, the ATmega128, is not enough. The Bluetooth HC-06 Bluetooth module is quite common. There is a version with an interface board that includes a reset button and an LED, but it is relatively large. Given that the interface board is not very meaningful for this project and adds extra cost, I chose the HC-06 without the interface board. For the display, we need a display that is small enough and has low power consumption. I finally chose Adafruit’s 0.96 inch 128×64 OLED display, which supports I2C and SPI, and can be easily connected to Arduino. I used the I2C and SSD1306 driver chip here. For the battery, I chose a 3.7V LiPo battery with a capacity of 140mAh. Generally, it can last for 7 hours. Similarly, choosing the size of the battery is very important. Other than wires and other components, a 10 kΩ resistor (for button connection) is also needed.Step 3: AssemblyThe hardware connection diagram of the entire system is as follows:
Bluetooth connection to Arduino: ·VCC ~ 3.3V ·GND ~ GND ·TX ~ D2 ·RX ~ D3 OLED connection to Arduino: ·GND ~ GND ·VCC ~ VCC ·SDA ~ A4 (Analog pin 4) ·SCL ~ A5 (Analog pin 5) If using SPI interface, refer to Adafruit tutorial for connection as follows: ·D1: MOSI ~ Arduino D11 (MOSI) ·D2: MISO ~ Arduino D12 (MISO) (optional) ·D0: CLK ~ Arduino D13 (SCK) ·DC: DC (Data Command) ~ Arduino D8 (or others) ·CS: CS (Chip Select) ~ Arduino D10 (SS) ·RES: RESET ~ Arduino D9 (or others) Button: Connection method as shown in the figure, note that a 10 kΩ resistor is needed here.
Battery connection to Arduino: ·Positive ~ RAW ·Negative ~ GND USB to UART module connection to Arduino: ·3.3V ~ VCC ·TXD ~ RXD ·RXD ~ TXD ·GND ~ GND The installation dimensions are as follows:
Step 4: Compile Arduino Code and UploadThe completed Arduino project can be downloaded from GitHub. After downloading, do not rush to compile; you need to configure the development environment first. Install graphic drivers: First, you need to install the graphic processing libraries Adafruit_SSD1306 and Adafruit-GFX-Library to display images on the OLED. (In some development environments, Adafruit libraries may conflict with Robot_xxx libraries; if this happens, back up the Robot_xxx library and delete it from the library folder.) Warning: If you are using an OLED with the SH1106 driver, download the Adafruit_SH1106 driver from GitHub. Additionally, this project also supports u8glib, and you can download the Arduino version from its official homepage. Copy bitmap image header file: Copy the bitmap.h file from the RetroWatchArduino folder to the path /Arduino installation folder/Arduino/hardware/libraries/RetroWatch. If there is no such path, you can create it yourself. Modify the source code: Open Arduino IDE and load RetroWtchArduino.ino. If your pins are different from those in this tutorial, you need to modify the pin definitions: SoftwareSerial BTSerial(9, 8); // Bluetooth TX, RX connection pins int buttonPin = 5; // Button pin display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // OLED I2C address, replace your address with Ox3D If you are using u8glib, load the RetroWatchArduino_u8glib.ino file, then pay attention to the following code: U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0); // Modify according to your selected display SoftwareSerial BTSerial(2,3); // Bluetooth TX, RX connection pins int buttonPin = 5; // Button pin If you are using Adafruit’s graphic library and have used the OLED’s Reset pin, connect the OLED’s Reset to Arduino’s D8 pin, or you can customize it: #define OLED_RESET 8 Adafruit_SSD1306 display(OLED_RESET); Compile and upload: After completing the above steps, compile and upload. After successful upload, the display will show the RetroWatch Arduino Logo and Adafruit Logo. After the logo, the screen will display 00:00, as shown in the figure:
Step 5: Android Software and Source CodeSince only versions of Android 4.3 and above support reading notification information from applications, please ensure that your Android device has Android 4.3 or a newer system version installed. However, if you are using a version below 4.3, you can use another stripped-down version of the application: it can receive notifications through the smartwatch but cannot read the content. The application source code can be viewed on GitHub, or it can be directly installed from the Google Play Store (RetroWatch or RetroWatch LE for lower version systems). After installing the Android software, check whether the system has granted it permission to read notifications. Next, turn on Bluetooth on your phone and pair the Android phone with the Arduino’s Bluetooth. Then select the connected Arduino in the RetroWatch software, and the interface will display “Connected” indicating a successful connection. Click the menu and select Data transfer to Watch, then the device will transfer time and information to the smartwatch via Bluetooth. Due to the limited performance of the watch hardware, many functions need to be realized through the Android application, and the main function of the watch itself is to display. In the Android application, you can set the types of push messages (only supporting English characters) and status notifications (such as phone battery level and signal strength), and you can also push RSS that you subscribe to in the application (you can subscribe to weather RSS to display weather on the watch). Updates synchronize every 30 minutes.
In addition, the application provides 65 different display icons that you can define and set yourself.Step 6: Smartwatch Function IntroductionAfter installation is complete, it’s time to explore our smartwatch. The smartwatch system works as follows:
Startup Display: Displays logo, smartwatch startup. Clock Display: Shows the time on the connected Android phone. Additionally, the time display can be modified; currently, three modes are provided: analog display, digital display, and mixed display. If you click the button, the watch enters emergency information display mode. If there is no data update or operation within 10 minutes, the display will switch to standby mode.
Emergency Information Display: When the user clicks the button or new emergency information is input, the watch enters this mode. The user can click the button again to view the next message; if no operation is performed for 10 seconds, the watch will automatically display the next message. After the information display is complete, the watch switches to normal information display. Due to the very small RAM of only 2KB, this smartwatch can store a maximum of 3 emergency messages; if there are more than 3 messages, the oldest message will be automatically deleted. Normal Information Display: After completing the emergency information display, the watch will continue to display normal information; clicking the button or not operating for 5 seconds will display the next message. After the information display is complete, the watch switches back to clock display. A maximum of 7 normal messages can be stored. Standby Display: If there is no data update or operation within 10 minutes, the display will switch to standby mode. In this mode, the watch interface only displays indicators (which can be selected in the Android application) and the time in hh:mm format, reducing power consumption. In standby mode, clicking the button or receiving new information will switch the watch back to clock display.Step 7: External Structure ProductionYou can manually make a simple package:
You can also download 3D files to make a cool-looking watch:
Of course, you can choose not to wear a watch and make a desktop reminder instead, which is also nice:
Source: Hard Innovation