4 way traffic lights synched with a 1:32 car - Page 1
Forum section: electronics / projects

author: David Araujo
author_rank: Newbie
timestamp: June 23, 2025, 06:44:10 pm
content: I am a 17 year old student trying to make a final project about what i wrote in the title, but I am not experienced enough to make the project by myself, but unfortunately I have to and I can't really find any good videos on youtube about it. So I come here to humbly ask for help. If anybody is willing to help please feel free to ask me anything!https://youtu.be/semY5oEMxXg?si=fz5i_jctPX1a_iBcThis is basically the traffic lights I'm trying to make, (I already have all the components to set them up, I only didn't yet because i dont know the exact measurements of the car I'll use since I'm not sure about what to use yet), but instead of the traffic lights being on a roundabout they'll be one on each road.I didn't find a suitable video for the type of car that I wanted to make, but I basically wanna make a 1:32 diecast/slot/kit (whichever is best) car sync with the traffic lights, and drive like a normal car would but automatically.

author: SteveThackery
author_rank: Super Contributor
timestamp: June 24, 2025, 10:48:55 am
content: Was this project your idea, or given to you?The problem is this:you won't get anyone here to do your assignment for you. That is not how people learn.My concern is this: you seem to be relying totally on YouTube and other people to to show you exactly how to do this project. You are 17 now and just a year or two from university: you should be thinking for yourself about how to make this project work, and not blindly following instructions.You need to start by defining exactly what you want the device to do. This is called the Requirements Capture phase and is important, because you will use it to clarify exactly what you will be building. Don't go overboard, but it is worth writing down the requirements (see the next post). It will help you, and please your tutor.Once you have a complete definition of what you are building and how it will work, you need to start by breaking the project down into small steps, making an attempt at each step. At that point you can come back here with specific questions about things you need advice on.

author: SteveThackery
author_rank: Super Contributor
timestamp: June 24, 2025, 10:58:09 am
content: So, about the traffic lights. Are you going to use the Arduino and software featured in the video?And the car: will it have an on-board battery, or be powered from the road? What ideas do you have regarding controlling the motor? It sounds like you need to send some kind of "go" signal from the Arduino to the car. Any thoughts on how?Will the cars go round in a circle and come back to the traffic lights? Or is it just a case of setting them up in the right position and then driving once through the junction when their light turns green? Do you need a moving car to stop at a red light?You don't need to tell us the answers to those questions yet - they are examples of the kind of questions you should be asking yourself.

author: SteveThackery
author_rank: Super Contributor
timestamp: June 24, 2025, 11:26:53 am
content: One last thing before I step back and wait for the proper experts to join in. I want to ask why you are doing this project. Is it because you've been told to and just want a decent mark? Or is it because you are an electronics and Arduino enthusiast and want to learn something?I ask this because just copying something you've seen on YouTube won't teach you a lot. Especially if you will be downloading and using the software unchanged. After all, at its most basic, what you want to achieve is trivial: when power is applied to a green LED, simply apply power to the relevant car's motor as well. You could probably do it with a transistor and a couple of resistors per car.Is that what you want?

author: bostonman
author_rank: Super Contributor
timestamp: June 25, 2025, 12:25:01 pm
content: QuoteI agree.Sounds like the OP is on the correct path to make a great project for school providing he can find the resources to do the project for him.To the OP: slightly off topic, but it's not always about providing an answer, but how you approach the problem. As an example: if you were in a job interview and asked how many quarters flatly stacked would it take to equal the height of the Empire State Building, the answer isn't X quarters based off asking your phone, the answer is: give me a piece of paper and a pencil.

author: Ian.M
author_rank: Super Contributor
timestamp: June 25, 2025, 02:05:16 pm
content: The four way traffic lights assignment is a staple of many embedded systems and microcontroller courses. I'd bet that most of us that have formally taken such a course at a beginner or intermediate level have encountered it. I did it many years ago, with the added requirement of also controlling a pedestrian crossing and we had to develop it for a minimal Z80 system - so minimal it didn't even have any RAM so all you had to work with were the internal registers! Due to the limited hardware it was near impossible to code it in a structured manner (as without a return stack, we couldn't even use subroutine calls), so I determined the least evil approach was to write a state machine interpreter, thoroughly test it then code the actual logic as state tables. I made it work, including using the INT pin to sense the pedestrian crossing buttons and produce deferred action, even though the Z80 INT flags aren't directly readable, and without a stack, you cant even return from an ISR. Fortunately we didn't have to use actual model cars and there was a class junction with traffic lights model with a defined connector we had to demonstrate our project on, so no model-making or scenary construction was required.Finding a youtube video to help you with the problem as a whole is a long-shot and unless you only use it as a source of ideas and concepts (i.e. don't copy their code or even closely base yours on it) is likely to result in very poor marks or even a complete fail, as many reputable colleges now use strong anti-plagiarism software, capable of detecting copied code even if the student attempts to obfuscate it by renaming variables and routines, or re-commenting the source or changing its layout, and academic dishonesty is typically regarded as an extremely serious offence, with severe penalties.Assuming the four way traffic lights are a set project, I doubt that doing motion control for N cars (or even one car) on a four way junction was a project requirement. If its feature creep you've added, be aware that it would be challenging enough on its own*even with prior experience and several months to work on it, and is likely to be a significant strain on a typical student's budget! As a compromise if you can't back down to the original project specification, and need to extend it for full marks, I suggest settling for sensing the presence of cars (e.g by a magnet in each and hall sensors or reed switches under each lane) and making the traffic light timing adaptive, e.g. if there isn't significant traffic utilising the green phase, any cars waiting at a red light shorten the time to the next lights change. Yes, that means hand-pushed toy cars, not motorised ones!With the above in mind, what are you stuck on, and how long do you have till your deadline?* e.g. if you choose to use a slot cars game as a platform to avoid nearly all the physical model construction, so you can concentrate on adding sensors, control electronics and writing the code, even doing good enough automatic speed control to keep the cars on the track and able to stop reliably at a particular place under microcontroller control is a decently large project in its own right!

author: SteveThackery
author_rank: Super Contributor
timestamp: June 25, 2025, 07:15:26 pm
content: Quote from: Ian.M on June 25, 2025, 02:05:16 pmThat is so similar to my experience! Except we had to control a model railway: motors, signals and points, including detecting where to locomotive was. Truth be told I can't actually remember what micro we used. It might have been a Z80, but my gut says it was probably the 8085 (that being the micro most widely used in our products).We programmed it in assembly, making fairly extensive use of macros to aid readibility and give a modicum of structure.

author: David Araujo
author_rank: Newbie
timestamp: June 26, 2025, 05:24:25 pm
content: Hi, thanks for answering, and sorry for taking so long to reply, this project was basically given to me yeah, and I know that I won't get anyone here to do it for me, I also don't want anyone to, I want to actually learn about eletronics, but I think it would help me a lot to know what other people that know more than me about electronics think about the project and to give me a idea of what to do.The problem is that I don't think I am good enough to rely on my electronics skills and knowledge, so I won't risk buying components and potentially wasting time while trying to do something which I am not sure will work (also because I don't have that much time to make it).Also another problem is that I was stupid as f*ck and wasted almost my entire electronics course (3 years) going to classes and not learning anything because of having bad classmates and not wanting to switch courses when I should (I started liking mechanics way more than electronics when I went to 11th grade but my parents didnt want me to switch courses so I didn't). By the way I'm just saying this for your information, just so you know I don't mean to say this as an excuse or for you to feel bad about me or something 😅.

author: David Araujo
author_rank: Newbie
timestamp: June 26, 2025, 07:28:01 pm
content: So now about defining exactly what I want the project to be, I think I can actually already answer most of your questions,Quote from: SteveThackery on June 24, 2025, 10:58:09 am

author: SteveThackery
author_rank: Super Contributor
timestamp: June 26, 2025, 11:00:58 pm
content: Quote from: David Araujo on June 26, 2025, 07:28:01 pmI hope you've understood that I don't need to know the answers. It's you who needs to know the answers. 😁 👍I do have one question, though. If you are going to use the traffic lights software and hardware in that video, in what way is your task any more difficult than simply switching on the car motor whenever the green LED is lit?

author: CatalinaWOW
author_rank: Super Contributor
timestamp: June 26, 2025, 11:51:09 pm
content: Ditto on the comments on clearly defining your requirementsTwo comments to give you a hint at how important the requirement definition phase is.In the video I see a guy pushing cars around when the appropriate light turns green. If all you want to do is what the video shows then just making the lights turn on and off in the appropriate sequence is all you need to do.There are some interesting nuances in this. In my part of the world these traffic signals do not all operate in the same way. In some locations the green light for the cross directions goes on immediately when the red light for the current direction goes on. In other locations the red light is on for both directions for an interval to assure that all cars have cleared the intersection. There are other variations.Now some hints to get you started on the implementation phase.I would suggest studying the following areas.1. How to turn an LED on and off2. How to assign output signals on an Arduino3. How to create and use timers on an ArduinoIf you are required to make the cars do what the human made them do in the video your task is much more difficult. Because the video shows cars going straight and also cars turning. No obvious turn arrows on the lamp post, but you could obviously add that. But would require learning something about either making or buying lamp displays.