× Info! This project is in progress! It is updated regularly!
By F0cks 13 April 2018. Updated: 14 May 2018.

Description

I had the big idea to create a board that integrates GPS and GSM modules. To debug it, I need to take my car, put a computer on the passenger seat and take a ride. It's already constraining to use a computer in a car, but it’s a real pain on a motorcylcle!

This project has already some... years of delay... So I need to create really quickly a DATA logger that records DATA coming from my board UART. Key functions are:

  • Record DATA coming from an UART
  • Display DATA coming from an UART
  • A few hours of autonomy
  • Being able to easily recover DATA on a computer
motorcycle-monitoring

Motorcycle monitoring looks like that...


My mother and my gf often complain about all this electronic mess I preciously keep "in case of". "You'll never do anything with all those old boards"... This is an opportunity for me to prove them wrong ♥ and also to recycle old projects!


Components

Main board: Raspberry Pi B+

I nearly have all Raspberry Pi models in my stuff. I need the one that uses the less amount of power among models that have at least 2 USB ports: a Raspberry Pi B+. Mine is probably comming from Adafruit.

This board has 4 USB ports. I only need 2 of them: one for the serial communication, the other for the storage. Its no load consumption is around 1W, the best power consumption for Raspberries with more than 1 USB port.

In addition, there is an Ethernet port that will make programmation easier: no need to set and use WIFI. A Pi is clearly oversized to do a simple data logger: 700MHz processor, 512Mo RAM, Raspbian OS. File management and display will be easily and quickly done. GPIO pins allow different kind of communications like SPI. I will use this one to set a touchscreen.

RaspberryPiBPlus

Photo Adafruit: Raspberry Pi B+

Display: Touchscreen PiTFT 3.5"

I have found a touchscreen PiTFT 3,5", also bought from Adafruit, which did not really serve much...

This screen will allow me to take a look to UART frames that I am recording. I will also be able to print informations / errors etc.... Touchscreen will be used as button to exit from screensaver.

No crazy characteristics. It's a 3,5" 16bits screen in 480x320 coupled with a resistive toucscreen. The whole thing can be plugged in directly on GPIO ports to use SPI.

PiTFT

Photo Adafruit: PiTFT 3.5"

Serial communication: USB to TTL serial cable

To vary things a bit from Adafruit, I bought this one on Farnell.

As touchscreen will use all GPIO space, and as I can't be bothered to solder small wires on Raspberry UART pads, I will use an USB to TTL serial cable. It will allow me to convert monitored board UART into Raspberry communication port.

FTDICable

Photo Adafruit: USB to TTL serial cable

Power supply: Solar PowerBank SPBS 5000 B2

What a coincidence! I need to do something quickly and I see this Lidl ad: a solar charger which contains a 5000mAh battery. Deal! I rush to Lidl, the wrong day, I rush again 3 days later and voila! A great battery for my project.

Obviously, solar pannel is useless here. But this power bank has a nice option: power supply is turned off when the current consumption is under 60mA during 10sec. It will do the work for us! (Reminder: RaspberryPi still consumes a litte amount of power even turned off. It can't cut itself its own power supply). It also has a ON/OFF switch allowing to turn it back ON. No more need to connect and disconnect the USB cable with the risk to break the µSD card.

PowerBank

Solar powerbank SilverCrest

Storage: USB stick

Finally, the last but not the least component of this project: an USB stick! This time, I am not able to tell where this one comes from...

Nothing special to say, this is an 8Go USB stick from Verbatim, the nano model. DATA will be stored on it. I will only have to plug it on my computer to check easily hours of DATA logging!

USBFlashDrive

USB stick Verbatim

Realization

Assembly

While I was assembling the Raspberry with its screen, I have noticed a big space between them. Especially by removing an unused connector under the screen. A volume of 50x65x10 is free to used. Not a big free play for the thickness, but length and width can be a little bigger. So, I have bought a lipo battery on Ebay : 5000mAh 55x75x10 to make the system more compact by removing the big solar power bank. There is a built-in protection circuit prevent over charging/discharging and short circuit etc... Protections that I will test carefully (made in China...). I will only need to add a little boost and a lipo charger. "I will" "I will" "I will" ... When I have more time!

modif

Screen customization

assemblage

Free space after assembly

battery

Lipo battery 5000mAh

Programming

Foremost, I have written Raspbian Stretch Lite image on an µSD card (8GB class 10). Then, I have done essential operations through SSH:


I have created a code in python dataLogger.py in the directory /home/pi. It is automatically executed when Pi user logs in:

echo "python /home/pi/datalogger.py" >> /home/pi/.bashrc

How does my code work?

  • At the beginning, HDMI and LEDs are stopped to save a bit of power
  • Software waits until an USB to TTL serial cable is connected. If no cable is detected during 60sec, the raspberry shuts down
  • It waits until an USB stick is plugged in
  • It creates a file data_X.log where X is a number that is incrementing if a file already exists. Dataloggin starts
  • UART frames are displayed on the screen and recorded in the file
  • Data logging stops when communication cable is disconnected. USB stick can be safely removed
  • Software waits again until an USB to TTL serial cable is connected. If no cable is detected during 60sec, the raspberry shuts down
  • Etc...

In another thread, screen is turned off automatically after 15s. To turn it back on, touch screen needs to be pressed

Power consumption

Capacity of power bank is 5000mAh. Actually, this value is only for the lipo battery inside at 3.7V. However, powerbank output is 5V! I take a big margin and guess that boost (that converts lipo voltage to 5V) efficiency is at least 80%. Remaining capacity is 4000mAh.

When screen is turned off, current consumption is around 420mA. So, system autonomy is around 9,5h.

Thanks to the software, screen saver is set after 15sec. System now only consumes 260mA. The new autonomy is around 15,4h. We have earnt nearly 6h!

normal

Power consumption in normal operation

screensaver

Power consumption screen off

Gallery

custom

Screen customization

assembly

Assembly

final

Complete system


normal

Power consumption in normal operation

screensaver

Power consumption screen off

moto

The beast I ride for data logging


motoSetup

Setup on motorcylce

motoSetup2

Display on motorcycle


Soon

At this time, I have a system that takes up a bit of space (much less than a computer) but which is functional! The next step will be to fix it on the motorcycle (like a GPS) and start data logging!

I find this system very convenient. It has sufficient autonomy for most of my projects and a computing power that will even allow me to do live processing! As soon as I can, I kick the power bank out of this data logger to put the battery ordered on Ebay.. I only have to create a board with a boost, a lipo charger and an automatic cut off system. With a case made with a 3D printer or with plexi parts, I will have a powerfull data logger!

final2


Comments


Leave a comment: