compare comanndet by a analog value

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hello,

   

I would like command a DC motor with regulation PID.

   

I ave:

   

1 motor dc 0 to 35V for 0 to 3000 rpm. I command with PWM.

   

1 tachimeter 0 to 5 v for 0 to 3000 rpm.

   

I think enter at the ADC with 0-5V and i use the digital value to change a compare value.

   

I find the tutorial Lab 1 to 4.

   

For PWM and change the value of compare it's ok.

   

When i try to copy past the C command for get value of adc they don't work.

   

Can you help me.

   

I work with PSoC 4 CY8CKIT-049 4xxx and the tutorial is for psoc 5.

   

Thank

   

Fabrice

0 Likes
6 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Copy & paste will not help you because the underlying hardware is different from PSoC4 to PSoC5. Instead open a sequencing ADC example for a PSoC4, get it to work and copy that into your motor controller project.

   

Take care for your 35V interface to the motor, keep in mind to use some freewheeling diodes. Take care that no voltage on any pin exceeds th limit of VDD which, when using the USB, is set to 5V on a Prototyping Kit.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

thank for your answer.

   

Don't worry, i use a H-bridge with optocoupler by security. The command of optocoupler are  5V and the h-bridge ave 35V with diode-freewhile (diode de roue libre).

   

Ave you a exemple or similar programme for convert a analogue value to digital and use this one in pwm compare value for my psoc?

   

Thank

   

Fabrice

0 Likes
lock attach
Attachments are accessible only for community members.
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Attached is an ap note on a PID, in this case a temp controller, but principles

   

are same. It was done in PSOC 1. Useful as reference only as HW in PSOC 1

   

quite different than PSOC 3/4/5LP.

   

 

   

Motor drive loves creating a lot of transients so split grounds between PSOC and

   

motor driver H Bridge very importent. If you have problems use a DSO, set trigger

   

to Vtrig >= Vdd + .5 and also Vtrig <= Vss - .5, timebase normal mode (not auto) and

   

go looking for transients on ALL psoc pins.

   

 

   

The code to control PWM is very simple. First set PWM up (GUI configurator) for the

   

switching freq you want, period, and set compare value to 1/2 the period value. Then

   

start pwm with its start API and use the write compare API (in datasheet) to control

   

the PW, duty cycle. There are several examples in Creator, one controling LED brightness

   

for example, that you can look at if necessary.

   

 

   

Regards, Dana.

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Some other projects/ref material -

   

 

   

    

   

         

   

http://www.cypress.com/?rID=2638     AN2197 - Stepper Motor Driver for Smart Gauges

   

 

   

http://www.element14.com/community/docs/DOC-47984/l/cypress-an2229--application-note-on-psoc-1-motor...       AN2229  Motor Control-Multi-Functional Stepping Motor Driver

   

 

   

http://www.element14.com/community/docs/DOC-47938/l/cypress-an41949--application-note-for-psoc-1-ste...     AN41949 - Application Note for PSoC 1 Stepper Motor Controller

   

 

   

http://www.cypress.com/?rID=68670     AN75813 - H Bridge Based Motor Drive Protection Using PSoC® 3

   

 

   

http://www.cypress.com/?rID=3983     Obsolete Motor Control Reference Material and Project

   

 

   

 

   

 

   

Here there are 2 projects in PSOC 4 controlling motors -

   

 

   

    

   

         

   

    

   

          

   

 PSOC 4 element14.com

                                           
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  

S No

Date

Project Title

1

01-May-2013

Simple Blinking LED

2

02-May-2013

CapSense Slider Example

3

03-May-2013

PSoC 4 Pioneer Kit Annotation Library

4

06-May-2013

USB-UART utility

5

07-May-2013

USB-I2C Utility

6

08-May-2013

Danger Shield with Light Sensor Control

7

09-May-2013

Danger Shield with 7-segment display

8

10-May-2013

Danger Shield Buzzer of Doom

9

13-May-2013

Graphics LCD Display

10

14-May-2013

LCD - Rotating Cube Demo

11

15-May-2013

GLCD Paddle Game

12

16-May-2013

Pioneer Board Oscilloscope

13

17-May-2013

CapSense Button & LED Control with Bridge Control Panel

14

20-May-2013

What was the value? - LED Memory Example

15

21-May-2013

CapSense Proximity Detection

16

22-May-2013

Proximity Theremin

17

23-May-2013

2-Channel OScope with GraphicsLCD

18

24-May-2013

'Catch the Shells' Game with ColorLCD Shield

19

28-May-2013

LED Memory! Part Deux. Just Deux it!

20

29-May-2013

Starter Designs

21

30-May-2013

Fractional Frequency Synthesizer

22

31-May-2013

“Kill The Ghost” Game

23

03-Jun-2013

tinyprintf Example

24

04-Jun-2013

XBee Router Loopback Example

25

05-Jun-2013

XBee Direct IO

26

06-Jun-2013

XBee API RxTx Example

27

07-Jun-2013

XBee RGB CapSense Control

28

10-Jun-2013

“WiFi? Why Not!” Arduino WiFi Shield Example

29

11-Jun-2013

Bluetooth Home Automation System

30

12-Jun-2013

Bluetooth with GLCD

31

13-Jun-2013

Ethernet Shield

32

14-Jun-2013

More Relay!

33

17-Jun-2013

Sweet Music Everywhere! MIDI Shield

34

18-Jun-2013

Resistive Touch Example

35

19-Jun-2013

UART, I2C, and SPI Joystick Example

36

20-Jun-2013

What? I can use the PSoC 5LP too?

37

21-Jun-2013

PSoC With Friends! Word Scramble Game

38

24-Jun-2013

Ultrasonic Distance Measurement

39

25-Jun-2013

Two PWMs for the price of one

40

26-Jun-2013

Pioneer PnP Sensors

41

27-Jun-2013

Thermistor Example

42

28-Jun-2013

Hangman Game

43

01-Jul-2013

Rise of the Machines (Rolling Robot)

44

02-Jul-2013

Run Away Run Away! (Proximity Robot)

45

03-Jul-2013

Stepper Motor Example

46

05-Jul-2013

“Paint The Night” Accelerometer Example

47

08-Jul-2013

Obstacle Avoider Robot

48

09-Jul-2013

Walk The Line! Robot Example

49

11-Jul-2013

Android Device Controlled Robot

50

12-Jul-2013

SD Card Example

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  

S No

Date

Project Title

51

15-Jul-2013

Music Player

52

16-Jul-2013

Strike A Pose! Digital Camera

53

17-Jul-2013

PSoC Eye

54

18-Jul-2013

Custom Component 4x4 Keypad

55

19-Jul-2013

Parallel to Serial UDB Component

56

22-Jul-2013

Accelerometer Level

57

23-Jul-2013

Digital Audio From A Single Pin

58

24-Jul-2013

An Introduction to Processing

59

25-Jul-2013

But Wait There’s More! Single PWM with 3 Outputs

60

26-Jul-2013

PSoC 4 Mini-Billboard

61

29-Jul-2013

Nokia 5110 LCD Interface

62

30-Jul-2013

Ready…Set…GO! PSoC Stopwatch

63

31-Jul-2013

Some Like it Hot! PSoC Thermostat

64

01-Aug-2013

Workspace Organization using PSoC Theromostat

65

02-Aug-2013

New to PSoC or the Pioneer Kit? START HERE!

66

05-Aug-2013

LED Blinky Revisited

67

06-Aug-2013

PSoC 4 Getting Started Lab 1 (LED Blinky)

68

07-Aug-2013

PSoC 4 Getting Started Lab 2 (PWM LED)

69

08-Aug-2013

PSoC 4 Getting Started Lab 3 (CapSense UART)

70

09-Aug-2013

PSoC 4 Getting Started Lab 4 (ADC)

71

12-Aug-2013

Get Your Motor Runnin’!

72

13-Aug-2013

TFT Touchscreen Shield

73

14-Aug-2013

TFT Touchscreen Tic-Tac-Toe Game

74

15-Aug-2013

PSoC Creator Training 110

75

16-Aug-2013

PSoC Creator Training 111                                          

76

19-Aug-2013

PSoC Creator Training 112

77

20-Aug-2013

PSoC Creator Training 113

78

21-Aug-2013

PSoC Creator Training 210

79

22-Aug-2013

PSoC Creator Training 211

80

23-Aug-2013

PSoC Creator Training 212/213/214

81

26-Aug-2013

NFC/RFID Shield

82

27-Aug-2013

RFID Reader and Writer Project #2

83

28-Aug-2013

Raspberry Pi Integration

84

29-Aug-2013

State Machines in PSoC 4

85

30-Aug-2013

UART Bootloader in PSoC 4

86

03-Sep-2013

GPS Algorithm

87

04-Sep-2013

Gas Sensor Example

88

05-Sep-2013

Simulation of Gas Sensor Example

89

06-Sep-2013

GPS Example

90

09-Sep-2013

Comparator Example

91

10-Sep-2013

Infrared Remote Control

92

11-Sep-2013

Serial Communications Examples

93

12-Sep-2013

4 Channel Multiplexed Comparator

94

13-Sep-2013

Opamp Dynamic Gain

95

16-Sep-2013

Hibernate and Stop Power Modes

96

17-Sep-2013

P4 Light Sensor Project Design

97

18-Sep-2013

Rice Cooker

98

19-Sep-2013

Thermal Printer

99

20-Sep-2013

I2C Pass Though 'Smart Wire'

100

23-Sep-2013

PSoC 4 Time Square Billboard

0 Likes
Anonymous
Not applicable

thank all for your answers.

   

I look the informations.

   

Fabrice

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

You are always welcome!

   

 

   

Dana.

0 Likes