You are browsing as a guest. Sign up (or log in) to start making projects!

tiydwe

@tiydwe

Joined August 26th, 2026

  • 21Devlogs
  • 2Projects
  • 0Ships
  • 0Votes
hi :)
Open comments for this post

3h 14m 12s logged

Now roads can be drawn and it’s looking cool!

As you can see in the recording, without drawing the roads, the cars just stop at the intersection because they cannot find any routes (gaps between roads are intersections, I’ll fix that later). By drawing a road, the cars can drive to their destination in the simulation.

The biggest issue I had while coding this was mixing up physical IDs and internal IDs, which are not interchangable (I should have probally used a class or struct to represent IDs instead of a raw size_t).

Next, I’ll work on making the intersections look better and maybe get some statistics on how well the cars preformed at the end of the simulation!

0
0
77
Open comments for this post

1h 32m 6s logged

Added some player controls and separated the editor window and simulation window.

As you can see, the simulation now works okay and can be changed to 3 different speeds. I haven’t done too much, but next I will probally fix the roads meeting at the intersections.

0
0
15
Open comments for this post

5h 47m 20s logged

I know it doesn’t look like much, but this represents a lot or work and progress.

I spent almost 6 hours to refactor my code to use a much cleaner ownership system that should completely prevent memory leaks and have much better separation of the static parts of simulation vs. parts that area ctually getting simulated.

In a nutshell, what I did was make two classes, Layout and Simulation. Layout always exists and is the thing that is drawn on screen. Layout doesn’t have any cars or moving stuff and you can edit layout. When you start a simulation a NEW simulation object is created with all the cars which can simulated it. The clean split makes it a lot easier to know everything and edit/save stuff which might be usefull later.

I had to do a lot of changing and if you look at the git commit basically every file was modified, but now the architecture is much cleaner.

Next, I’ll work on adding the Simulate button and making a new window show up with the cars to simulate it.

0
0
43
Open comments for this post

3h 15m 56s logged

Made some progress, but then decided to revert back to yesterday

So now I know why smart pointers are discouraged! So my ownership model was really screwed up and super confusing and I had some crazy memory problems and segmentation faults so I reverted back to yesterdays commit and am going to refactor the code to use SMART POINTERS (wow) and have a better ownership model.

I feel pretty sad that I basically made no progress with 3 hours of work but I guess I learned something?

SO the new plan is that Layout class will handle all things that are static in simulation and are just there (roads and intersections, both physical/logical) and Simulation will only handle all the cars and driving around. The EditorWindow class will have a pointer to (but now own) Layout so it can modify Layout but not Simulation. The SimulationWindow class will have a smart pointer to (and own) a simulation (fresh) and PhysicalCar s. This should help clarify ownership and prevent memory management issues.

0
0
62
Open comments for this post

5h 6m 2s logged

More visuals (multiple roads + intersection support) and LOADING PRESETS!

I had to refactor a bunch of my code to use stuff allocated on the heap because I, stupidly, decided to initialize a bunch of my objects on the stack in a loop, causing a lot of the pointers to become hanging. Oh well, now I just have to make sure to remember to delete the allocated objects.

Some plain and dirty presets can be loaded and the textures look pretty bad, but it will look a lot better pretty soon. I’m going to work on adding the first player interaction: allowing the player to add a road by clicking twice. I expect this might be a bit hard and school’s starting so it will probably be a while before I post another devlog (depending on how hard it is for me to add it)

I also might try to get the road offsets and intersections better so it is more playable.

0
0
11
Open comments for this post

4h 26m 32s logged

Got some real visuals going!

It’s a bit messy but if you look closely you can see the car follow the road (that road is supposed to be a 4 lane road but I didn’t draw it), switch onto a lane on the side, and keep accelerating. The framework has been built to easily expand to different types of roads like one way, 2 lane, 4 lane, etc.

Next I’ll start working on getting the car to transition at intersections and finish the simulation portion. Then I can get started on working on the player interaction part!

0
0
43
Open comments for this post

2h 15m 10s logged

Finally got the cars to be a little bit intelligent and traffic lights to actually work

Traffic lights

The traffic lights now enforce lane rules (cars must be on a certain lane when light is green to go to the next lane). The traffic lights are also auto generated in a bit of a “dumb” way. The traffic light just gives turns to each incoming road to go wherever they want and all other roads cannot go. Later, I might allow valid right turns, but that’s a problem for later.

Car pathfinding

Although I haven’t implemented the BFS search for the cars, given a route cars will now look ahead to the next intersection and randomly auto merge onto the lane (the cars are more likely to merge when they are closer to the intersection). This is to make sure that cars won’t all merge at the same time, which would be weird.

0
0
19
Open comments for this post

9h 34m 20s logged

Started my new video game, JAM

JAM is a puzzle video game about solving traffic jams! I don’t have much experience writing video games so this will be a first for me (although I have plenty of regular c++ experience). So far I’ve just written the very very basic car driving logic and have it printed out to the debug console (I plan to add actual graphics once core logic is done).

Currently I’ve got simple one-lane roads working and some really stupid intersections, but I’m working on multi-lane roads, merging, traffic light schedules, and cars actually waiting at intersections!

0
0
17
Open comments for this post

44m 1s logged

Changed all holes to non-plated and looked around for cheapest PCB options!

I just realized that my mounting holes for the OLED were plated for some reason which was totally unnecessary.

Additionally, I looked at JLCPCB, PCBWAY, and OSHPARK, and found that OSHPARK had the cheapest PCB (although it will take like 2-3 weeks to arrive, hope the PCB doesn’t have issues because I won’t have time to iterate before the deadline).

Last thing I did was I found a entry in the BOM that was accidently left there from an earlier revision (some screw terminals) and removed them.

0
0
9
Open comments for this post

1h 48m logged

Why is the documentation so bad?

I just can’t seem to find any documentation or clear way to wake up from a GPIO pin going HIGH! I’ll have to do some more digging to figure it out.

Besides that, I worked on the sensor and OLED code and its mostly finished. I think that I’m making some pretty good progress. Just got to figure out how to fix sleep.

Also I updated my PCB a bit because I didn’t realize it’s not a good idea to put two BJT transistors in parallel for different signals and I just used another control pin on my nrf52840. That did mean adding two more SMD resistors but they are pretty small and didn’t take up any additional space.

0
0
19
Open comments for this post

51m 39s logged

Finished the screw holes!

I used a nut retainer and one screw to compress the two halves of the case together with the PCB inside. I made sure to put the correct tolerances so the PCB will be the first thing compressed against. I’m using 4 M2 hex screws.

There isn’t much more stuff I can do until my funding (hopefully) gets approved and I can get the PCB and components. Then I can put everything together and fix any issues that come up.

For now, I’ll continue working on polishing it and double-checking my cad and PCB to make sure everything should work.

0
0
15
Open comments for this post

38m logged

Case and calibration procedure starting to take shape!

I’ve cadded the top of the case to fit into the bottom! You can see how there are there are two holes on the top for the OLED screen and the on/off button and a slot in the front for the sensor portion to come out. The current size is 32mm x 36mm x 88 mm. It’s a bit larger than I imagined it, but still easily handheld. I’m still working on the screw holes and nut retainers and polishing the case. I’m sure there will also be plenty more changes when I get the parts and find out how they all fit together.

Additionally, I’ve figured out how to easily calibrate the sensor. So basically, you first calibrate at 0 amps and turn the reference screw until the output is 0. Then you put a known current and tune the sensitivity screw until the read current is the known current (or the known current times a certain multiplier).

0
0
9
Open comments for this post

1h 59m 1s logged

Finished the PCB design!

I finished routing everything and checked to make sure it looks okay. I also finished my BOM and have a pretty good idea on how the rest of the project will go. I think I’ll try to submit for funding today and I’ll continue working on the casing design too.

I’m also struggling to keep the size small enough to be comfortably handheld because the way its looking right now it looks like it might be around 4cmx4cmx10cm and i want to try to get that down to 3cmx3cmx3cm.

0
0
13
Open comments for this post

1h 35m 10s logged

Just discovered trimmer potentiometers!

I can’t believe that I wanted to swap out through hole resistors before! Now, I’ll be using two trimmer potentiometers, one to change the sensitivity of the hall effect current sensor and the other to change the reference voltage.
The schematic shown here still has a few issues (VR2 has too wide of a range). I’ll also need to redesign my PCB and this time I’ll be using all SMD resistors. I don’t trust my hand soldering skills enough to use 0402 sizes, so I’ll be using the larger 1206 footprint.
Other changes include changing the op amp configuration to an instrumentation amplifier, using a new op amp chip with 4 op amps (although I’m only using 3), and adding another transistor turn of ALL the power (except to the microcontroller) while the sensor is off.

0
0
8
Open comments for this post

19m 36s logged

I changed the op amp!

I realized today that I was using a 50 year old op amp! 50 years?! I should be able to get a op amp that’s cheap, faster, has lower noise, and is rail to rail! I found a new op amp, the COS8092SR, which features:

  • 300 MHz gain bandwidth product
  • 9nV/√Hz input voltage noise density
  • 200 V / us slew rate
  • Almost the exact same package (actually smaller)
  • Rail to rail operation
  • And just 30 cents apiece!

I’ve updated that and I’ve finished up my BOM.

0
0
9
Open comments for this post

39m 36s logged

Just started my physical CAD for the casing!

I started cadding the casing for my hall effect current sensor! The hardest thing about it was making sure the battery could fit while fitting the mounting screws. It was a pretty close fit but the screws shouldn’t need to bear much load so hopefully they don’t break the 3d print. I spent around 20 minutes trying to fit the screw holes in a way that looked okay and shouldn’t intersect with anything on the PCB.

Then I realized that I wanted the top part to interlock with the bottom, so I added a small slot around and thickened the walls so the slot could fit. I also had to make sure to leave space for the hall effect sensing circuit could come out.

I’m trying to keep this as small as possible that way this can be some kind of handheld device.

Next time, I’ll continue to work on the top part of the container and polish it up.

0
0
31
Open comments for this post

44m 1s logged

I almost fried my seeed studio microcontroller!

Well, kind of. I forgot to put a resistor divider between my 5v op amp output and my 3.3v seeed studio nRF52840 microcontroller. I’ve now added two SMD resistors to the underside of the PCB. It’s getting really tight in the pcb (just look at the traces), but I really don’t want to make it any bigger.
I forgot to say from last time, but I also added a on off button (how did i forget that?), some mounting holes, and a BJT transistor to actually turn off parts of the circuit when in sleep. I think I will start modeling the case for it no because most of the elements in the PCB are done.

0
0
29
Open comments for this post

3h 10m 1s logged

Big changes to the hall effect current sensor! I’ve added a microcontroller and screen to display measured values directly! I’m using a Seeed Studio nrf52840 microcontroller. I also decided to add a battery to the back to make it a standalone sensor. I’m not actualy sure if there are lipo batteries small enough to fit and not get in the way of the screws, etc so I might have to use coin batteries. There shouldn’t be much more to add to the PCB I think so I will probably start working on the casing, which I’ll 3d print.

0
0
20
Open comments for this post

54m 3s logged

I’ve decided to switch over to a smaller surface mount op-amp. It has higher gain-bandwidth product, lower noise, higher slew rate, and a smaller footprint. I’m working on miniaturizing the circuit so it is smaller and easier to use. I still want to use through hole resistors so the gain and reference voltages are easier to tune.

0
0
11
Loading more…

Followers

Loading…