Repository files navigation

ContributorsForksStargazersIssues


PCB

A Infineon XMC1100 powered system used to switch between 2 USB Devices and to control a relay based on a sensor input with configurable hysteresis.

Report Bug · Request Feature

Table of Contents

  1. Description
  2. Getting Started
  3. Usage
  4. Contact
  5. Acknowledgements and Resources

Description

This project aims to develop a PCB used to switch USB sources/sinks on button press and to provide an analog input (ADC) used to control a relay with hysteresis and latch time. Furthermore it implements a simple setup menu structure to adjust hysteresis thresholds and latch time. All buttons, the USB-LEDs, ADC and realy pins are accessible with an screw terminal.

It is intended to run on the 5V provided by the USB, but it is possible to supply it externally using the 5V terminal (set diode D4 accordingly). Note that the power line of the currently disabled USB port will be disconnected in order to keep the current low.

With slight software modification of the software it would also be possible switch the USB Ports based on the ADC pin or to control the power pins of USB differently.

A possible application is the use at a car radio with only one USB port. In this case a external button can be used to switch between e.g. a phone and a USB Stick as input. The sensor controlled relay may be used with a brightness sensor to control the display illumination.

Getting Started

The application is developed with Infineon DAVE 4.5.0. You need to download the project and import it into the DAVE workspace. Make sure it is imported correctly and set as active project. Next use the "Rebuild Active Project" button to compile it and use the "Debug" button to flash it. If you a window pops up just double click "GDB SEGGER J-Link Debugging" and it should configure it self automatically.

Note: Make sure that the programmer is plugged in and that the project is already build at least once (the compiled ".elf" file and the connection is needed for automated configuration). In order to flash a XMC 1100 microcontroller, a genuine j-link flasher or a infineon programmer is needed (later ones are usually based on XMC 4200 and included on most prototyping boards). In case of the XMC based programmer you might need to enter the "BMI Set And Get" menu of DAVE and change the settings accordingly (SWDIO=P0.14, SWCLK=P0.15, untested).

After it is first programmed the emulated EEPROM holding the setup information is still empty, which will be displayed as an error (blinking at startup). This is normal - you need set a value for all 3 setup parameters and safe them to initially write the information to EEPROM (see section Usage).

Usage

USB

When plugged in the center button (or "S USB" pin) is used to switch the USB Port. The USB LEDs (and pins) inidicate the currently active port.

Sensor Controlled Relay

The relay output changes from low to high if the ADC input value exceed the upper threshold for longer than the latch time. It changes back to low if the ADC input value subceeds the lower threshold for longer than the latch time. The current state is indicated by the LED "D_RELAY".

These 3 setup values (upper threshold, lower threshold and latch time) can be manipulated using the "UP" and "DOWN" buttons (or pins) as described in the next section.

Setup

For every setup vale there is a setup menu. They can be navigated by pressing the "UP" and "DOWN" Buttons 3 ways: A short press is shorter than 1 second, a long press is shorter than 4 seconds and the longest detected press is at 4 seconds:

Upper Threshold Setup

To enter the upper threshold menu a short press of the UP is needed. The relay status led will fade up repeadetly to indicate this. Now the threshold can be in/decreased using the UP and DOWN buttons. The setting will be saved if a long press of the UP or DOWN button is detected. Inside the menu it is also possible to set the current sensor ADC value as this threshold by holding the UP button until the status led starts flashing (longest press time - this will also exit the menu).

The threshold can be set in 35 steps.

Lower Threshold Setup

To enter the lower threshold menu a short press of the DOWN is needed. The relay status led will fade down repeadetly to indicate this. Now the threshold can be in/decreased using the UP and DOWN buttons. The setting will be saved if a long press of the UP or DOWN button is detected. Inside the menu it is also possible to set the current sensor ADC value as this threshold by holding the DOWN button until the status led starts flashing (longest press time - this will also exit the menu).

The threshold can be set in 35 steps.

Latch Time Setup

To enter the latch time menu a long press of UP or DOWN is needed. The relay status led will blink repeadetly to indicate this. Now the time can be in/decreased using the UP and DOWN buttons. The setting will be saved if a long press of the UP or DOWN button is detected.

Every press of UP or DOWN changes the threshold by 250 ms.

Contact

Project Link: https://github.com/MechResato/USB_Changer

by Rene Santeler

Acknowledgements and Resources

  • Infineon - DAVE APP "E_EEPROM_XMC1" - Emulates a portion of flash as an EEPROM for data storage.
  • Infineon - DAVE APP "PWM_CCU4" - PWM APP using one timer slice of CCU4, with external events support, to generate a PWM output.
  • Infineon - DAVE APP "ADC_MEASUREMENT" - Incorporates analog to digital conversion for the required measurements.
  • Infineon - DAVE APP "DIGITAL_IO" - Used to configure a port pin as digital Input/Output.
  • Infineon - DAVE APP "SYSTIMER" - Uses the SysTick interrupt to keep track of the system time.
  • othneildrew - Best-README-Template

About

A Infineon XMC1100 powered system used to switch between 2 USB Devices and to control a relay based on a sensor input with configurable hysteresis.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

Repository files navigation

ContributorsForksStargazersIssues


PCB

A Infineon XMC1100 powered system used to switch between 2 USB Devices and to control a relay based on a sensor input with configurable hysteresis.

Report Bug · Request Feature

Table of Contents

  1. Description
  2. Getting Started
  3. Usage
  4. Contact
  5. Acknowledgements and Resources

Description

This project aims to develop a PCB used to switch USB sources/sinks on button press and to provide an analog input (ADC) used to control a relay with hysteresis and latch time. Furthermore it implements a simple setup menu structure to adjust hysteresis thresholds and latch time. All buttons, the USB-LEDs, ADC and realy pins are accessible with an screw terminal.

It is intended to run on the 5V provided by the USB, but it is possible to supply it externally using the 5V terminal (set diode D4 accordingly). Note that the power line of the currently disabled USB port will be disconnected in order to keep the current low.

With slight software modification of the software it would also be possible switch the USB Ports based on the ADC pin or to control the power pins of USB differently.

A possible application is the use at a car radio with only one USB port. In this case a external button can be used to switch between e.g. a phone and a USB Stick as input. The sensor controlled relay may be used with a brightness sensor to control the display illumination.

Getting Started

The application is developed with Infineon DAVE 4.5.0. You need to download the project and import it into the DAVE workspace. Make sure it is imported correctly and set as active project. Next use the "Rebuild Active Project" button to compile it and use the "Debug" button to flash it. If you a window pops up just double click "GDB SEGGER J-Link Debugging" and it should configure it self automatically.

Note: Make sure that the programmer is plugged in and that the project is already build at least once (the compiled ".elf" file and the connection is needed for automated configuration). In order to flash a XMC 1100 microcontroller, a genuine j-link flasher or a infineon programmer is needed (later ones are usually based on XMC 4200 and included on most prototyping boards). In case of the XMC based programmer you might need to enter the "BMI Set And Get" menu of DAVE and change the settings accordingly (SWDIO=P0.14, SWCLK=P0.15, untested).

After it is first programmed the emulated EEPROM holding the setup information is still empty, which will be displayed as an error (blinking at startup). This is normal - you need set a value for all 3 setup parameters and safe them to initially write the information to EEPROM (see section Usage).

Usage

USB

When plugged in the center button (or "S USB" pin) is used to switch the USB Port. The USB LEDs (and pins) inidicate the currently active port.

Sensor Controlled Relay

The relay output changes from low to high if the ADC input value exceed the upper threshold for longer than the latch time. It changes back to low if the ADC input value subceeds the lower threshold for longer than the latch time. The current state is indicated by the LED "D_RELAY".

These 3 setup values (upper threshold, lower threshold and latch time) can be manipulated using the "UP" and "DOWN" buttons (or pins) as described in the next section.

Setup

For every setup vale there is a setup menu. They can be navigated by pressing the "UP" and "DOWN" Buttons 3 ways: A short press is shorter than 1 second, a long press is shorter than 4 seconds and the longest detected press is at 4 seconds:

Upper Threshold Setup

To enter the upper threshold menu a short press of the UP is needed. The relay status led will fade up repeadetly to indicate this. Now the threshold can be in/decreased using the UP and DOWN buttons. The setting will be saved if a long press of the UP or DOWN button is detected. Inside the menu it is also possible to set the current sensor ADC value as this threshold by holding the UP button until the status led starts flashing (longest press time - this will also exit the menu).

The threshold can be set in 35 steps.

Lower Threshold Setup

To enter the lower threshold menu a short press of the DOWN is needed. The relay status led will fade down repeadetly to indicate this. Now the threshold can be in/decreased using the UP and DOWN buttons. The setting will be saved if a long press of the UP or DOWN button is detected. Inside the menu it is also possible to set the current sensor ADC value as this threshold by holding the DOWN button until the status led starts flashing (longest press time - this will also exit the menu).

The threshold can be set in 35 steps.

Latch Time Setup

To enter the latch time menu a long press of UP or DOWN is needed. The relay status led will blink repeadetly to indicate this. Now the time can be in/decreased using the UP and DOWN buttons. The setting will be saved if a long press of the UP or DOWN button is detected.

Every press of UP or DOWN changes the threshold by 250 ms.

Contact

Project Link: https://github.com/MechResato/USB_Changer

by Rene Santeler

Acknowledgements and Resources

  • Infineon - DAVE APP "E_EEPROM_XMC1" - Emulates a portion of flash as an EEPROM for data storage.
  • Infineon - DAVE APP "PWM_CCU4" - PWM APP using one timer slice of CCU4, with external events support, to generate a PWM output.
  • Infineon - DAVE APP "ADC_MEASUREMENT" - Incorporates analog to digital conversion for the required measurements.
  • Infineon - DAVE APP "DIGITAL_IO" - Used to configure a port pin as digital Input/Output.
  • Infineon - DAVE APP "SYSTIMER" - Uses the SysTick interrupt to keep track of the system time.
  • othneildrew - Best-README-Template

About

A Infineon XMC1100 powered system used to switch between 2 USB Devices and to control a relay based on a sensor input with configurable hysteresis.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

ContributorsForksStargazersIssues


PCB

A Infineon XMC1100 powered system used to switch between 2 USB Devices and to control a relay based on a sensor input with configurable hysteresis.

Report Bug · Request Feature

Table of Contents

  1. Description
  2. Getting Started
  3. Usage
  4. Contact
  5. Acknowledgements and Resources

Description

This project aims to develop a PCB used to switch USB sources/sinks on button press and to provide an analog input (ADC) used to control a relay with hysteresis and latch time. Furthermore it implements a simple setup menu structure to adjust hysteresis thresholds and latch time. All buttons, the USB-LEDs, ADC and realy pins are accessible with an screw terminal.

It is intended to run on the 5V provided by the USB, but it is possible to supply it externally using the 5V terminal (set diode D4 accordingly). Note that the power line of the currently disabled USB port will be disconnected in order to keep the current low.

With slight software modification of the software it would also be possible switch the USB Ports based on the ADC pin or to control the power pins of USB differently.

A possible application is the use at a car radio with only one USB port. In this case a external button can be used to switch between e.g. a phone and a USB Stick as input. The sensor controlled relay may be used with a brightness sensor to control the display illumination.

Getting Started

The application is developed with Infineon DAVE 4.5.0. You need to download the project and import it into the DAVE workspace. Make sure it is imported correctly and set as active project. Next use the "Rebuild Active Project" button to compile it and use the "Debug" button to flash it. If you a window pops up just double click "GDB SEGGER J-Link Debugging" and it should configure it self automatically.

Note: Make sure that the programmer is plugged in and that the project is already build at least once (the compiled ".elf" file and the connection is needed for automated configuration). In order to flash a XMC 1100 microcontroller, a genuine j-link flasher or a infineon programmer is needed (later ones are usually based on XMC 4200 and included on most prototyping boards). In case of the XMC based programmer you might need to enter the "BMI Set And Get" menu of DAVE and change the settings accordingly (SWDIO=P0.14, SWCLK=P0.15, untested).

After it is first programmed the emulated EEPROM holding the setup information is still empty, which will be displayed as an error (blinking at startup). This is normal - you need set a value for all 3 setup parameters and safe them to initially write the information to EEPROM (see section Usage).

Usage

USB

When plugged in the center button (or "S USB" pin) is used to switch the USB Port. The USB LEDs (and pins) inidicate the currently active port.

Sensor Controlled Relay

The relay output changes from low to high if the ADC input value exceed the upper threshold for longer than the latch time. It changes back to low if the ADC input value subceeds the lower threshold for longer than the latch time. The current state is indicated by the LED "D_RELAY".

These 3 setup values (upper threshold, lower threshold and latch time) can be manipulated using the "UP" and "DOWN" buttons (or pins) as described in the next section.

Setup

For every setup vale there is a setup menu. They can be navigated by pressing the "UP" and "DOWN" Buttons 3 ways: A short press is shorter than 1 second, a long press is shorter than 4 seconds and the longest detected press is at 4 seconds:

Upper Threshold Setup

To enter the upper threshold menu a short press of the UP is needed. The relay status led will fade up repeadetly to indicate this. Now the threshold can be in/decreased using the UP and DOWN buttons. The setting will be saved if a long press of the UP or DOWN button is detected. Inside the menu it is also possible to set the current sensor ADC value as this threshold by holding the UP button until the status led starts flashing (longest press time - this will also exit the menu).

The threshold can be set in 35 steps.

Lower Threshold Setup

To enter the lower threshold menu a short press of the DOWN is needed. The relay status led will fade down repeadetly to indicate this. Now the threshold can be in/decreased using the UP and DOWN buttons. The setting will be saved if a long press of the UP or DOWN button is detected. Inside the menu it is also possible to set the current sensor ADC value as this threshold by holding the DOWN button until the status led starts flashing (longest press time - this will also exit the menu).

The threshold can be set in 35 steps.

Latch Time Setup

To enter the latch time menu a long press of UP or DOWN is needed. The relay status led will blink repeadetly to indicate this. Now the time can be in/decreased using the UP and DOWN buttons. The setting will be saved if a long press of the UP or DOWN button is detected.

Every press of UP or DOWN changes the threshold by 250 ms.

Contact

Project Link: https://github.com/MechResato/USB_Changer

by Rene Santeler

Acknowledgements and Resources

  • Infineon - DAVE APP "E_EEPROM_XMC1" - Emulates a portion of flash as an EEPROM for data storage.
  • Infineon - DAVE APP "PWM_CCU4" - PWM APP using one timer slice of CCU4, with external events support, to generate a PWM output.
  • Infineon - DAVE APP "ADC_MEASUREMENT" - Incorporates analog to digital conversion for the required measurements.
  • Infineon - DAVE APP "DIGITAL_IO" - Used to configure a port pin as digital Input/Output.
  • Infineon - DAVE APP "SYSTIMER" - Uses the SysTick interrupt to keep track of the system time.
  • othneildrew - Best-README-Template

About

A Infineon XMC1100 powered system used to switch between 2 USB Devices and to control a relay based on a sensor input with configurable hysteresis.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

ContributorsForksStargazersIssues


PCB

A Infineon XMC1100 powered system used to switch between 2 USB Devices and to control a relay based on a sensor input with configurable hysteresis.

Report Bug · Request Feature

Table of Contents

  1. Description
  2. Getting Started
  3. Usage
  4. Contact
  5. Acknowledgements and Resources

Description

This project aims to develop a PCB used to switch USB sources/sinks on button press and to provide an analog input (ADC) used to control a relay with hysteresis and latch time. Furthermore it implements a simple setup menu structure to adjust hysteresis thresholds and latch time. All buttons, the USB-LEDs, ADC and realy pins are accessible with an screw terminal.

It is intended to run on the 5V provided by the USB, but it is possible to supply it externally using the 5V terminal (set diode D4 accordingly). Note that the power line of the currently disabled USB port will be disconnected in order to keep the current low.

With slight software modification of the software it would also be possible switch the USB Ports based on the ADC pin or to control the power pins of USB differently.

A possible application is the use at a car radio with only one USB port. In this case a external button can be used to switch between e.g. a phone and a USB Stick as input. The sensor controlled relay may be used with a brightness sensor to control the display illumination.

Getting Started

The application is developed with Infineon DAVE 4.5.0. You need to download the project and import it into the DAVE workspace. Make sure it is imported correctly and set as active project. Next use the "Rebuild Active Project" button to compile it and use the "Debug" button to flash it. If you a window pops up just double click "GDB SEGGER J-Link Debugging" and it should configure it self automatically.

Note: Make sure that the programmer is plugged in and that the project is already build at least once (the compiled ".elf" file and the connection is needed for automated configuration). In order to flash a XMC 1100 microcontroller, a genuine j-link flasher or a infineon programmer is needed (later ones are usually based on XMC 4200 and included on most prototyping boards). In case of the XMC based programmer you might need to enter the "BMI Set And Get" menu of DAVE and change the settings accordingly (SWDIO=P0.14, SWCLK=P0.15, untested).

After it is first programmed the emulated EEPROM holding the setup information is still empty, which will be displayed as an error (blinking at startup). This is normal - you need set a value for all 3 setup parameters and safe them to initially write the information to EEPROM (see section Usage).

Usage

USB

When plugged in the center button (or "S USB" pin) is used to switch the USB Port. The USB LEDs (and pins) inidicate the currently active port.

Sensor Controlled Relay

The relay output changes from low to high if the ADC input value exceed the upper threshold for longer than the latch time. It changes back to low if the ADC input value subceeds the lower threshold for longer than the latch time. The current state is indicated by the LED "D_RELAY".

These 3 setup values (upper threshold, lower threshold and latch time) can be manipulated using the "UP" and "DOWN" buttons (or pins) as described in the next section.

Setup

For every setup vale there is a setup menu. They can be navigated by pressing the "UP" and "DOWN" Buttons 3 ways: A short press is shorter than 1 second, a long press is shorter than 4 seconds and the longest detected press is at 4 seconds:

Upper Threshold Setup

To enter the upper threshold menu a short press of the UP is needed. The relay status led will fade up repeadetly to indicate this. Now the threshold can be in/decreased using the UP and DOWN buttons. The setting will be saved if a long press of the UP or DOWN button is detected. Inside the menu it is also possible to set the current sensor ADC value as this threshold by holding the UP button until the status led starts flashing (longest press time - this will also exit the menu).

The threshold can be set in 35 steps.

Lower Threshold Setup

To enter the lower threshold menu a short press of the DOWN is needed. The relay status led will fade down repeadetly to indicate this. Now the threshold can be in/decreased using the UP and DOWN buttons. The setting will be saved if a long press of the UP or DOWN button is detected. Inside the menu it is also possible to set the current sensor ADC value as this threshold by holding the DOWN button until the status led starts flashing (longest press time - this will also exit the menu).

The threshold can be set in 35 steps.

Latch Time Setup

To enter the latch time menu a long press of UP or DOWN is needed. The relay status led will blink repeadetly to indicate this. Now the time can be in/decreased using the UP and DOWN buttons. The setting will be saved if a long press of the UP or DOWN button is detected.

Every press of UP or DOWN changes the threshold by 250 ms.

Contact

Project Link: https://github.com/MechResato/USB_Changer

by Rene Santeler

Acknowledgements and Resources

  • Infineon - DAVE APP "E_EEPROM_XMC1" - Emulates a portion of flash as an EEPROM for data storage.
  • Infineon - DAVE APP "PWM_CCU4" - PWM APP using one timer slice of CCU4, with external events support, to generate a PWM output.
  • Infineon - DAVE APP "ADC_MEASUREMENT" - Incorporates analog to digital conversion for the required measurements.
  • Infineon - DAVE APP "DIGITAL_IO" - Used to configure a port pin as digital Input/Output.
  • Infineon - DAVE APP "SYSTIMER" - Uses the SysTick interrupt to keep track of the system time.
  • othneildrew - Best-README-Template

About

A Infineon XMC1100 powered system used to switch between 2 USB Devices and to control a relay based on a sensor input with configurable hysteresis.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

Repository files navigation

ContributorsForksStargazersIssues


PCB

A Infineon XMC1100 powered system used to switch between 2 USB Devices and to control a relay based on a sensor input with configurable hysteresis.

Report Bug · Request Feature

Table of Contents

  1. Description
  2. Getting Started
  3. Usage
  4. Contact
  5. Acknowledgements and Resources

Description

This project aims to develop a PCB used to switch USB sources/sinks on button press and to provide an analog input (ADC) used to control a relay with hysteresis and latch time. Furthermore it implements a simple setup menu structure to adjust hysteresis thresholds and latch time. All buttons, the USB-LEDs, ADC and realy pins are accessible with an screw terminal.

It is intended to run on the 5V provided by the USB, but it is possible to supply it externally using the 5V terminal (set diode D4 accordingly). Note that the power line of the currently disabled USB port will be disconnected in order to keep the current low.

With slight software modification of the software it would also be possible switch the USB Ports based on the ADC pin or to control the power pins of USB differently.

A possible application is the use at a car radio with only one USB port. In this case a external button can be used to switch between e.g. a phone and a USB Stick as input. The sensor controlled relay may be used with a brightness sensor to control the display illumination.

Getting Started

The application is developed with Infineon DAVE 4.5.0. You need to download the project and import it into the DAVE workspace. Make sure it is imported correctly and set as active project. Next use the "Rebuild Active Project" button to compile it and use the "Debug" button to flash it. If you a window pops up just double click "GDB SEGGER J-Link Debugging" and it should configure it self automatically.

Note: Make sure that the programmer is plugged in and that the project is already build at least once (the compiled ".elf" file and the connection is needed for automated configuration). In order to flash a XMC 1100 microcontroller, a genuine j-link flasher or a infineon programmer is needed (later ones are usually based on XMC 4200 and included on most prototyping boards). In case of the XMC based programmer you might need to enter the "BMI Set And Get" menu of DAVE and change the settings accordingly (SWDIO=P0.14, SWCLK=P0.15, untested).

After it is first programmed the emulated EEPROM holding the setup information is still empty, which will be displayed as an error (blinking at startup). This is normal - you need set a value for all 3 setup parameters and safe them to initially write the information to EEPROM (see section Usage).

Usage

USB

When plugged in the center button (or "S USB" pin) is used to switch the USB Port. The USB LEDs (and pins) inidicate the currently active port.

Sensor Controlled Relay

The relay output changes from low to high if the ADC input value exceed the upper threshold for longer than the latch time. It changes back to low if the ADC input value subceeds the lower threshold for longer than the latch time. The current state is indicated by the LED "D_RELAY".

These 3 setup values (upper threshold, lower threshold and latch time) can be manipulated using the "UP" and "DOWN" buttons (or pins) as described in the next section.

Setup

For every setup vale there is a setup menu. They can be navigated by pressing the "UP" and "DOWN" Buttons 3 ways: A short press is shorter than 1 second, a long press is shorter than 4 seconds and the longest detected press is at 4 seconds:

Upper Threshold Setup

To enter the upper threshold menu a short press of the UP is needed. The relay status led will fade up repeadetly to indicate this. Now the threshold can be in/decreased using the UP and DOWN buttons. The setting will be saved if a long press of the UP or DOWN button is detected. Inside the menu it is also possible to set the current sensor ADC value as this threshold by holding the UP button until the status led starts flashing (longest press time - this will also exit the menu).

The threshold can be set in 35 steps.

Lower Threshold Setup

To enter the lower threshold menu a short press of the DOWN is needed. The relay status led will fade down repeadetly to indicate this. Now the threshold can be in/decreased using the UP and DOWN buttons. The setting will be saved if a long press of the UP or DOWN button is detected. Inside the menu it is also possible to set the current sensor ADC value as this threshold by holding the DOWN button until the status led starts flashing (longest press time - this will also exit the menu).

The threshold can be set in 35 steps.

Latch Time Setup

To enter the latch time menu a long press of UP or DOWN is needed. The relay status led will blink repeadetly to indicate this. Now the time can be in/decreased using the UP and DOWN buttons. The setting will be saved if a long press of the UP or DOWN button is detected.

Every press of UP or DOWN changes the threshold by 250 ms.

Contact

Project Link: https://github.com/MechResato/USB_Changer

by Rene Santeler

Acknowledgements and Resources

  • Infineon - DAVE APP "E_EEPROM_XMC1" - Emulates a portion of flash as an EEPROM for data storage.
  • Infineon - DAVE APP "PWM_CCU4" - PWM APP using one timer slice of CCU4, with external events support, to generate a PWM output.
  • Infineon - DAVE APP "ADC_MEASUREMENT" - Incorporates analog to digital conversion for the required measurements.
  • Infineon - DAVE APP "DIGITAL_IO" - Used to configure a port pin as digital Input/Output.
  • Infineon - DAVE APP "SYSTIMER" - Uses the SysTick interrupt to keep track of the system time.
  • othneildrew - Best-README-Template

About

A Infineon XMC1100 powered system used to switch between 2 USB Devices and to control a relay based on a sensor input with configurable hysteresis.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

ContributorsForksStargazersIssues


PCB

A Infineon XMC1100 powered system used to switch between 2 USB Devices and to control a relay based on a sensor input with configurable hysteresis.

Report Bug · Request Feature

Table of Contents

  1. Description
  2. Getting Started
  3. Usage
  4. Contact
  5. Acknowledgements and Resources

Description

This project aims to develop a PCB used to switch USB sources/sinks on button press and to provide an analog input (ADC) used to control a relay with hysteresis and latch time. Furthermore it implements a simple setup menu structure to adjust hysteresis thresholds and latch time. All buttons, the USB-LEDs, ADC and realy pins are accessible with an screw terminal.

It is intended to run on the 5V provided by the USB, but it is possible to supply it externally using the 5V terminal (set diode D4 accordingly). Note that the power line of the currently disabled USB port will be disconnected in order to keep the current low.

With slight software modification of the software it would also be possible switch the USB Ports based on the ADC pin or to control the power pins of USB differently.

A possible application is the use at a car radio with only one USB port. In this case a external button can be used to switch between e.g. a phone and a USB Stick as input. The sensor controlled relay may be used with a brightness sensor to control the display illumination.

Getting Started

The application is developed with Infineon DAVE 4.5.0. You need to download the project and import it into the DAVE workspace. Make sure it is imported correctly and set as active project. Next use the "Rebuild Active Project" button to compile it and use the "Debug" button to flash it. If you a window pops up just double click "GDB SEGGER J-Link Debugging" and it should configure it self automatically.

Note: Make sure that the programmer is plugged in and that the project is already build at least once (the compiled ".elf" file and the connection is needed for automated configuration). In order to flash a XMC 1100 microcontroller, a genuine j-link flasher or a infineon programmer is needed (later ones are usually based on XMC 4200 and included on most prototyping boards). In case of the XMC based programmer you might need to enter the "BMI Set And Get" menu of DAVE and change the settings accordingly (SWDIO=P0.14, SWCLK=P0.15, untested).

After it is first programmed the emulated EEPROM holding the setup information is still empty, which will be displayed as an error (blinking at startup). This is normal - you need set a value for all 3 setup parameters and safe them to initially write the information to EEPROM (see section Usage).

Usage

USB

When plugged in the center button (or "S USB" pin) is used to switch the USB Port. The USB LEDs (and pins) inidicate the currently active port.

Sensor Controlled Relay

The relay output changes from low to high if the ADC input value exceed the upper threshold for longer than the latch time. It changes back to low if the ADC input value subceeds the lower threshold for longer than the latch time. The current state is indicated by the LED "D_RELAY".

These 3 setup values (upper threshold, lower threshold and latch time) can be manipulated using the "UP" and "DOWN" buttons (or pins) as described in the next section.

Setup

For every setup vale there is a setup menu. They can be navigated by pressing the "UP" and "DOWN" Buttons 3 ways: A short press is shorter than 1 second, a long press is shorter than 4 seconds and the longest detected press is at 4 seconds:

Upper Threshold Setup

To enter the upper threshold menu a short press of the UP is needed. The relay status led will fade up repeadetly to indicate this. Now the threshold can be in/decreased using the UP and DOWN buttons. The setting will be saved if a long press of the UP or DOWN button is detected. Inside the menu it is also possible to set the current sensor ADC value as this threshold by holding the UP button until the status led starts flashing (longest press time - this will also exit the menu).

The threshold can be set in 35 steps.

Lower Threshold Setup

To enter the lower threshold menu a short press of the DOWN is needed. The relay status led will fade down repeadetly to indicate this. Now the threshold can be in/decreased using the UP and DOWN buttons. The setting will be saved if a long press of the UP or DOWN button is detected. Inside the menu it is also possible to set the current sensor ADC value as this threshold by holding the DOWN button until the status led starts flashing (longest press time - this will also exit the menu).

The threshold can be set in 35 steps.

Latch Time Setup

To enter the latch time menu a long press of UP or DOWN is needed. The relay status led will blink repeadetly to indicate this. Now the time can be in/decreased using the UP and DOWN buttons. The setting will be saved if a long press of the UP or DOWN button is detected.

Every press of UP or DOWN changes the threshold by 250 ms.

Contact

Project Link: https://github.com/MechResato/USB_Changer

by Rene Santeler

Acknowledgements and Resources

  • Infineon - DAVE APP "E_EEPROM_XMC1" - Emulates a portion of flash as an EEPROM for data storage.
  • Infineon - DAVE APP "PWM_CCU4" - PWM APP using one timer slice of CCU4, with external events support, to generate a PWM output.
  • Infineon - DAVE APP "ADC_MEASUREMENT" - Incorporates analog to digital conversion for the required measurements.
  • Infineon - DAVE APP "DIGITAL_IO" - Used to configure a port pin as digital Input/Output.
  • Infineon - DAVE APP "SYSTIMER" - Uses the SysTick interrupt to keep track of the system time.
  • othneildrew - Best-README-Template

About

A Infineon XMC1100 powered system used to switch between 2 USB Devices and to control a relay based on a sensor input with configurable hysteresis.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

ContributorsForksStargazersIssues


PCB

A Infineon XMC1100 powered system used to switch between 2 USB Devices and to control a relay based on a sensor input with configurable hysteresis.

Report Bug · Request Feature

Table of Contents

  1. Description
  2. Getting Started
  3. Usage
  4. Contact
  5. Acknowledgements and Resources

Description

This project aims to develop a PCB used to switch USB sources/sinks on button press and to provide an analog input (ADC) used to control a relay with hysteresis and latch time. Furthermore it implements a simple setup menu structure to adjust hysteresis thresholds and latch time. All buttons, the USB-LEDs, ADC and realy pins are accessible with an screw terminal.

It is intended to run on the 5V provided by the USB, but it is possible to supply it externally using the 5V terminal (set diode D4 accordingly). Note that the power line of the currently disabled USB port will be disconnected in order to keep the current low.

With slight software modification of the software it would also be possible switch the USB Ports based on the ADC pin or to control the power pins of USB differently.

A possible application is the use at a car radio with only one USB port. In this case a external button can be used to switch between e.g. a phone and a USB Stick as input. The sensor controlled relay may be used with a brightness sensor to control the display illumination.

Getting Started

The application is developed with Infineon DAVE 4.5.0. You need to download the project and import it into the DAVE workspace. Make sure it is imported correctly and set as active project. Next use the "Rebuild Active Project" button to compile it and use the "Debug" button to flash it. If you a window pops up just double click "GDB SEGGER J-Link Debugging" and it should configure it self automatically.

Note: Make sure that the programmer is plugged in and that the project is already build at least once (the compiled ".elf" file and the connection is needed for automated configuration). In order to flash a XMC 1100 microcontroller, a genuine j-link flasher or a infineon programmer is needed (later ones are usually based on XMC 4200 and included on most prototyping boards). In case of the XMC based programmer you might need to enter the "BMI Set And Get" menu of DAVE and change the settings accordingly (SWDIO=P0.14, SWCLK=P0.15, untested).

After it is first programmed the emulated EEPROM holding the setup information is still empty, which will be displayed as an error (blinking at startup). This is normal - you need set a value for all 3 setup parameters and safe them to initially write the information to EEPROM (see section Usage).

Usage

USB

When plugged in the center button (or "S USB" pin) is used to switch the USB Port. The USB LEDs (and pins) inidicate the currently active port.

Sensor Controlled Relay

The relay output changes from low to high if the ADC input value exceed the upper threshold for longer than the latch time. It changes back to low if the ADC input value subceeds the lower threshold for longer than the latch time. The current state is indicated by the LED "D_RELAY".

These 3 setup values (upper threshold, lower threshold and latch time) can be manipulated using the "UP" and "DOWN" buttons (or pins) as described in the next section.

Setup

For every setup vale there is a setup menu. They can be navigated by pressing the "UP" and "DOWN" Buttons 3 ways: A short press is shorter than 1 second, a long press is shorter than 4 seconds and the longest detected press is at 4 seconds:

Upper Threshold Setup

To enter the upper threshold menu a short press of the UP is needed. The relay status led will fade up repeadetly to indicate this. Now the threshold can be in/decreased using the UP and DOWN buttons. The setting will be saved if a long press of the UP or DOWN button is detected. Inside the menu it is also possible to set the current sensor ADC value as this threshold by holding the UP button until the status led starts flashing (longest press time - this will also exit the menu).

The threshold can be set in 35 steps.

Lower Threshold Setup

To enter the lower threshold menu a short press of the DOWN is needed. The relay status led will fade down repeadetly to indicate this. Now the threshold can be in/decreased using the UP and DOWN buttons. The setting will be saved if a long press of the UP or DOWN button is detected. Inside the menu it is also possible to set the current sensor ADC value as this threshold by holding the DOWN button until the status led starts flashing (longest press time - this will also exit the menu).

The threshold can be set in 35 steps.

Latch Time Setup

To enter the latch time menu a long press of UP or DOWN is needed. The relay status led will blink repeadetly to indicate this. Now the time can be in/decreased using the UP and DOWN buttons. The setting will be saved if a long press of the UP or DOWN button is detected.

Every press of UP or DOWN changes the threshold by 250 ms.

Contact

Project Link: https://github.com/MechResato/USB_Changer

by Rene Santeler

Acknowledgements and Resources

  • Infineon - DAVE APP "E_EEPROM_XMC1" - Emulates a portion of flash as an EEPROM for data storage.
  • Infineon - DAVE APP "PWM_CCU4" - PWM APP using one timer slice of CCU4, with external events support, to generate a PWM output.
  • Infineon - DAVE APP "ADC_MEASUREMENT" - Incorporates analog to digital conversion for the required measurements.
  • Infineon - DAVE APP "DIGITAL_IO" - Used to configure a port pin as digital Input/Output.
  • Infineon - DAVE APP "SYSTIMER" - Uses the SysTick interrupt to keep track of the system time.
  • othneildrew - Best-README-Template

About

A Infineon XMC1100 powered system used to switch between 2 USB Devices and to control a relay based on a sensor input with configurable hysteresis.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

Repository files navigation

ContributorsForksStargazersIssues


PCB

A Infineon XMC1100 powered system used to switch between 2 USB Devices and to control a relay based on a sensor input with configurable hysteresis.

Report Bug · Request Feature

Table of Contents

  1. Description
  2. Getting Started
  3. Usage
  4. Contact
  5. Acknowledgements and Resources

Description

This project aims to develop a PCB used to switch USB sources/sinks on button press and to provide an analog input (ADC) used to control a relay with hysteresis and latch time. Furthermore it implements a simple setup menu structure to adjust hysteresis thresholds and latch time. All buttons, the USB-LEDs, ADC and realy pins are accessible with an screw terminal.

It is intended to run on the 5V provided by the USB, but it is possible to supply it externally using the 5V terminal (set diode D4 accordingly). Note that the power line of the currently disabled USB port will be disconnected in order to keep the current low.

With slight software modification of the software it would also be possible switch the USB Ports based on the ADC pin or to control the power pins of USB differently.

A possible application is the use at a car radio with only one USB port. In this case a external button can be used to switch between e.g. a phone and a USB Stick as input. The sensor controlled relay may be used with a brightness sensor to control the display illumination.

Getting Started

The application is developed with Infineon DAVE 4.5.0. You need to download the project and import it into the DAVE workspace. Make sure it is imported correctly and set as active project. Next use the "Rebuild Active Project" button to compile it and use the "Debug" button to flash it. If you a window pops up just double click "GDB SEGGER J-Link Debugging" and it should configure it self automatically.

Note: Make sure that the programmer is plugged in and that the project is already build at least once (the compiled ".elf" file and the connection is needed for automated configuration). In order to flash a XMC 1100 microcontroller, a genuine j-link flasher or a infineon programmer is needed (later ones are usually based on XMC 4200 and included on most prototyping boards). In case of the XMC based programmer you might need to enter the "BMI Set And Get" menu of DAVE and change the settings accordingly (SWDIO=P0.14, SWCLK=P0.15, untested).

After it is first programmed the emulated EEPROM holding the setup information is still empty, which will be displayed as an error (blinking at startup). This is normal - you need set a value for all 3 setup parameters and safe them to initially write the information to EEPROM (see section Usage).

Usage

USB

When plugged in the center button (or "S USB" pin) is used to switch the USB Port. The USB LEDs (and pins) inidicate the currently active port.

Sensor Controlled Relay

The relay output changes from low to high if the ADC input value exceed the upper threshold for longer than the latch time. It changes back to low if the ADC input value subceeds the lower threshold for longer than the latch time. The current state is indicated by the LED "D_RELAY".

These 3 setup values (upper threshold, lower threshold and latch time) can be manipulated using the "UP" and "DOWN" buttons (or pins) as described in the next section.

Setup

For every setup vale there is a setup menu. They can be navigated by pressing the "UP" and "DOWN" Buttons 3 ways: A short press is shorter than 1 second, a long press is shorter than 4 seconds and the longest detected press is at 4 seconds:

Upper Threshold Setup

To enter the upper threshold menu a short press of the UP is needed. The relay status led will fade up repeadetly to indicate this. Now the threshold can be in/decreased using the UP and DOWN buttons. The setting will be saved if a long press of the UP or DOWN button is detected. Inside the menu it is also possible to set the current sensor ADC value as this threshold by holding the UP button until the status led starts flashing (longest press time - this will also exit the menu).

The threshold can be set in 35 steps.

Lower Threshold Setup

To enter the lower threshold menu a short press of the DOWN is needed. The relay status led will fade down repeadetly to indicate this. Now the threshold can be in/decreased using the UP and DOWN buttons. The setting will be saved if a long press of the UP or DOWN button is detected. Inside the menu it is also possible to set the current sensor ADC value as this threshold by holding the DOWN button until the status led starts flashing (longest press time - this will also exit the menu).

The threshold can be set in 35 steps.

Latch Time Setup

To enter the latch time menu a long press of UP or DOWN is needed. The relay status led will blink repeadetly to indicate this. Now the time can be in/decreased using the UP and DOWN buttons. The setting will be saved if a long press of the UP or DOWN button is detected.

Every press of UP or DOWN changes the threshold by 250 ms.

Contact

Project Link: https://github.com/MechResato/USB_Changer

by Rene Santeler

Acknowledgements and Resources

  • Infineon - DAVE APP "E_EEPROM_XMC1" - Emulates a portion of flash as an EEPROM for data storage.
  • Infineon - DAVE APP "PWM_CCU4" - PWM APP using one timer slice of CCU4, with external events support, to generate a PWM output.
  • Infineon - DAVE APP "ADC_MEASUREMENT" - Incorporates analog to digital conversion for the required measurements.
  • Infineon - DAVE APP "DIGITAL_IO" - Used to configure a port pin as digital Input/Output.
  • Infineon - DAVE APP "SYSTIMER" - Uses the SysTick interrupt to keep track of the system time.
  • othneildrew - Best-README-Template

About

A Infineon XMC1100 powered system used to switch between 2 USB Devices and to control a relay based on a sensor input with configurable hysteresis.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Contributors

Languages