New Loconet throttle

Moderator: Moderators

New Loconet throttle

Postby Liviu M » 19.02.2012, 17:53

Hi,

I know there are Fred(i) and other DiY projects for loconet throttle, but for some reasons I developed my own version.
In the moment, my throttle update its slot data when I connect it in the net (for the address it has used last time), it allows me to change the loco speed and direction using a rotary encoder (from an old mouse), I can stop the controlled loco using a dedicated push button and I can program the controlled (loco) address.
I still need to implement the control of 5 (?) functions, but I don't have anymore push buttons to test it, and I still need to decide how I'll supply the whole (I suppose I'll use a RJ45 connector with the 4 middle pins for loconet, and the external pins for 5V supply).
I tested all with a PIC 16F877(A) - 40 pins, but the project should work also with smaller package version (16F876) by connecting the LCD to the port C and recompiling accordingly the project.
Should someone be interested in the project, I can post the firmware/sources. In the moment I'm posting just the schematic.
You do not have the required permissions to view the files attached to this post.
Liviu M
 

Re: New Loconet throttle

Postby shraps » 08.05.2012, 03:06

looks great
I would like to see the code and have a build and play

what about a 4 x 4 keypad matrix and the Button on the rotorary encoder

on the power supply front pin 1 and 6 is the choice for the power supply as it is railsink or 12V so you just need a rectifier bridge and a 5V regulator.

keep us updated

cheers
Ben
shraps
 

Re: New Loconet throttle

Postby Liviu M » 09.05.2012, 10:32

Hi Ben,

shraps wrote:looks great
I would like to see the code and have a build and play

Sure, I'll post the code in the evening.

shraps wrote:what about a 4 x 4 keypad matrix and the Button on the rotorary encoder

I don't understand the part with the rotary encoder. Do you mean buttons instead the rotary encoder (connected on pins 37 & 38/ RB4 &RB5)? Of course it is possible, as with 4x4 keypad matrix. However I'm not sure how fast I can do the changes. But since I'll post the code, you should be able to change everything as you need.

shraps wrote:on the power supply front pin 1 and 6 is the choice for the power supply as it is railsink or 12V so you just need a rectifier bridge and a 5V regulator.

Actually I plan to supply the throttle directly from a 5 V supply using a USB-Type connector (I'm trying to avoid the possibility that the kids will connect the throttle in the wrong socket).
But once again, this can be adapted by everybody on own needs.

I'll post in the evening the last versions of schematic/software.

Regards,
Liviu
Liviu M
 

Postby Liviu M » 09.05.2012, 16:59

Hello,

attached are the sources for the project.
Because of lack of time, I haven't added any new functionality (I think just some bug fixed), and I don't think the schematic need updates.
To compile the program I'm using the mplab/mplabx & HiTech's picc (lite version) (currently found on the microchip's site).
The functionality is (I hope) quite simple: when I connect the throttle to the loconet, it requests from CS the slot for the last (with it) controlled (loco) address. After receiving the slot, each time I rotate the encoder it sends the incremented/decremented speed value.
When the speed reach 0, keeping the rotation direction makes the (loco) direction to change and the speed (for the new direction) to increase.
In this moment there implemented three buttons (I should look in on my breadboard for the "codes", but you can define your own). - Prog, to program a new controlled address, "F0" - direction lights ON/OFF, and STOP - to "emergency" stop the controlled loco.
To control a new loco, I press the "Prog" button (codded in the ucKPCodes[] variables) and use the encoder to increase/decrease the address. A new press on Prog button saves the new address till a new programming (it saves the address in the eeprom).
The other buttons are (I think) self explained.
Unfortunately some of the comments are in Romanian language; I hope the code is not so cryptic and you can understand something. If not, simply ask.
If you have success in understanding /expanding the code, it will be interesting to see your progress. Please share. :)

LE I think I forgot to specify: all the files are released in a GPL sense - free to be used in any purposes as long as any changes/improvement are made public.
You do not have the required permissions to view the files attached to this post.
Last edited by Liviu M on 14.06.2012, 10:34, edited 1 time in total.
Liviu M
 

Postby Liviu M » 19.05.2012, 08:50

Pictures with my (first) prototype; I have some errors in the layout, but I can use it (at least I hope :D ) .
Because I have had place for 10 buttons, I've changed the above schematic. I'll post the new schematic and the new code when I'll code all the buttons.
You do not have the required permissions to view the files attached to this post.
Liviu M
 

Postby Liviu M » 31.10.2012, 22:12

Hi all,

Today I've succeed to use my throttle prototype almost as I've plan it:
- at connection it reads the loco data for the last controlled address
- I can change the speed & direction using a rotary encoder (with press switch for stop) and I have keys for light (F0) and another 8 functions (F1..F8 )
- I can change the controlled loco using a programming key to enter the program mode and the rotary encoder to change the address. The data for the new programmed loco address is read from the CS and the address is saved in the eeprom.
- speed, direction, address and active functions are shown on a LCD with 16x2 characters.

The schematic differ from the previously posted ones by the number of switches and the PIC-port used for the LN-Input. To easier control the loconet communication, I've used the hardware USART receive port (Rx) for the Loconet input signals. I would like to change the transmit port (Tx), but the existing hardware doesn't allow me.

Attached are the last schematic and firmware.
You do not have the required permissions to view the files attached to this post.
Liviu M
 

Postby Liviu M » 15.11.2012, 09:23

To conclude this topic, my throttle do what it was supposed to do, but I think it is too expensive.
It was OK for me to develop it (I've had a part of components lying in my drawers and it was a good reason to make some programming tests), but a Fred(i) costs less and does the job better (better implementation of the loconet protocol).
The only plus for my throttle is the display, but I'm not sure it is so important.

I have also a picture with the finished throttle, side by side with my profi-boss, controlling the same loco.
Image
Liviu M
 

Postby Buddace » 15.11.2012, 13:51

To conclude this topic, my throttle do what it was supposed to do, but I think it is too expensive.

I think in DIY project first objective is not money but personal satisfaction...

About hand controller I bulti my wireless/wired hand controller and choice different via.....18F family PIC and C18 lite. First version use potentiometer and nokia 3310 LCD next version I will use back light 3310 LCD and rotary encoder. I think read encoder via keypad network.

In her project you can swap some pin to remove pull up resistor.
www.dccworld.com First and Only Italian DCC Website.

TMWDCC/TBX , zDCC, Lokmaus 2, Arnold DCC, Intellibox, Hornby Select, A lot of Loconet DIY (Loconet SwitcBoard, Loconet P50, etc..)
Buddace
 

Postby Liviu M » 15.11.2012, 14:29

Buddace wrote:you can swap some pin to remove pull up resistor.

Not very easy because the pins with pull-ups are the same pins with "interrupt on change" and I use this feature for the rotary encoder.
The Nokia 3310's LCD display is an idea, but I used what I've already had.
Liviu M
 

Postby Buddace » 15.11.2012, 14:32

Liviu M wrote:
Buddace wrote:you can swap some pin to remove pull up resistor.

Not very easy because the pins with pull-ups are the same pins with "interrupt on change" and I use this feature for the rotary encoder.
The Nokia 3310's LCD display is an idea, but I used what I've already had.

Don't use on change interrupt but try with costant sampling.
www.dccworld.com First and Only Italian DCC Website.

TMWDCC/TBX , zDCC, Lokmaus 2, Arnold DCC, Intellibox, Hornby Select, A lot of Loconet DIY (Loconet SwitcBoard, Loconet P50, etc..)
Buddace
 

Postby Liviu M » 15.11.2012, 15:01

Why should I? :roll:
Liviu M
 

Postby Buddace » 15.11.2012, 15:13

Liviu M wrote:Why should I? :roll:

Don't use interrupt :D
www.dccworld.com First and Only Italian DCC Website.

TMWDCC/TBX , zDCC, Lokmaus 2, Arnold DCC, Intellibox, Hornby Select, A lot of Loconet DIY (Loconet SwitcBoard, Loconet P50, etc..)
Buddace
 

Postby Liviu M » 15.11.2012, 15:53

I've understood what you mean, but I want to know the reasons to not use the interrupts.
Liviu M
 

Postby Buddace » 15.11.2012, 16:06

Liviu M wrote:I've understood what you mean, but I want to know the reasons to not use the interrupts.

16F pic family have only one interrupt vector. I think is better use timer interrupt to generate loconet in software mode.
During these is clock is enough you can sample encoder.
Another idea, like in my case don't have enough pin, is manage encoder like keypad button..but don't know is work...
www.dccworld.com First and Only Italian DCC Website.

TMWDCC/TBX , zDCC, Lokmaus 2, Arnold DCC, Intellibox, Hornby Select, A lot of Loconet DIY (Loconet SwitcBoard, Loconet P50, etc..)
Buddace
 

Postby Liviu M » 15.11.2012, 16:28

I'm using both type of interrupts - timer for Loconet transmission and interrupt on change for the encoder.
Actually I'm using three interrupt types, because I'm using the hard UART module for Loconet reception and I'm using the Rx interrupts.

Anyway, thanks for suggestions, probably they where better received some time ago.
Right now I think I'll don't change anything (at least in hardware).
Liviu M
 

Next

Return to DIY Hardware