Coder Social home page Coder Social logo

joe-skb7 / libtrl Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 54 KB

C library for controlling traffic lights on GlobalLogic automotive hackathon

Home Page: https://www.globallogic.com/ua/news/globallogic-kyiv-smart-city-hackathon/

License: GNU General Public License v2.0

Makefile 30.78% C 69.22%
c linux debian shared-library makefile libftdi ftdi traffic-light ft232 shift-register

libtrl's Introduction

libtrl

Overview

C library for controlling traffic lights on GlobalLogic automotive hackathon (see [1]).

Hardware design files for traffic lights and interface boards can be found in project [3].

Connect traffic light to your PC like this:

PC -> interface board -> traffic light boards (x10 pcs.)

So by issuing this lib API routines you can switch traffic lights colors (red/green). Basically, when running this library functions, you specify desired color for chosen traffic light number. The whole chain is functioning as follows:

  • User tells to the library which traffic light he wants to set to which color
  • The library will generate correct serial code for shift registers on interface board (for chosen colors on traffic lights)
  • This code will be sent via USB to FTDI module
  • FTDI module works in bit-bang mode, so it will issue corresponding signals to its GPIO lines, sending serial code to shift registers
  • After receiving that serial code and latch signal, shift registers will provide corresponding parallel code on their output pins
  • Each output line of shift registers controls one traffic light: 0V will switch traffic light to green color, 5V will switch traffic light to red color
  • Then each output line from shift register goes to corresponding LED driver, turning "green" channel to one state, and "red" channel to another state
  • This way desired traffic light displays desired color

Hardware files for interface board and traffic light PCB can be found here: [3].

Building and installing

  1. Install dependencies:
$ sudo aptitude install libftdi1-2 libftdi1-dev devscripts pbuilder debhelper
  1. Build and install Debian package for this library:
$ make debian
$ sudo dpkg -i ../*.deb
  1. Add your user to dialout group:
$ sudo usermod -a -G dialout $USER

and re-login after that.

  1. Add udev rules for FTDI chip:

Create /etc/udev/rules.d/99-usb-serial.rules file with next content:

SUBSYSTEM=="usb", ATTR{idVendor}=="0403", ATTR{idProduct}=="6001", MODE="0660", GROUP="dialout"

Now re-load rules:

$ sudo udevadm control --reload-rules
$ sudo udevadm trigger

Now your library is installed and FTDI will work without root privileges.

See example/* for insights on how to use libtrl in your app.

Authors

Sam Protsenko

License

The project is licensed under the GPLv2.

References

[1] https://www.globallogic.com/ua/news/globallogic-kyiv-smart-city-hackathon/

[2] https://hackaday.com/2009/09/22/introduction-to-ftdi-bitbang-mode/

[3] https://github.com/joe-skb7/traffic-light-pcb

[4] https://www.ftdichip.com/Support/Documents/AppNotes/AN_232R-01_Bit_Bang_Mode_Available_For_FT232R_and_Ft245R.pdf

[5] https://electronics.stackexchange.com/questions/7525/how-can-i-control-128-or-more-solenoids

[6] https://www.arduino.cc/en/Tutorial/ShiftOut

libtrl's People

Contributors

joe-skb7 avatar

Watchers

 avatar  avatar

libtrl's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.