Maker Pro
Maker Pro

Digital Pot setup

CDRIVE

Hauling 10' pipe on a Trek Shift3
Justin, I just read your motor controller pdf again. Nowhere does it state that 0 Volts on the speed control pin equates to zero RPM. It may but it doesn't specify it.

Your controller provides a Run/Stop input for this. You have spare pins left on the Picaxe. If you want the motor stopped when B1=0 then use the Picaxe to control the Run/Stop pin on the controller, Let's see if you can figure out what additional code is needed so that


Code:
If B1=0 Then
    ' Do what? 
Else
    ' Do what?
EndIf



Read the controller pdf. It tells you what pin and logic level = Run or Stop.

Chris
 
Your controller provides a Run/Stop input for this. You have spare pins left on the Picaxe. If you want the motor stopped when B1=0 then use the Picaxe to control the Run/Stop pin on the controller, Let's see if you can figure out what additional code is needed
????????

I have looked at the PDF of the controller and I can see that grounding the no 4 pin of the controller will cause the motor to run. I`m afraid that is where my skill set ends!

I have attempted the code below but

Code:
If B1=0 Then
    High 2
Else
   Low 2
EndIf

I should explain my thinking.

To make the controller run we need to ground the No 4 Pin of the controller hence my command "Low 2" . I believe that this will ground the no 5 pin on the Pic, I can not see why this part of the code would not work. However,,,

If B1=0 then we don,t wont the motor to run and therefore need to break the connection from no 4 to ground,,I am not so sure that "High 2" is the correct command here as surely wont this then send a voltage into Pin 4??

I have used Bobk kind explanation of the High and Low settings but unless I'm not getting it surely this program of mine will not work. I have no alternative though!

Help!:eek: please?
 
Your code is correct. The input to the controller is a CMOS and TTL compatible input which means it should have either a high or low signal connected to it. Low makes it run, high makes it stop. The bar ___ over the RUN means that it is active low, i.e. the function is on if the signal is low, (just like your LED).

Bob
 

CDRIVE

Hauling 10' pipe on a Trek Shift3
Justin, here's the updated code and schematic. It should do exactly what you want. By the way, you never asked why my first schematic switched pins 3 & 4 low while these last two were changed to switched high. I did this only because I wanted you to have less hassles using the simulator. When the simulator starts the virtual pin buttons default to logic low. This would have caused your program to begin executing immediately, without any button press. This would not happen in a live test though. I've posted in the Picaxe suggestions forum about this and it will probably be changed in the future.

I would like to say that I don't like High Side switching. So before you solder up your final circuit let me know. I will change the schematic and the code to logic low switching. I'm sure there are many members that can tell you why they prefer logic low switching but my reasons are basically two. The first is, like your motor driver, most manufacturers use this convention. The reason is simple and is my second reason. It's easier to interface a logic low input to something other than a switch, like a transistor or logic block. It's also more convenient to find ground than V+. This makes using an Gator clip from ground to an input pin when touch testing.

Chris

Code:
' Title: DAC Control
' Developer: CDRIVE (CJS) 26 May 2012
' Chip Set: Picaxe 08M2
' Description: Produces an Up/Down staircase voltage (DAC) determined 
'              by the Input states of Pin4 (DAC Up) and Pin3 (DAC Down).
' Relationships: https://www.electronicspoint.com/digital-pot-setup-t248126p7.html#post1467672
' Related Files: AxeDacPinHi08M2.TSC (Tina Schematic File)
' ********************************************************************************

Init:
DacSetup %10100000       ' Reference DAC to Vdd

Main: 

	If B1=0 Then 
		High 2       ' Set Pin4 (Run/Stop) on MDC151-050301 Motor Driver to STOP
	Else
		Low 2        ' Set Pin4 (Run/Stop) on MDC151-050301 Motor Driver to RUN
	EndIf
	
	If Pin4=1 Then
	  Pause 20             ' 20mS debounce period
		If Pin4=1 Then       
	  	If B1<25 And B2=0 Then 
			  B1=B1+5
			  DacLevel B1      ' Set DAC output voltage
			  B2=1
			  Pause 500      ' Pause before testing state of Up Button (B2) again
			EndIf
		    If B1=25 And B2=0 Then
				  B1=B1+6
				  DacLevel B1    ' Set DAC output voltage
				  B2=1
				  Pause 500    ' Pause before testing state of Up Button (B2) again
			  EndIf
			If B1=31 Then
				Low 1            ' Switch LED On when DAC=Max
			EndIf
		EndIf
	EndIf
		
		
	If Pin4=0 Then				' Test Up Button to see if user released it 	
		B2=0            ' If Up Button was released then reset B2 to 0	                      
	EndIf
	

	If Pin3=1 Then
		Pause 20             ' 20mS debounce period
		If Pin3=1 Then 
			If B1=31 And B3=0 Then
				B1=B1-6
				DacLevel B1      ' Set DAC output voltage 
				B3=1
				High 1           ' Switch LED Off if DAC is <Max
				Pause 500    ' Pause before testing state of Down Button (B3) again
			EndIf
			 
			If B1<=25 And B1>0 And B3=0 Then
				B1=B1-5
				DacLevel B1      ' Set DAC output voltage
				B3=1
				Pause 500	   ' Pause before testing state of Down Button (B3) again
			EndIf
		EndIf
	EndIf
	
	If Pin3=0 Then				' Test Down Button to see if user released it 	
		B3=0   					' If Down Button was released then reset B3 to 0	              
	EndIf

	
GoTo Main
 

Attachments

  • AxeDacPinHi08M2.JPG
    AxeDacPinHi08M2.JPG
    52.8 KB · Views: 224
Hi Chris

Thanks that's great. I think I am actually starting to learn something here. Your help and everyone else`s contributions are very much appreciated.

I have another question, I'm afraid. (I am sure that by now you have realised I am going to sap every ounce of knowledge from you that I can get away with!;))

If I have two power sources i.e one for the step circuit and then another for the motor controller will I have to somehow link the negatives together. Is this correct and if so is it just a case of connecting the negatives together Or are you thinking :eek: Hell don`t do that!!:confused:

Regards

Justin
 

CDRIVE

Hauling 10' pipe on a Trek Shift3
Justin, I just noticed that your controller operates from 20 to 50 Volts. Are you going to be using two 12V batteries wired in series? I thought this project was going to be powered by a 12V battery.

To answer your question, everything will have a common ground.

Chris

Edit: Never mind. I forgot you're using a 12V to 24V Converter. One of those senior moments, don't ya know.
 
Last edited:

CDRIVE

Hauling 10' pipe on a Trek Shift3
Justin, here's a complete view of your schematic. Take note that ground is common to all parts. I hope it clears things up. ;)

Chris
 

Attachments

  • AxeMotorControl.JPG
    AxeMotorControl.JPG
    85.5 KB · Views: 250
Hi Chris

Thank you. I have learned allot over the last week and your help has been appreciated along with the additional contributions from the other users.

I will now put this lot together and I will place a video link of the project being tested. I am still quite along way from completion as although I am sure the final product will use the controller mentioned or something very similar, we have yet to test the current brushless motors we have on order. The batteries also have to be put to the test to see how they perform and we may eventually have to use 24V batteries.

I can already see a potential problem with the 12V to 24V step up module as it can only supply a constant output current of 3A. The motor is rated up to max 10 amp. However I will not know what current we will draw until tested as this will depend on how hard we can/have to make the motor work! It will be interesting!:rolleyes:

The project, believe it or not has already cost me > £3000 in motors, controllers and delivery costs as I have sourced them from all over the world. This may be the cost of ignorance but I have always said "nothing speculated, nothing gained!". They have all been put to the test and all failed:confused: and as a result over the last year I have had to learn quite allot about torque and current. I am waiting at the moment for a motor to arrive from Estonia and once it arrives the project is ago!

Regards and thanks again!;)

Justin
 

CDRIVE

Hauling 10' pipe on a Trek Shift3
I assume the brushless motor is desirable because Horses are skittish and brushless motors are much quieter? Also, if you use 24V battery make sure that C1 is rated for >=35V. Preferably >=50V.

Chris
 
Also, if you use 24V battery make sure that C1 is rated for >=35V. Preferably >=50V.

Chris

Hi Chris

I've had a look at c ratings and I understand that a battery is rated by the level of discharge that it can sustain. C1 means that is can discharge its load in 1 hr. (I'm thinking aloud here, so I may have this all wrong). :eek:

So, if my understanding is correct??, I don't understand what you mean by a 24V battery having a C1 rated for 35V or above.


Please can you explain in simple terms.

Regard

Justin:confused:
 

davenn

Moderator
Hi Chris

I've had a look at c ratings and I understand that a battery is rated by the level of discharge that it can sustain. C1 means that is can discharge its load in 1 hr. (I'm thinking aloud here, so I may have this all wrong). :eek:

Hi Justin,
Chris is referrings to C1 which is capacitor 1 (100nF) on the circuit diagram its the one across the
battery supply at the input to the boost converter. nothing to do with that battery discharge rate you were thinking about above

So, if my understanding is correct??, I don't understand what you mean by a 24V battery having a C1 rated for 35V or above.
Please can you explain in simple terms.
Regard
Justin:confused:

You are showing a 12V battery there so the cap should have a voltage rating of 25V
if it happened to be a 24V battery then the capacitor C1 should be rated at 35V or greater

cheers
Dave
 
Hi Dave

I'm not sure if I should feel stupid now,, I thought my knowledge was coming along nicely, I've just been reminded how little I know. LOL

Thanks for explaining that to me.

Justin
 

CDRIVE

Hauling 10' pipe on a Trek Shift3
Yup, Dave explained it. It's the 100nF caps that you purchased from Picaxe. C1 is used on the input pin of the 7805 (U2) 5V voltage regulator. It sees the full battery voltage. So it the batteries total 24V you want a cap rated at least 35V.

Chris

Edit: No, you shouldn't feel stupid. Thus far, you've been a gold star student!;)
 
Last edited:
Hi Chris

If your still interested in this thread and have some time on your hands, would you be willing to help to add to the circuit?

As you know I have purchased the Picaxe experimentation board and it has a numeric display mounted on the board, I have looked into this but there is little actual instruction on its use.

It got me thinking, what about using the Numeric display to produce a number representing which step of power we were actually at, 1-5 instead of the LED which shows when we reach the max.

I think that this will be possible and with my limited knowledge I think we would have to have another Picaxe chip which would read the level of output from the original chip and then drive the display.

However, It doesn't stop there! I also have another use for the Numeric display (i.e SSD). Could we also use the SSD to tell us what power remains in the battery. So that at default the SSD displays the speed of the motor 0 - 5 and with the press of a momentary switch the SSD would show the remaining power level of the battery in a percentage value 1 - 9. I intend to use Lifepo batteries so I guess this would in reality refer to 30% - 99% as the batteries I have switch off once they reach 30% charge remaining.

I hope your not rolling your eyes!:rolleyes:

It would be a great addition and an impossible task without your help for me to achieve.:D

Regards

Justin
 

CDRIVE

Hauling 10' pipe on a Trek Shift3
First question.. What's an "SSD"? Are you referring to the LCD? I'm not sure which LCD package Picaxe provided on your Protoboard but they sell 2 versions of LCDs.

(1) Bare LCD that receives input data via (BCD) Binary Coded Decimal. This requires 6 inputs (6 Outputs from the Picaxe) 4 are BCD lines plus a Set and Reset line.

(2) Serial LCD (Model AXE033). This package contains an integral Serial Interface board. Because of this it can receive Serial data from a Picaxe. This requires only one Picaxe pin.

(3) They also sell a Serial to BCD decoder separately.

As it stands now we can convert the Max (LED pin) to a Serial Output that will work with the AXE033 Serial LCD.

As far as monitoring the battery status is concerned... At this point the 08M2 has only one vacant pin (SerIn) which doesn't appear to be configurable to ADC, which we would use to monitor battery status. We will need a second 08M2 or move up to a 14M2 - 14 pin DIP.


Chris
 
Hi Chris

The board that I have, has a Seven segment display (SSD, it was my own abbreviation), I believe that you refer to this type in your point 1.

I have looked at the other items you mention and it all looks far more interesting than the SSD that I have on the board. So I will place an order today, However which is most suitable the OLED display : AXE033Y (I know its more expensive, but it sounds cool! and I like the clock feature.):cool: or should I order the AXE133Y as this also has an 18M2 chip, could we use this chip to do the whole job?

I will also order the AXE017M2 chip if needed and I will also order the AXE117 proto board.

Before I place the order do I need to add any other components to the shopping list eg resistors, caps etc.

Please let me know. Is this everything I need to make a self contained module?

I would really like the option of the battery meter in the final circuit.


Regards (Thanks for staying interested!)

Justin
 

CDRIVE

Hauling 10' pipe on a Trek Shift3
Justin, I think the 18M2 may be a bit of overkill for this but I'll let you know. It's going to take me a bit of time to work up a new schematic and code. The schematic symbol of the 08M2 that I've been using was drawn by me because I didn't have one in my schematic editor. I'll have to create a 14M2 and or an 18M2 also. Wait on ordering anything until I get this put together.

By the way, you seem to have a very deep well! :D From the get-go I assumed that this is a commercial endeavor for you, but I must say that I'm surprised. I wouldn't think that equine teeth grinding was that large of a market. :p

Chris
 
Last edited:
By the way, you seem to have a very deep well! :D From the get-go I assumed that this is a commercial endeavor for you, but I must say that I'm surprised. I wouldn't think that equine teeth grinding was that large of a market. :p

Chris

Hi Chris

The well is simply a bit of cash I have burning away in a PAYPAL account. The dream would be for this to become a commercial venture, however as always once I start something I also become very interested in the subject. You never stop learning and television isn't something I enjoy doing in my spare time!;)

The equine dental market is small as you've guessed, but its also a developing market and getting bigger each year. I for one make my living from horses teeth and in answer to your previous question about the need for brushless motors, yes, horses are skittish but in the right hands they can be made confident and at ease with the loudest of motors. I currently use a 240V motor that sounds like a jack hammer, the horses are never bothered.

I descided to use a brushless motor as I thought that only brushless motors with HAL sensors could have torque/current control. I now think that this is not true??:confused:

I will await your instructions as what to order and look forward to continuing the build with your help.

I did get this bit of code and programmed a second chip.

main: ; make a label called ‚main
readadc C.1,b0 ; read ADC1 into variable b0
if b0 > 90 then top ; if b0 > 90 then do top
if b0 < 90 then bot ; if b0 < 90 then do bot
low B.0 ; else switch off 0
low B.4 ; and switch off 4
goto main ; jump back to the start
top: ; make a label
high B.0 ; switch on 0
low B.4 ; switch off 4
goto main ; jump back to start
bot: ; make a label
high B.4 ; switch on 4
low B.0 ; switch off 0
goto main ; jump back to start


The code turns on or off two LED's if the ouput from your circuit is below or above a certain voltage ie PIN 7. I was just trying to learn how all this works. However I dont understand how the input is calibrated. I simply chose < 90 or > 90 as its roughly half way. Is there any chance you can explain this to me I want the leds to light, bot if its less than 2.5v or top if its more 2.5v. If you dont understand what Im getting at here, don't worry, Ill wait to figure it out as you help me with the additional code.:eek:

I guessed that if I can understand how the programme and chip read the data into c.1 then I could in theory use the second chip to run a display. This would be a simple method and no where near as efficient as the method you mentioned but at least I would be able to get to grips with the basic theory.

Regards

Justin
 
Last edited:
Top