• EUR€
  • £GBP
  • $USD

DIY LattePanda Time Server

DFRobot Feb 07 2018 973

This content is created by Sang Yong Lee


I had the proximity sensing project using LattePanda on the last post. This time, I produced a time server to interlock with the whole house.

It is to synchronize the time on all the devices that use time and send the data to the main controller by the accurate schedules.
In the first part, we will talk about the basic circuit composition and the coding. Below are the description of the equipments and the main features.
* Please note that the file (which is given by the manufacturer) with a little bit of change in Android source (Android studio) and Arduino source are attached.
* In the second part, I am planning to do a project on logging in LattePanda as a time server and changing the time in OS

The roles of each component 
1. Controller: Arduino Bluno Nano
·The main feature: Parse the data received from GPS to get the current time and send the data to the equipment paired with Bluetooth
·The format to send data: json
·Transmission cycle: 1 sec
·Exception handling: If the reception for GPS is not smooth when using RTC(DS1307), use the time of RTC, if GPS works fine again and can get the time, record it on RTC every hour on the hour

2. GPS Module: GPS Module with Enclosure
The most difficult part when making it yourself is the case! However this product provides it, so it is very convenient

3. RTC Module: self-production (DS1307), Use the date and time when you can't receive the GPS signal

4. Display: OLED 0.96" White (SSD1306) to check the status 

5. Temperature/Humidity: DHT22

6. Battery: Lithium-ion 2.3A 4Sx3p = normal 14.8V (buffer 16.8) =  6.9A =  102W = If you calculate it with the 80% efficiency maximum, it is 81W in total

7. Operating hour: current consumption: It is approximately 80mA (0.4W) so, 81/0.4 = 204 hours (Around 8.5 days) => Expect approximately 7 days with every full charge 

8. Data output: Output data every second as a format as below. Use abbreviation in order to minimize the length of the data since the speed is 9600
   Format: json

9. Android Client: Correct the example code provided by DFROBOT and test (You can download it on the Wiki page)
(Whole composition - There is no order in production because it is composed on Bread Board)


(OLED) Information display 
    10-05  : Month-Day
    25.5c :  Temperature
    40.2%: Humidity
    GPS(5): Receiving GPS, the number of the satellites 5
    LNG: 127.125045 : Display LAT, LNG
(PPS) LED for checking: For checking the status when the controller and GPS Module are near the window or outside

Product Features
1. Controller details: Arduino Bluno Nano
   Detailed information is provided on Wiki
   ·MCU: ATMEGA328
   ·Boot loader: Uno 
   ·Bluetooth: Support TI CC2540, HID and support Beacon 
   ·Communication distance: 20M
Example code: Both Android and iOS provide the source. You don't need to try to find examples to test the interlock with Bluetooth. You can also program with BLE.
  * Cautions: Since Bluetooth Module uses D0, D1, disconnect the paring for programming because if it's paired with Bluetooth, the programming won't work. You can find the description about the pin map on Wiki. However there is no AT/NORM changeover switch like right down in the photo, in the product I received.

2. GPS Module details: GPS Module with Enclosure 
   You can find the detailed information on Wiki.
   ·1Hz: It means the data is output every second.
   ·56CH receiver:
   ·5v 30mA ( 3.3~5 )
   ·161dBm antenna
   ·The first actuation time (1 sec ~ 29 sec)
(The pin map is very simple. You only need to use GND, RX, TX, VCC.) 


Fortunately they provide the case. But assembling is a little bit difficult. There is also some magnet.


3. Battery: Lithium-ion 2.3A 4Sx3p = Normal 14.8V (Fully charged 16.8) =  6.9A =  102W = If you calculate it with the 80% efficiency maximum, it is 81W in total


4. Operating hour: current consumption: it is approximately 75 ~ 86mA (0.4W), so 81/0.4 = 204 hours (Around 8.5 days) => Expect approximately 7 days with every full charge


5. Android Client: Correct the example code provided by DFROBOT and test (You can download it on the Wiki page)


When you make it yourself, I think the most difficult (?) part is the case. You can solder it as well as you want, but it's practically hard to get an equipment, because you need to use CNC carving machine or a 3D printer for printing out.
It is a great product since the size of this Bluno Nano is very small and even there is Bluetooth almost as small as Arduino Nano.

How to set up Bluetooth:void setup() {    Serial.begin(115200);               //initial the Serial } void loop() {    if(Serial.available())    {        Serial.write(Serial.read());    //send what has been received    } }

1. Put the code above and put 115200, no line editing. Then you "send" +++ and if you receive Enter AT Mode, you successfully entered the AT mode.
2. You can change it to Both NL & CR and then enter commands.
3. Enter AT+ROLE=? and "send" it, you will receive ROLE_PERIPHERAL.
4. AT+UART=115200 is to change the speed.
5. Check Mac Address: AT+MAC=?
6. Finish AT mode: AT+EXIT
7. Check the version: AT+VERSION=?     It says 1.97