|
Post by g3750 on May 19, 2022 14:44:37 GMT
Updated 5/18/2022: While it doesn't look like it, there has been some progress made. - About 350 lines of C code have been written for the Open Hearth (so far), not including comments.
- I've created a table of activities and timings for each of the four furnaces.
- I continue to investigate sound libraries and sound effects for the mill.
- Watching a lot of YouTube videos on the Arduino, relays, and C programming. Although I've written code in 20 programming languages over my career, this is my first foray into the C language.
- Ordered and received a long cable for connecting my development PC to the Arduino, which is now installed inside the mill along with the first relay board, and a small breadboard.
- Got one of the smokestack lighting circuits working. Ordered and received some additional circuits for the smokestacks (I fried one ).
More when I know it.
George
George
|
|
|
Post by g3750 on May 22, 2022 0:51:41 GMT
Updated 5/21/2022: Every so often, you have to go backwards to make some forward progress. Here's last week's roundup of activities: - As you may know, there are 4 furnaces in my Open Hearth model - #11, #12, #13, and #14. The plan is to have each animate a different set of activities in the Open Hearth process. The animations are carried out on an Arduino MEGA 2560 processor running a C program I am writing. To date, I have finished the bulk of the Furnace11 code (at least the logic for invoking the relays) but I'm not particularly happy with it. It’s convoluted. I’m leaving the MP3 player logic until later.
- I then moved on to try writing the Furnace13 code which is the most complex. Keeping track of the “{“ and matching “}” (in the C programming language) motivated me to search for a pretty-printer and a way of matching parenthesis. The answer was moving to the 2nd version of the Arduino IDE (Integrated Development Environment). It also has a debugger, which I’ve yet to try.
- I got well into the Furnace13 state logic and decided it was becoming too big, too complex, and too unwieldy. There's a lot of potential for logic errors. Looked at YouTube and found a task scheduler tutorial. SchedTask seems to be the correct choice. I am investigating this more fully, but it looks very promising. Using the Task Scheduler will simplify the code, removing most of the state machine logic, improving comprehension, and making it easier to maintain. Using it will allow me to build small, simple functions to perform specific tasks and control their use.
- Ordered and received a long (25’) USB A-B cable for programming the Arduino. While it lets me connect my development computer (in the workshop) to the Open Hearth base in the trainroom, I’m thinking that running back and forth is not a great idea. Therefore, I have decided to clean up the table in the workshop, move the OH onto it, and do both the programming and the physical model construction there.
- Before I can move the model, a general clean-up of the workshop will be necessary. The paints have already gone back into their storage area beneath the spray booth. The electrical workbench will get cleared of its track-related components; the OH lighting and Arduino components will be staged there. Open Hearth structural components will go back into the Open Hearth project box until needed.
It's progress, of a sort.
George
|
|
|
Post by Adam on May 22, 2022 10:09:41 GMT
Great update. I’m following your trials and tribulations of programming the Aduino controller.
Give Notepad++ a try. Great free editor for programmers and should make keeping track of curly brackets a breeze.
|
|
|
Post by g3750 on May 22, 2022 13:39:58 GMT
Great update. I’m following your trials and tribulations of programming the Aduino controller. Give Notepad++ a try. Great free editor for programmers and should make keeping track of curly brackets a breeze. Thanks Adam. The real problem is that my code is too big to appear on one screen and needs to be cut into smaller, bite-sized, manageable functions. The 1.8x Arduino IDE will tell you which "{" is mated to which "}", but if there's a mile of code in between them it's hard to keep everything straight logically. The 2.0 IDE is much better at this, but the problem is still one of comprehension and code organization. Hence, the move to a Task Scheduler library. That will eliminate the need to keep and manipulate much of the state variables as well as lessen the "code bloat".
George
|
|
|
Post by Adam on May 22, 2022 14:17:52 GMT
Great update. I’m following your trials and tribulations of programming the Aduino controller. Give Notepad++ a try. Great free editor for programmers and should make keeping track of curly brackets a breeze. Thanks Adam. The real problem is that my code is too big to appear on one screen and needs to be cut into smaller, bite-sized, manageable functions. The 1.8x Arduino IDE will tell you which "{" is mated to which "}", but if there's a mile of code in between them it's hard to keep everything straight logically. The 2.0 IDE is much better at this, but the problem is still one of comprehension and code organization. Hence, the move to a Task Scheduler library. That will eliminate the need to keep and manipulate much of the state variables as well as lessen the "code bloat".
George
Breaking up/modularizing your code sounds like the right way to go. Good luck!
|
|
|
Post by g3750 on May 22, 2022 15:32:09 GMT
Thanks Adam. The real problem is that my code is too big to appear on one screen and needs to be cut into smaller, bite-sized, manageable functions. The 1.8x Arduino IDE will tell you which "{" is mated to which "}", but if there's a mile of code in between them it's hard to keep everything straight logically. The 2.0 IDE is much better at this, but the problem is still one of comprehension and code organization. Hence, the move to a Task Scheduler library. That will eliminate the need to keep and manipulate much of the state variables as well as lessen the "code bloat".
George
Breaking up/modularizing your code sounds like the right way to go. Good luck! Yes. I haven't programmed in a while (beside the "toy" Python examples I taught in my Intro course) and so fell into some of the bad coding habits I had very early in my career. I'm pleased to say that I did review a couple of software engineering lectures from that course (that I also taught) and refreshed (and upgraded) my practices.
We are in a much better place now.
George
|
|
|
Post by Adam on May 22, 2022 18:49:59 GMT
It’s amazing how quickly you lose it when you don't use it. Taught myself Python a few years ago and got pretty good at it. Then I never practiced. Looked at a Python program a few months back and it seemed almost foreign to me.
|
|
|
Post by papa3rail on May 23, 2022 14:00:24 GMT
George, This is awesome, great plan and great execution so far. I'm only about 10 pages in but I love it. I especially like the Steubenville depot it's very similar to the Pennsylvania Lines depot that was in Canton, Ohio. I plan to model it when I'm done with my current project. Can't wait to dig deeper into your post.
Dave
|
|
|
Post by g3750 on May 23, 2022 17:00:36 GMT
George, This is awesome, great plan and great execution so far. I'm only about 10 pages in but I love it. I especially like the Steubenville depot it's very similar to the Pennsylvania Lines depot that was in Canton, Ohio. I plan to model it when I'm done with my current project. Can't wait to dig deeper into your post.
Dave
Thank you very much! I will have to look up the Canton, OH station. I thought the Steubenville station was unique. Were they built around the same time? Same architectural firm?
George
|
|
|
Post by papa3rail on May 23, 2022 19:36:16 GMT
Not sure about the architectural firm but it was built in 1915.
|
|
|
Post by g3750 on May 24, 2022 0:12:16 GMT
That would be an interesting building to model.
George
|
|
|
Post by g3750 on Jun 8, 2022 19:04:41 GMT
Updated 6/8/2022: Much effort, small amount of visible progress to report. The Arduino program is coming along. The use of the scheduler library has made the task much simpler but the bulk of the effort is still ahead of me. With all the routines needed and the complexity of the simulation, I think we are looking a program size of around 1,000 SLOC (source lines of code). Right now I am in the process of wiring some of the relays and components inside the "Lean-To", which will house all the electronics. Thank goodness for Amazon - my source for many components and hardware fittings. More when I know it.
George
|
|
|
Post by Traindiesel! on Jun 9, 2022 7:29:24 GMT
Updated 6/8/2022: Much effort, small amount of visible progress to report. The Arduino program is coming along. .... More when I know it.
George
George!! You are learning and writing code in Arduino, but you couldn't figure out DCS!!! What the heck!!
Great work as usual! I'm looking forward to the next video.
|
|
|
Post by ptc on Jun 9, 2022 11:43:46 GMT
Lots of progress happens under the layout. Can't see it, but it is there.
|
|
|
Post by g3750 on Jun 9, 2022 13:57:03 GMT
Lots of progress happens under the layout. Can't see it, but it is there. Yes. Very much the story of the past 6-8 months.
George
|
|