Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic hardware setup? #19

Open
sarusso opened this issue Jan 16, 2022 · 14 comments
Open

Basic hardware setup? #19

sarusso opened this issue Jan 16, 2022 · 14 comments

Comments

@sarusso
Copy link

sarusso commented Jan 16, 2022

Is there a way to build a basic version of the circuit on a breadboard using an ESP32 board (e.g.
ESP32-DevKitC) and a L298N board without (much) extra components?

If so, would it be possible to add a schematic to the README? I am not expert enough in electronics to extrapolate it from the PCB layout...

@positron96
Copy link
Owner

Hi. This is possible, but I don't fully understand to what extent you need the schematic. There are no ready-made LocoNet boards that can be hooked like an L298 board. So you can either:

  1. Implement LocoNet on a breadboard. Not too difficult, but requires bare electronic components and ability to read the schematic.
  2. If you only need WiFi+DCC without physical LocoNet bus, you'd need to strip the code from mentioning physical LocoNet.

Also, the readme contains the link to PCB project on oshwlab, it contains full schematic, not just PCB layout. Does it help?

@sarusso
Copy link
Author

sarusso commented Jan 17, 2022

Yes, it does help, thank you. I was hoping to be able to stick together with some jumper wires an ESP32 evaluation board, a L298 board, and have a WiFi+DCC control station without needing any extra component at all.

So it was more around point number 2, but it probably requires too much work to strip LocoNet from the code, introduces too many things that can go wrong in the process and it is not the purpose for this project in any case.

I still cannot find an entry-level project which can give me a DCC command station running on an ESP32 with little hardware setup to get started, and I found this one along the way which I did not frame correctly.

Thanks for your support :)

@positron96
Copy link
Owner

Well, I've tried to make code modular, so stripping physical loconet shouldn't be very difficult. I may try it at the weekend or so.

Also, what WiFi do you need? You might want to try Arduino with Dcc++ firmware, an l298 board and a esp8266 module with withrottle firmware. That will give you wiThrottle protocol for DCC.

@sarusso
Copy link
Author

sarusso commented Jan 17, 2022

Thank you for the hint, but at the moment I don't have an Arduino.

I am not sure why people keep using Arduino for this stuff while an ESP8266 could easily do everything by itself and it is way more powerful and even cheaper to some extent, not to mention the ESP32.

My intention would be to build a set of REST APIs around some implementation of a command station, which I can then in turn use from another system, and the idea would be to use a single micro (i.e. an ESP32).

@positron96
Copy link
Owner

So, you can try this branch: https://github.com/positron96/LocoNetControlStation/tree/no-loconet-phy

I've removed literally 4 lines of code and the firmware will now work without LocoNet hardware (hopefully).

@positron96
Copy link
Owner

Also, I don't know if it's ready for use, but this project might also be of interest: https://github.com/atanisoft/ESP32CommandStation

@sarusso
Copy link
Author

sarusso commented Jan 28, 2022

Thank you @positron96!

I will give a try to the branch over the next couple of weeks. Is the Sense - 36 pin mandatory or just to detect shorts? Also, should I just be able to connect the a motor shield directly to the Data - 25 and Enable - 32 pins, respectively to "PWM" and "enable" pins on the motor shield, and that's it? no extra HW components?

Thank you very much!

p.s. yes https://github.com/atanisoft/ESP32CommandStation is very interesting as well!

@positron96
Copy link
Owner

Sense pins are for load and short detection on main track and for reading CVs on programming track. If you don't want to bother or your motor shield does not have them, just connect them to ground.

I'd assume that a motor shield has 3 input pins for an output - PWM (En), IN1 and IN2. For DCC IN1 and IN2 must always be of opposite polarity, and so only one signal is output from ESP32 (data). The other one needs to be created via extra circuit, e.g an inverter IC or a simple transistor like this:
image
(image from ESP32CommandStation project)

@sarusso
Copy link
Author

sarusso commented Feb 1, 2022

I have two motor "boards" actually, one is in the configuration you assumed, the other one is the standard Arduino motor shield which has no IN1 and IN2 but just IN. I'll try a few things and let you know. Thanks!

@positron96
Copy link
Owner

If it has a DIR and a PWM pin, then you don't need an inverter and just connect DCC DATA and DCC EN to them

@alsacian
Copy link

Yesterday I changed for my project the main code and keeped only dccmain with D1 mini ESP32 and L298N chip on small PCB.
I put the schematic soon.
main.txt

@alsacian
Copy link

Here is the schematic
Schematic_DCC ESP32.pdf

@positron96
Copy link
Owner

Thanks for sharing that! Was it nesessary to add a low-pass filter on current sense?

@alsacian
Copy link

Not really, but I had some overcurrent spikes when turning power on. I think bad ground on my prototype.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants