element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Experimenting with Current Sense Amplifiers
  • Challenges & Projects
  • Design Challenges
  • Experimenting with Current Sense Amplifiers
  • More
  • Cancel
Experimenting with Current Sense Amplifiers
Challenge Blog Safer 3D printer with Current Sensing - Blog 2 - getting started with the Current6 Click
  • Blog
  • Forum
  • Documents
  • Files
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: aspork42
  • Date Created: 10 May 2022 3:08 AM Date Created
  • Views 673 views
  • Likes 6 likes
  • Comments 1 comment
  • 3d printer
  • MikroE Click Board
  • mqtt
  • Current Monitoring
  • mikroe
  • Pï 3 Click Shield
Related
Recommended

Safer 3D printer with Current Sensing - Blog 2 - getting started with the Current6 Click

aspork42
aspork42
10 May 2022

What am I making?

The project goals here are to use a current sensor to monitor the electrical current going to the hot end and heat bed on a 3D printer. If overcurrent (wires get shorted); we open a relay and make alerts. If undercurrent, the wires could be fatigued and breaking. Open a relay and set an alert.

What am I up to in this blog?

imageToday's blog is the startup and getting things running.

I've already taken the kit components out of the box and gotten them stacked together as shown in the image below.

I've got my RaspberryPi imaged with the default Raspbian and am planning to use Python. There doesn't appear to be a ready-to-go library that is supported on the Pi so I plan to just hand-code the few lines I need to get the measurement values. 

The Pi3 Click Shield from the kit has been nice so far in making it simple to connect the boards. I had forgotten that others had issues with finding the Current6Click board on the I2C bus and I too ran into that issue. I grabbed my scope and could see activity on the I2C bus so knew that it was alive (after enabling in the Pi settings). The Click Shield has a very convenient ground connection point sticking out of the board which made it much easier to probe. 

imageRunning I2CDetect shows nothing because the chip requires a GPIO pin (#8) to be set HIGH as an enable. Once this was done with the raspi-gpio command, we can see the device at address 0x21.

Pseudo-code

This is a rough outline of what my Python code will do. This code seems that it will be mostly written from scratch and its nice to do a simple outline to get all my thoughts down. I'm planning to use PyCharm for a code-editor and run it on the Pi.

Power on
Connect to MQTT
Read in current threshold from MQTT
Write Enable pin HIGH for Current6 Click
Check for module

Close relay to allow current to flow

Routine
Check for 12V
	If 12v
		read current AFAFP
		Periodic voltage and current post to MQTT
		MQTT callback for subscribed topic for current threshold.
		
		If under-current:
			re-check voltage; ensure still active. 
			re-read current and ensure still under-current
				set alarm
				Post to MQTT
				Set output pin to close relay
			break;
	If no 12V; take tiny break and try again

Always:
	Interrupt pin set for overcurrent
		If over-current:
		set alarm
		Post to MQTT
		Set output pin to open relay
	
Provide mechanism to re-set from MQTT; otherwise restart.

That's all for today!

This is just a quick update post. I'm starting on the Python but that will take a little more time and I wanted to post some progress as I go.

  • Sign in to reply
Parents
  • DAB
    DAB over 3 years ago

    Let us know how you like PyCharm.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
Comment
  • DAB
    DAB over 3 years ago

    Let us know how you like PyCharm.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube