element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products & Partners
    Products & Partners
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
    About the element14 Community
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      •  Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Arduino
  • Products & Partners
  • More
Arduino
Blog An Arduino/Raspberry Pi Based Wireless Light Harness
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: screamingtiger
  • Date Created: 11 Jun 2015 1:17 PM Date Created
  • Views 7893 views
  • Likes 3 likes
  • Comments 76 comments
  • wirless_trailer
Related
Recommended

An Arduino/Raspberry Pi Based Wireless Light Harness

screamingtiger
screamingtiger
11 Jun 2015

I am going do this small side project as a way to take a break from my main project.  For a basic introduction please see my original blog post at http://www.element14.com/community/people/screamingtiger/blog/2015/04/20/a-small-project-idea--wireless-trailer-lighting-control

 

If anyone has concerns about my project, please post them in that thread.  I have changed the design slightly after doing  some research and testing.  I am also going to have a control panel in the car with me so I can monitor things as well as manually test the lights.

 

The car has running lights, brake lights, and turn signals all on separate channels.  However the trailer lights only have 2 channels as the running lights also function as turn signals. My initial analysis was incorrect that the running lights also function as brake lights.

 

First a tentative parts list and then I will explain.

2X Arduino mini pros 16mhz boot loader

1X Raspberry Pi model B

1X 2.5" TFT touchscreen LCD

1X 4 channel mechanical relay

6X AMS1117 SO-223 5V regulators

3X NRF24L01+ wireless transceivers

1X 1.5 watt solar charger

3X enclosures

1X 20,000mAh (20Ah) 12V lead acid battery

1X hobbyking 5V/5A regulator

1X 1000 mAh 2s LIPO

 

Explanation of parts :

There are 3 units involved. We have the unit that reads the car's lights, the unit that controls the trailer lights, and the unit that acts as a control panel.  All 3 are connected via the wireless adapters.

 

2X Arduino mini pros 16mhz boot loader

These will be used for the units that read the lights and control the trailer lights.  I have some of these on hand is why I went with them and the small footprint will allow me to tuck it away nicely.

 

1X Raspberry Pi model B and 1X 2.5" TFT touchscreen LCD

This will function as the main control panel with a simple interface.  The Pi attaches easily to the LCD which is why I chose this route.  Its way overkill but I feel it will be useful for other projects that also need a remote or control panel.  The control panel will allow monitoring as well as manual control of the lights for testing.

 

1X 4 channel mechanical relay

The stock lights on my trailer pull 2A for the brakes lights per side, and 500 mA per side for the running lights.  Originally I was going to use a mosfet but I see no reason with this high of current.  The brake lights will be turned on at the same time so the relay will see 4A.  However the running lights will be on separate channels as they also function as blinkers.  The 4th channel I may use to turn on internal lights in the trailer remotely.

 

6X AMS1117 SO-223 5V regulators

These small regulators will be used to power the Arduinos off of the main 12V sources which come from the vehicle as well as the 12V battery in the trailer.  They are also used to read the  vehicle lights.  My plan is to splice into the lines of each light the same way I did before when installing an off the shelf light controller.  The lights will be routed to the 5v regulators which then step down the voltages to 5V for reading via the GPIO pins on the Arduino.  I will need 4 regulators to read the lights.  1 for the brake lights, 1 for the running lights, and 1 each for each turn signal.

 

3X NRF24L01+ wireless transceivers

These 2.4ghz transceivers are similar to an I2C connection and a serial connection combined.  Each one has an ID and you can broadcast information. I will have a small protocol in place for error correction as well as some minor tamper proofing.  I don't want a rogue 2.4ghz signal to be able to mess with my lights.  I will be using a command set that requires a sequence of bytes in order to validate commands.

 

1X 1.5 watt solar charger

These can be had from Harbor Freight and low cost.  I decided that the trailer might as well be "green" and charge its own battery.  Besides its just another thing for me to forget to do.

 

The rest of the items are self explanatory and used to house the items and power the Pi.

 

I may choose to get some LED based trailer lights, but I am going to stick with the stock trailer lights for now until I have a working project.

  • Sign in to reply

Top Comments

  • mcb1
    mcb1 over 11 years ago in reply to screamingtiger +3
    Joey Did you remove the jumper .. JD-VCC to VCC ? You apply the 12v to JD-VCC NOT THE VCC PIN The 5v on the VCC pin is to power the Optocouplers ... Also note that these turn on with a LOW so you need…
  • Robert Peter Oakes
    Robert Peter Oakes over 11 years ago in reply to screamingtiger +2
    80mA for Arduino and 1A for lights adds up to 1.08Amps, not 1.8. This would provide a much longer life time (18.5 Hrs) so even with brakes you should easily get 10-12 Hr (Unless you're a heavy breaker…
  • clem57
    clem57 over 11 years ago +2
    Totally amazed is the word today. Plus a tropical depression has taken over here. LOL
  • screamingtiger
    screamingtiger over 11 years ago

    99% of my code is working.  I am attempting to have a "heartbeat" go back and forth so I can monitor things however it is causing issues.  If the receiver (trailer part) never tries to send data back, it work 100% perfect!  As soon as I have it trying to send back things go crazy and I have issues.

    I will be making a video shortly.  If someone wants to inspect my code who knows how to use the nrf24l01 I would appreciate it.

     

    Also, I tested my new LED lights.  Before the running lights used about .5A (500 mA) each and the brake lights used 2A (2000 mA) each.  For a total of 5A when all lights are on.

     

    The leds pull .1A (100 mA) and .15A (150 mA) each.

    The savings for the running lights is 500%.  The brake lights even more but I don't count them too much since they aren't used for long periods of times.  However 300mA compared to 4A is crazy.

     

    So to revisit my "run time"

    Battery Capacity: 5 Ah

    Running lights: .1A

    Arduino: .08A

     

    Total:  .18A

     

    Running time in hours = 5/.18 ~ 27 hours

     

    The little charger I have puts out 24V at 1.5W ~ .06A

     

    There will be some additional power pull from the relay switch etc.. but I think it will be negligible.

    Keep in mind my 5Ah battery is very small, and I can easily use a 18Ah battery for 100 hours runtime if I assume the running lights are on all the time, which they are only on at night.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • screamingtiger
    screamingtiger over 11 years ago in reply to Robert Peter Oakes

    Peter since you have used these so much let me ask you a quick question.  I have two units, one is a sender the receiver.  The sender sends a sequence of 3 bytes which means "heartbeat check".  The receiver is in fact getting all 3 bytes as expected.  It then sends 1 byte back to tell the sender it is ok.

    The sender intermittently gets the byte, maybe a out of 10 times if that.  Sometimes it gets it 3 times in a row correctly, then it will have a long string of timeouts which I have used 100ms to 500ms as a timeout.

     

    If I switch the hardware roles around, the exact same thing happens so it is not an hardware issue.  The receiver before is now the sender, sending the 3 bytes it does it everytime.  This proves to me that both are capable of sending and receiving data just fine.  Its just when I have them switch roles for a second to send data the other way, it starts acting funny.  It does in fact get the correct response from the receiver but I need it to be every time.

     

    I can upload my code if you like but I wonder if you might know why it does this.  I've been messing around adding delays in the code to give each time to switch roles between listening and writing but it does not seem to have an effect.

    I'd like to point out the receiver, when it sends it check value back, always thinks it succeeds and the radio.write function always returns success.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Robert Peter Oakes
    Robert Peter Oakes over 11 years ago in reply to screamingtiger

    I have used the NRF24L01's on many projects including the last Xmas challange. they work quite well and are fairly easy to use in my experiance. The only down side is limited range but in your case that should not be a challange

     

    an alternate that is easy to use and which could actually run the entire thing even without an arduino is the ESP WIFI modules. there inexpensive and some have enough IO to do what you need

     

    see my friends website for details

    http://tech.scargill.net/

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • screamingtiger
    screamingtiger over 11 years ago

    A quick update, its working!  I found this fork of the code in this post from someone with the same issue:

    http://forum.arduino.cc/index.php?topic=230681.0

     

    I also killed one of my arduino pro minis (clone) when the ground wired came loose and swiped across the AVR pins, heard a nice sizzle sound.  I took the capacitors off the board and put them on the +/- pins of the power on the transceiver.  It made a huge difference.  So once I get my mount boards I think I will be ok with any noise from the car's electrical system.  I plan to put filter caps on any 12V sources coming from the car.

     

    void nb_sleep(int d)
    {
            long s = millis();
            while(millis() - s < d);
    }

     

     

    For the record, I do not plan to have a delay or sleep in the code.  I just wanted to test the code with long delay of no transmissions.  I do plan to use a timer though to send a "heartbeat" pulse like I am dong for my QuadCop project.

    In theory, I could go down the highway for hours and not need to send any changes to the trailer because I am not using brakes or flashers etc..

     

    Now the link is stable, time to write my handshake and command protocol.  I will be using the same one I used for my I2C connection I am using on my QuadCOP project.

     

    GOOD PROGRESS!!!

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • screamingtiger
    screamingtiger over 11 years ago in reply to mcb1

    I am hoping I don't have any delay with the brake light, I am at the mercy of the wireless link.  In theory once setup right, it should be ok only having to XMIT a meter or two.

     

    I also noticed on the road today a trailer with only 1 set of LEDS on each side.  Each LED strip did all 3 functions, running, brake and turn.  Interesting, when in running mode the running lights flash for signal, and when in brake mode the brake light flashes.  The leds are dimmer for running and full power for brake.

    Apparently it is whatever works!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
<>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2026 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube