GET https://kbin.spritesserver.nl/u/@Yonrak@feddit.uk/commented

Components

21 Twig Components
52 Render Count
47 ms Render Time
12.0 MiB Memory Usage

Components

Name Metadata Render Count Render Time
settings_row_switch
"App\Twig\Components\SettingsRowSwitchComponent"
components/_settings_row_switch.html.twig
15 2.30ms
date
"App\Twig\Components\DateComponent"
components/date.html.twig
4 0.95ms
user_settings_row_switch
"App\Twig\Components\UserSettingsRowSwitchComponent"
components/_user_settings_row_switch.html.twig
4 0.80ms
user_inline
"App\Twig\Components\UserInlineComponent"
components/user_inline.html.twig
3 0.89ms
date_edited
"App\Twig\Components\DateEditedComponent"
components/date_edited.html.twig
3 0.47ms
vote
"App\Twig\Components\VoteComponent"
components/vote.html.twig
3 1.48ms
boost
"App\Twig\Components\BoostComponent"
components/boost.html.twig
3 2.86ms
entry_comment
"App\Twig\Components\EntryCommentComponent"
components/entry_comment.html.twig
2 22.61ms
user_avatar
"App\Twig\Components\UserAvatarComponent"
components/user_avatar.html.twig
2 0.48ms
settings_row_enum
"App\Twig\Components\SettingsRowEnumComponent"
components/_settings_row_enum.html.twig
2 0.43ms
user_box
"App\Twig\Components\UserBoxComponent"
components/user_box.html.twig
1 1.33ms
user_actions
"App\Twig\Components\UserActionsComponent"
components/user_actions.html.twig
1 0.77ms
entry
"App\Twig\Components\EntryComponent"
components/_cached.html.twig
1 11.22ms
magazine_inline
"App\Twig\Components\MagazineInlineComponent"
components/magazine_inline.html.twig
1 0.23ms
related_magazines
"App\Twig\Components\RelatedMagazinesComponent"
components/_cached.html.twig
1 2.45ms
active_users
"App\Twig\Components\ActiveUsersComponent"
components/_cached.html.twig
1 0.25ms
related_categories
"App\Twig\Components\RelatedCategoriesComponent"
components/_cached.html.twig
1 1.80ms
related_posts
"App\Twig\Components\RelatedPostsComponent"
components/_cached.html.twig
1 1.60ms
related_entries
"App\Twig\Components\RelatedEntriesComponent"
components/_cached.html.twig
1 1.58ms
support_us_block
"App\Twig\Components\SupportUsBlock"
components/_cached.html.twig
1 0.22ms
featured_magazines
"App\Twig\Components\FeaturedMagazinesComponent"
components/_cached.html.twig
1 0.90ms

Render calls

user_box App\Twig\Components\UserBoxComponent 12.0 MiB 1.33 ms
Input props
[
  "user" => App\Entity\User {#265
    +avatar: null
    +cover: null
    +email: "Yonrak@feddit.uk"
    +username: "@Yonrak@feddit.uk"
    +roles: []
    +followersCount: 0
    +homepage: "front"
    +about: null
    +lastActive: DateTime @1692955883 {#275
      date: 2023-08-25 11:31:23.0 +02:00
    }
    +markedForDeletionAt: null
    +fields: null
    +oauthGithubId: null
    +oauthGoogleId: null
    +oauthFacebookId: null
    +oauthKeycloakId: null
    +hideAdult: true
    +showSubscribedUsers: true
    +showSubscribedMagazines: true
    +showSubscribedDomains: true
    +preferredLanguages: []
    +featuredMagazines: null
    +showProfileSubscriptions: false
    +showProfileFollowings: true
    +markNewComments: false
    +notifyOnNewEntry: false
    +notifyOnNewEntryReply: true
    +notifyOnNewEntryCommentReply: true
    +notifyOnNewPost: false
    +notifyOnNewPostReply: true
    +notifyOnNewPostCommentReply: true
    +addMentionsEntries: false
    +addMentionsPosts: true
    +isBanned: false
    +isVerified: false
    +isDeleted: false
    +isBot: false
    +spamProtection: true
    +customCss: null
    +ignoreMagazinesCustomCss: false
    +moderatorTokens: Doctrine\ORM\PersistentCollection {#253 …}
    +magazineOwnershipRequests: Doctrine\ORM\PersistentCollection {#249 …}
    +moderatorRequests: Doctrine\ORM\PersistentCollection {#238 …}
    +entries: Doctrine\ORM\PersistentCollection {#196 …}
    +entryVotes: Doctrine\ORM\PersistentCollection {#168 …}
    +entryComments: Doctrine\ORM\PersistentCollection {#141 …}
    +entryCommentVotes: Doctrine\ORM\PersistentCollection {#111 …}
    +posts: Doctrine\ORM\PersistentCollection {#84 …}
    +postVotes: Doctrine\ORM\PersistentCollection {#99 …}
    +postComments: Doctrine\ORM\PersistentCollection {#1863 …}
    +postCommentVotes: Doctrine\ORM\PersistentCollection {#1479 …}
    +subscriptions: Doctrine\ORM\PersistentCollection {#1658 …}
    +subscribedDomains: Doctrine\ORM\PersistentCollection {#1868 …}
    +follows: Doctrine\ORM\PersistentCollection {#1917 …}
    +followers: Doctrine\ORM\PersistentCollection {#1601 …}
    +blocks: Doctrine\ORM\PersistentCollection {#1805 …}
    +blockers: Doctrine\ORM\PersistentCollection {#1810 …}
    +blockedMagazines: Doctrine\ORM\PersistentCollection {#1857 …}
    +blockedDomains: Doctrine\ORM\PersistentCollection {#1860 …}
    +reports: Doctrine\ORM\PersistentCollection {#1791 …}
    +favourites: Doctrine\ORM\PersistentCollection {#2416 …}
    +violations: Doctrine\ORM\PersistentCollection {#1824 …}
    +notifications: Doctrine\ORM\PersistentCollection {#1914 …}
    +awards: Doctrine\ORM\PersistentCollection {#1929 …}
    +subscribedCategories: Doctrine\ORM\PersistentCollection {#1867 …}
    +categories: Doctrine\ORM\PersistentCollection {#1880 …}
    -id: 42482
    -password: "$2y$13$NhIMiF1JXctMkB.To0A1l.9Yf5tUWEmnsXRxLOIoPHjfEy4B2UkMe"
    -totpSecret: null
    -totpBackupCodes: []
    -oAuth2UserConsents: Doctrine\ORM\PersistentCollection {#1894 …}
    +apId: "Yonrak@feddit.uk"
    +apProfileId: "https://feddit.uk/u/Yonrak"
    +apPublicUrl: "https://feddit.uk/u/Yonrak"
    +apFollowersUrl: null
    +apInboxUrl: "https://feddit.uk/inbox"
    +apDomain: "feddit.uk"
    +apPreferredUsername: "Yonrak"
    +apDiscoverable: true
    +apManuallyApprovesFollowers: false
    +privateKey: null
    +publicKey: null
    +apFetchedAt: DateTime @1692955883 {#269
      date: 2023-08-25 11:31:23.0 +02:00
    }
    +apDeletedAt: null
    +apTimeoutAt: null
    +visibility: "visible             "
    +createdAt: DateTimeImmutable @1692950596 {#268
      date: 2023-08-25 10:03:16.0 +02:00
    }
  }
  "stretchedLink" => false
]
Attributes
[]
Component
App\Twig\Components\UserBoxComponent {#2026
  +user: App\Entity\User {#265
    +avatar: null
    +cover: null
    +email: "Yonrak@feddit.uk"
    +username: "@Yonrak@feddit.uk"
    +roles: []
    +followersCount: 0
    +homepage: "front"
    +about: null
    +lastActive: DateTime @1692955883 {#275
      date: 2023-08-25 11:31:23.0 +02:00
    }
    +markedForDeletionAt: null
    +fields: null
    +oauthGithubId: null
    +oauthGoogleId: null
    +oauthFacebookId: null
    +oauthKeycloakId: null
    +hideAdult: true
    +showSubscribedUsers: true
    +showSubscribedMagazines: true
    +showSubscribedDomains: true
    +preferredLanguages: []
    +featuredMagazines: null
    +showProfileSubscriptions: false
    +showProfileFollowings: true
    +markNewComments: false
    +notifyOnNewEntry: false
    +notifyOnNewEntryReply: true
    +notifyOnNewEntryCommentReply: true
    +notifyOnNewPost: false
    +notifyOnNewPostReply: true
    +notifyOnNewPostCommentReply: true
    +addMentionsEntries: false
    +addMentionsPosts: true
    +isBanned: false
    +isVerified: false
    +isDeleted: false
    +isBot: false
    +spamProtection: true
    +customCss: null
    +ignoreMagazinesCustomCss: false
    +moderatorTokens: Doctrine\ORM\PersistentCollection {#253 …}
    +magazineOwnershipRequests: Doctrine\ORM\PersistentCollection {#249 …}
    +moderatorRequests: Doctrine\ORM\PersistentCollection {#238 …}
    +entries: Doctrine\ORM\PersistentCollection {#196 …}
    +entryVotes: Doctrine\ORM\PersistentCollection {#168 …}
    +entryComments: Doctrine\ORM\PersistentCollection {#141 …}
    +entryCommentVotes: Doctrine\ORM\PersistentCollection {#111 …}
    +posts: Doctrine\ORM\PersistentCollection {#84 …}
    +postVotes: Doctrine\ORM\PersistentCollection {#99 …}
    +postComments: Doctrine\ORM\PersistentCollection {#1863 …}
    +postCommentVotes: Doctrine\ORM\PersistentCollection {#1479 …}
    +subscriptions: Doctrine\ORM\PersistentCollection {#1658 …}
    +subscribedDomains: Doctrine\ORM\PersistentCollection {#1868 …}
    +follows: Doctrine\ORM\PersistentCollection {#1917 …}
    +followers: Doctrine\ORM\PersistentCollection {#1601 …}
    +blocks: Doctrine\ORM\PersistentCollection {#1805 …}
    +blockers: Doctrine\ORM\PersistentCollection {#1810 …}
    +blockedMagazines: Doctrine\ORM\PersistentCollection {#1857 …}
    +blockedDomains: Doctrine\ORM\PersistentCollection {#1860 …}
    +reports: Doctrine\ORM\PersistentCollection {#1791 …}
    +favourites: Doctrine\ORM\PersistentCollection {#2416 …}
    +violations: Doctrine\ORM\PersistentCollection {#1824 …}
    +notifications: Doctrine\ORM\PersistentCollection {#1914 …}
    +awards: Doctrine\ORM\PersistentCollection {#1929 …}
    +subscribedCategories: Doctrine\ORM\PersistentCollection {#1867 …}
    +categories: Doctrine\ORM\PersistentCollection {#1880 …}
    -id: 42482
    -password: "$2y$13$NhIMiF1JXctMkB.To0A1l.9Yf5tUWEmnsXRxLOIoPHjfEy4B2UkMe"
    -totpSecret: null
    -totpBackupCodes: []
    -oAuth2UserConsents: Doctrine\ORM\PersistentCollection {#1894 …}
    +apId: "Yonrak@feddit.uk"
    +apProfileId: "https://feddit.uk/u/Yonrak"
    +apPublicUrl: "https://feddit.uk/u/Yonrak"
    +apFollowersUrl: null
    +apInboxUrl: "https://feddit.uk/inbox"
    +apDomain: "feddit.uk"
    +apPreferredUsername: "Yonrak"
    +apDiscoverable: true
    +apManuallyApprovesFollowers: false
    +privateKey: null
    +publicKey: null
    +apFetchedAt: DateTime @1692955883 {#269
      date: 2023-08-25 11:31:23.0 +02:00
    }
    +apDeletedAt: null
    +apTimeoutAt: null
    +visibility: "visible             "
    +createdAt: DateTimeImmutable @1692950596 {#268
      date: 2023-08-25 10:03:16.0 +02:00
    }
  }
  +stretchedLink: false
}
user_actions App\Twig\Components\UserActionsComponent 12.0 MiB 0.77 ms
Input props
[
  "user" => App\Entity\User {#265
    +avatar: null
    +cover: null
    +email: "Yonrak@feddit.uk"
    +username: "@Yonrak@feddit.uk"
    +roles: []
    +followersCount: 0
    +homepage: "front"
    +about: null
    +lastActive: DateTime @1692955883 {#275
      date: 2023-08-25 11:31:23.0 +02:00
    }
    +markedForDeletionAt: null
    +fields: null
    +oauthGithubId: null
    +oauthGoogleId: null
    +oauthFacebookId: null
    +oauthKeycloakId: null
    +hideAdult: true
    +showSubscribedUsers: true
    +showSubscribedMagazines: true
    +showSubscribedDomains: true
    +preferredLanguages: []
    +featuredMagazines: null
    +showProfileSubscriptions: false
    +showProfileFollowings: true
    +markNewComments: false
    +notifyOnNewEntry: false
    +notifyOnNewEntryReply: true
    +notifyOnNewEntryCommentReply: true
    +notifyOnNewPost: false
    +notifyOnNewPostReply: true
    +notifyOnNewPostCommentReply: true
    +addMentionsEntries: false
    +addMentionsPosts: true
    +isBanned: false
    +isVerified: false
    +isDeleted: false
    +isBot: false
    +spamProtection: true
    +customCss: null
    +ignoreMagazinesCustomCss: false
    +moderatorTokens: Doctrine\ORM\PersistentCollection {#253 …}
    +magazineOwnershipRequests: Doctrine\ORM\PersistentCollection {#249 …}
    +moderatorRequests: Doctrine\ORM\PersistentCollection {#238 …}
    +entries: Doctrine\ORM\PersistentCollection {#196 …}
    +entryVotes: Doctrine\ORM\PersistentCollection {#168 …}
    +entryComments: Doctrine\ORM\PersistentCollection {#141 …}
    +entryCommentVotes: Doctrine\ORM\PersistentCollection {#111 …}
    +posts: Doctrine\ORM\PersistentCollection {#84 …}
    +postVotes: Doctrine\ORM\PersistentCollection {#99 …}
    +postComments: Doctrine\ORM\PersistentCollection {#1863 …}
    +postCommentVotes: Doctrine\ORM\PersistentCollection {#1479 …}
    +subscriptions: Doctrine\ORM\PersistentCollection {#1658 …}
    +subscribedDomains: Doctrine\ORM\PersistentCollection {#1868 …}
    +follows: Doctrine\ORM\PersistentCollection {#1917 …}
    +followers: Doctrine\ORM\PersistentCollection {#1601 …}
    +blocks: Doctrine\ORM\PersistentCollection {#1805 …}
    +blockers: Doctrine\ORM\PersistentCollection {#1810 …}
    +blockedMagazines: Doctrine\ORM\PersistentCollection {#1857 …}
    +blockedDomains: Doctrine\ORM\PersistentCollection {#1860 …}
    +reports: Doctrine\ORM\PersistentCollection {#1791 …}
    +favourites: Doctrine\ORM\PersistentCollection {#2416 …}
    +violations: Doctrine\ORM\PersistentCollection {#1824 …}
    +notifications: Doctrine\ORM\PersistentCollection {#1914 …}
    +awards: Doctrine\ORM\PersistentCollection {#1929 …}
    +subscribedCategories: Doctrine\ORM\PersistentCollection {#1867 …}
    +categories: Doctrine\ORM\PersistentCollection {#1880 …}
    -id: 42482
    -password: "$2y$13$NhIMiF1JXctMkB.To0A1l.9Yf5tUWEmnsXRxLOIoPHjfEy4B2UkMe"
    -totpSecret: null
    -totpBackupCodes: []
    -oAuth2UserConsents: Doctrine\ORM\PersistentCollection {#1894 …}
    +apId: "Yonrak@feddit.uk"
    +apProfileId: "https://feddit.uk/u/Yonrak"
    +apPublicUrl: "https://feddit.uk/u/Yonrak"
    +apFollowersUrl: null
    +apInboxUrl: "https://feddit.uk/inbox"
    +apDomain: "feddit.uk"
    +apPreferredUsername: "Yonrak"
    +apDiscoverable: true
    +apManuallyApprovesFollowers: false
    +privateKey: null
    +publicKey: null
    +apFetchedAt: DateTime @1692955883 {#269
      date: 2023-08-25 11:31:23.0 +02:00
    }
    +apDeletedAt: null
    +apTimeoutAt: null
    +visibility: "visible             "
    +createdAt: DateTimeImmutable @1692950596 {#268
      date: 2023-08-25 10:03:16.0 +02:00
    }
  }
]
Attributes
[]
Component
App\Twig\Components\UserActionsComponent {#2293
  +user: App\Entity\User {#265
    +avatar: null
    +cover: null
    +email: "Yonrak@feddit.uk"
    +username: "@Yonrak@feddit.uk"
    +roles: []
    +followersCount: 0
    +homepage: "front"
    +about: null
    +lastActive: DateTime @1692955883 {#275
      date: 2023-08-25 11:31:23.0 +02:00
    }
    +markedForDeletionAt: null
    +fields: null
    +oauthGithubId: null
    +oauthGoogleId: null
    +oauthFacebookId: null
    +oauthKeycloakId: null
    +hideAdult: true
    +showSubscribedUsers: true
    +showSubscribedMagazines: true
    +showSubscribedDomains: true
    +preferredLanguages: []
    +featuredMagazines: null
    +showProfileSubscriptions: false
    +showProfileFollowings: true
    +markNewComments: false
    +notifyOnNewEntry: false
    +notifyOnNewEntryReply: true
    +notifyOnNewEntryCommentReply: true
    +notifyOnNewPost: false
    +notifyOnNewPostReply: true
    +notifyOnNewPostCommentReply: true
    +addMentionsEntries: false
    +addMentionsPosts: true
    +isBanned: false
    +isVerified: false
    +isDeleted: false
    +isBot: false
    +spamProtection: true
    +customCss: null
    +ignoreMagazinesCustomCss: false
    +moderatorTokens: Doctrine\ORM\PersistentCollection {#253 …}
    +magazineOwnershipRequests: Doctrine\ORM\PersistentCollection {#249 …}
    +moderatorRequests: Doctrine\ORM\PersistentCollection {#238 …}
    +entries: Doctrine\ORM\PersistentCollection {#196 …}
    +entryVotes: Doctrine\ORM\PersistentCollection {#168 …}
    +entryComments: Doctrine\ORM\PersistentCollection {#141 …}
    +entryCommentVotes: Doctrine\ORM\PersistentCollection {#111 …}
    +posts: Doctrine\ORM\PersistentCollection {#84 …}
    +postVotes: Doctrine\ORM\PersistentCollection {#99 …}
    +postComments: Doctrine\ORM\PersistentCollection {#1863 …}
    +postCommentVotes: Doctrine\ORM\PersistentCollection {#1479 …}
    +subscriptions: Doctrine\ORM\PersistentCollection {#1658 …}
    +subscribedDomains: Doctrine\ORM\PersistentCollection {#1868 …}
    +follows: Doctrine\ORM\PersistentCollection {#1917 …}
    +followers: Doctrine\ORM\PersistentCollection {#1601 …}
    +blocks: Doctrine\ORM\PersistentCollection {#1805 …}
    +blockers: Doctrine\ORM\PersistentCollection {#1810 …}
    +blockedMagazines: Doctrine\ORM\PersistentCollection {#1857 …}
    +blockedDomains: Doctrine\ORM\PersistentCollection {#1860 …}
    +reports: Doctrine\ORM\PersistentCollection {#1791 …}
    +favourites: Doctrine\ORM\PersistentCollection {#2416 …}
    +violations: Doctrine\ORM\PersistentCollection {#1824 …}
    +notifications: Doctrine\ORM\PersistentCollection {#1914 …}
    +awards: Doctrine\ORM\PersistentCollection {#1929 …}
    +subscribedCategories: Doctrine\ORM\PersistentCollection {#1867 …}
    +categories: Doctrine\ORM\PersistentCollection {#1880 …}
    -id: 42482
    -password: "$2y$13$NhIMiF1JXctMkB.To0A1l.9Yf5tUWEmnsXRxLOIoPHjfEy4B2UkMe"
    -totpSecret: null
    -totpBackupCodes: []
    -oAuth2UserConsents: Doctrine\ORM\PersistentCollection {#1894 …}
    +apId: "Yonrak@feddit.uk"
    +apProfileId: "https://feddit.uk/u/Yonrak"
    +apPublicUrl: "https://feddit.uk/u/Yonrak"
    +apFollowersUrl: null
    +apInboxUrl: "https://feddit.uk/inbox"
    +apDomain: "feddit.uk"
    +apPreferredUsername: "Yonrak"
    +apDiscoverable: true
    +apManuallyApprovesFollowers: false
    +privateKey: null
    +publicKey: null
    +apFetchedAt: DateTime @1692955883 {#269
      date: 2023-08-25 11:31:23.0 +02:00
    }
    +apDeletedAt: null
    +apTimeoutAt: null
    +visibility: "visible             "
    +createdAt: DateTimeImmutable @1692950596 {#268
      date: 2023-08-25 10:03:16.0 +02:00
    }
  }
}
entry App\Twig\Components\EntryComponent 12.0 MiB 11.22 ms
Input props
[
  "entry" => Proxies\__CG__\App\Entity\Entry {#1591
    +user: Proxies\__CG__\App\Entity\User {#2459
      +avatar: null
      +cover: null
      +email: "nilclass@discuss.tchncs.de"
      +username: "@nilclass@discuss.tchncs.de"
      +roles: []
      +followersCount: 0
      +homepage: "front"
      +about: null
      +lastActive: DateTime @1721268563 {#3096
        date: 2024-07-18 04:09:23.0 +02:00
      }
      +markedForDeletionAt: null
      +fields: null
      +oauthGithubId: null
      +oauthGoogleId: null
      +oauthFacebookId: null
      +oauthKeycloakId: null
      +hideAdult: true
      +showSubscribedUsers: true
      +showSubscribedMagazines: true
      +showSubscribedDomains: true
      +preferredLanguages: []
      +featuredMagazines: null
      +showProfileSubscriptions: true
      +showProfileFollowings: true
      +markNewComments: false
      +notifyOnNewEntry: false
      +notifyOnNewEntryReply: false
      +notifyOnNewEntryCommentReply: false
      +notifyOnNewPost: false
      +notifyOnNewPostReply: false
      +notifyOnNewPostCommentReply: false
      +addMentionsEntries: false
      +addMentionsPosts: true
      +isBanned: false
      +isVerified: false
      +isDeleted: false
      +isBot: false
      +spamProtection: true
      +customCss: null
      +ignoreMagazinesCustomCss: false
      +moderatorTokens: Doctrine\ORM\PersistentCollection {#3099 …}
      +magazineOwnershipRequests: Doctrine\ORM\PersistentCollection {#3101 …}
      +moderatorRequests: Doctrine\ORM\PersistentCollection {#3103 …}
      +entries: Doctrine\ORM\PersistentCollection {#3105 …}
      +entryVotes: Doctrine\ORM\PersistentCollection {#3107 …}
      +entryComments: Doctrine\ORM\PersistentCollection {#3109 …}
      +entryCommentVotes: Doctrine\ORM\PersistentCollection {#3111 …}
      +posts: Doctrine\ORM\PersistentCollection {#3113 …}
      +postVotes: Doctrine\ORM\PersistentCollection {#3115 …}
      +postComments: Doctrine\ORM\PersistentCollection {#3117 …}
      +postCommentVotes: Doctrine\ORM\PersistentCollection {#3119 …}
      +subscriptions: Doctrine\ORM\PersistentCollection {#3121 …}
      +subscribedDomains: Doctrine\ORM\PersistentCollection {#3123 …}
      +follows: Doctrine\ORM\PersistentCollection {#3125 …}
      +followers: Doctrine\ORM\PersistentCollection {#3127 …}
      +blocks: Doctrine\ORM\PersistentCollection {#3129 …}
      +blockers: Doctrine\ORM\PersistentCollection {#3131 …}
      +blockedMagazines: Doctrine\ORM\PersistentCollection {#3133 …}
      +blockedDomains: Doctrine\ORM\PersistentCollection {#3135 …}
      +reports: Doctrine\ORM\PersistentCollection {#3137 …}
      +favourites: Doctrine\ORM\PersistentCollection {#3139 …}
      +violations: Doctrine\ORM\PersistentCollection {#3141 …}
      +notifications: Doctrine\ORM\PersistentCollection {#3143 …}
      +awards: Doctrine\ORM\PersistentCollection {#3145 …}
      +subscribedCategories: Doctrine\ORM\PersistentCollection {#3147 …}
      +categories: Doctrine\ORM\PersistentCollection {#3149 …}
      -id: 6046
      -password: "$2y$13$FEroXtR95mjA6.omogLZRe7NJuWUL6hb.9a/FfXkqyIPnPgg4Apme"
      -totpSecret: null
      -totpBackupCodes: []
      -oAuth2UserConsents: Doctrine\ORM\PersistentCollection {#3151 …}
      +apId: "nilclass@discuss.tchncs.de"
      +apProfileId: "https://discuss.tchncs.de/u/nilclass"
      +apPublicUrl: "https://discuss.tchncs.de/u/nilclass"
      +apFollowersUrl: null
      +apInboxUrl: "https://discuss.tchncs.de/inbox"
      +apDomain: "discuss.tchncs.de"
      +apPreferredUsername: "nilclass"
      +apDiscoverable: true
      +apManuallyApprovesFollowers: false
      +privateKey: null
      +publicKey: null
      +apFetchedAt: DateTime @1720630912 {#3097
        date: 2024-07-10 19:01:52.0 +02:00
      }
      +apDeletedAt: null
      +apTimeoutAt: null
      +visibility: "visible             "
      +createdAt: DateTimeImmutable @1687291240 {#3098
        date: 2023-06-20 22:00:40.0 +02:00
      }
      +__isInitialized__: true
       …2
    }
    +magazine: Proxies\__CG__\App\Entity\Magazine {#1584
      +icon: Proxies\__CG__\App\Entity\Image {#2886 …}
      +name: "askelectronics@discuss.tchncs.de"
      +title: "askelectronics"
      +description: """
        **For questions about component-level electronic circuits, tools and equipment.**\n
        \n
        Rules\n
        -----\n
        \n
        1: Be nice.\n
        \n
        2: Be on-topic (eg: *Electronic*, not *electrical*).\n
        \n
        3: No commercial stuff, buying, selling or valuations.\n
        \n
        4: Be safe.\n
        \n
        ---
        """
      +rules: null
      +subscriptionsCount: 1
      +entryCount: 154
      +entryCommentCount: 1230
      +postCount: 1
      +postCommentCount: 4
      +isAdult: false
      +customCss: null
      +lastActive: DateTime @1729413608 {#2865
        date: 2024-10-20 10:40:08.0 +02:00
      }
      +markedForDeletionAt: null
      +tags: null
      +moderators: Doctrine\ORM\PersistentCollection {#2885 …}
      +ownershipRequests: Doctrine\ORM\PersistentCollection {#2883 …}
      +moderatorRequests: Doctrine\ORM\PersistentCollection {#2888 …}
      +entries: Doctrine\ORM\PersistentCollection {#2889 …}
      +posts: Doctrine\ORM\PersistentCollection {#2892 …}
      +subscriptions: Doctrine\ORM\PersistentCollection {#2894 …}
      +bans: Doctrine\ORM\PersistentCollection {#2900 …}
      +reports: Doctrine\ORM\PersistentCollection {#2908 …}
      +badges: Doctrine\ORM\PersistentCollection {#2921 …}
      +logs: Doctrine\ORM\PersistentCollection {#2931 …}
      +awards: Doctrine\ORM\PersistentCollection {#2913 …}
      +categories: Doctrine\ORM\PersistentCollection {#2937 …}
      -id: 11
      +apId: "askelectronics@discuss.tchncs.de"
      +apProfileId: "https://discuss.tchncs.de/c/askelectronics"
      +apPublicUrl: "https://discuss.tchncs.de/c/askelectronics"
      +apFollowersUrl: "https://discuss.tchncs.de/c/askelectronics/followers"
      +apInboxUrl: "https://discuss.tchncs.de/inbox"
      +apDomain: "discuss.tchncs.de"
      +apPreferredUsername: "askelectronics"
      +apDiscoverable: true
      +apManuallyApprovesFollowers: null
      +privateKey: null
      +publicKey: null
      +apFetchedAt: DateTime @1727247714 {#2866
        date: 2024-09-25 09:01:54.0 +02:00
      }
      +apDeletedAt: null
      +apTimeoutAt: null
      +visibility: "visible             "
      +createdAt: DateTimeImmutable @1687144409 {#2867
        date: 2023-06-19 05:13:29.0 +02:00
      }
      +__isInitialized__: true
       …2
    }
    +image: null
    +domain: Proxies\__CG__\App\Entity\Domain {#1630 …}
    +slug: "How-to-improve-my-battery-measurement-circuit"
    +title: "How to improve my battery measurement circuit?"
    +url: null
    +body: """
      I am powering a 5V microcontroller (arduino clone, atmega328p) using a 9V block and a buck converter. Now I want to let the microcontroller occasionally measure the battery voltage, so I can get an idea of how full it is.\n
      \n
      My first idea was to use a simple voltage divider:\n
      \n
      ![](https://discuss.tchncs.de/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)\n
      \n
      I’ve chosen the resistor values so that:\n
      \n
      - the voltage at the measure output is `< 1.1V`, to be able to use the 1.1V internal reference of the atmega’s ADC\n
      - `R1 || R2 < 10kΩ`, since the atmega datasheet says “The ADC is optimized for analog signals with an output impedance of approximately 10 kΩ or less”\n
      \n
      This is great and all, but what bothers me is that this circuit will constantly draw ~100µA from the battery.\n
      \n
      So, my next thought was to add a mosfet to the divider, to switch it on only while measuring:\n
      \n
      ![](https://discuss.tchncs.de/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)\n
      \n
      This is obviously bad, because now when the mosfet is off, the ADC input sees the whole battery voltage.\n
      \n
      To address that issue, I’ve added a second mosfet into the measure path:\n
      \n
      ![](https://discuss.tchncs.de/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)\n
      \n
      This works, and it does not draw any current, except while measuring.\n
      \n
      However, it’s quite a few parts. So I’m curious if anyone has an idea how to do this with just a single mosfet. It seems to me like it should be possible, but I haven’t figured out how.\n
      \n
      Oh, and if I’m doing something stupid here, please tell me :)
      """
    +type: "article"
    +lang: "en"
    +isOc: false
    +hasEmbed: false
    +commentCount: 11
    +favouriteCount: 17
    +score: 0
    +isAdult: false
    +sticky: false
    +lastActive: DateTime @1694781042 {#1715
      date: 2023-09-15 14:30:42.0 +02:00
    }
    +ip: null
    +adaAmount: 0
    +tags: null
    +mentions: null
    +comments: Doctrine\ORM\PersistentCollection {#1629 …}
    +votes: Doctrine\ORM\PersistentCollection {#1626 …}
    +reports: Doctrine\ORM\PersistentCollection {#1625 …}
    +favourites: Doctrine\ORM\PersistentCollection {#2370 …}
    +notifications: Doctrine\ORM\PersistentCollection {#2371 …}
    +badges: Doctrine\ORM\PersistentCollection {#1708 …}
    +children: [
      1 => App\Entity\EntryComment {#1709
        +user: App\Entity\User {#265
          +avatar: null
          +cover: null
          +email: "Yonrak@feddit.uk"
          +username: "@Yonrak@feddit.uk"
          +roles: []
          +followersCount: 0
          +homepage: "front"
          +about: null
          +lastActive: DateTime @1692955883 {#275
            date: 2023-08-25 11:31:23.0 +02:00
          }
          +markedForDeletionAt: null
          +fields: null
          +oauthGithubId: null
          +oauthGoogleId: null
          +oauthFacebookId: null
          +oauthKeycloakId: null
          +hideAdult: true
          +showSubscribedUsers: true
          +showSubscribedMagazines: true
          +showSubscribedDomains: true
          +preferredLanguages: []
          +featuredMagazines: null
          +showProfileSubscriptions: false
          +showProfileFollowings: true
          +markNewComments: false
          +notifyOnNewEntry: false
          +notifyOnNewEntryReply: true
          +notifyOnNewEntryCommentReply: true
          +notifyOnNewPost: false
          +notifyOnNewPostReply: true
          +notifyOnNewPostCommentReply: true
          +addMentionsEntries: false
          +addMentionsPosts: true
          +isBanned: false
          +isVerified: false
          +isDeleted: false
          +isBot: false
          +spamProtection: true
          +customCss: null
          +ignoreMagazinesCustomCss: false
          +moderatorTokens: Doctrine\ORM\PersistentCollection {#253 …}
          +magazineOwnershipRequests: Doctrine\ORM\PersistentCollection {#249 …}
          +moderatorRequests: Doctrine\ORM\PersistentCollection {#238 …}
          +entries: Doctrine\ORM\PersistentCollection {#196 …}
          +entryVotes: Doctrine\ORM\PersistentCollection {#168 …}
          +entryComments: Doctrine\ORM\PersistentCollection {#141 …}
          +entryCommentVotes: Doctrine\ORM\PersistentCollection {#111 …}
          +posts: Doctrine\ORM\PersistentCollection {#84 …}
          +postVotes: Doctrine\ORM\PersistentCollection {#99 …}
          +postComments: Doctrine\ORM\PersistentCollection {#1863 …}
          +postCommentVotes: Doctrine\ORM\PersistentCollection {#1479 …}
          +subscriptions: Doctrine\ORM\PersistentCollection {#1658 …}
          +subscribedDomains: Doctrine\ORM\PersistentCollection {#1868 …}
          +follows: Doctrine\ORM\PersistentCollection {#1917 …}
          +followers: Doctrine\ORM\PersistentCollection {#1601 …}
          +blocks: Doctrine\ORM\PersistentCollection {#1805 …}
          +blockers: Doctrine\ORM\PersistentCollection {#1810 …}
          +blockedMagazines: Doctrine\ORM\PersistentCollection {#1857 …}
          +blockedDomains: Doctrine\ORM\PersistentCollection {#1860 …}
          +reports: Doctrine\ORM\PersistentCollection {#1791 …}
          +favourites: Doctrine\ORM\PersistentCollection {#2416 …}
          +violations: Doctrine\ORM\PersistentCollection {#1824 …}
          +notifications: Doctrine\ORM\PersistentCollection {#1914 …}
          +awards: Doctrine\ORM\PersistentCollection {#1929 …}
          +subscribedCategories: Doctrine\ORM\PersistentCollection {#1867 …}
          +categories: Doctrine\ORM\PersistentCollection {#1880 …}
          -id: 42482
          -password: "$2y$13$NhIMiF1JXctMkB.To0A1l.9Yf5tUWEmnsXRxLOIoPHjfEy4B2UkMe"
          -totpSecret: null
          -totpBackupCodes: []
          -oAuth2UserConsents: Doctrine\ORM\PersistentCollection {#1894 …}
          +apId: "Yonrak@feddit.uk"
          +apProfileId: "https://feddit.uk/u/Yonrak"
          +apPublicUrl: "https://feddit.uk/u/Yonrak"
          +apFollowersUrl: null
          +apInboxUrl: "https://feddit.uk/inbox"
          +apDomain: "feddit.uk"
          +apPreferredUsername: "Yonrak"
          +apDiscoverable: true
          +apManuallyApprovesFollowers: false
          +privateKey: null
          +publicKey: null
          +apFetchedAt: DateTime @1692955883 {#269
            date: 2023-08-25 11:31:23.0 +02:00
          }
          +apDeletedAt: null
          +apTimeoutAt: null
          +visibility: "visible             "
          +createdAt: DateTimeImmutable @1692950596 {#268
            date: 2023-08-25 10:03:16.0 +02:00
          }
        }
        +entry: Proxies\__CG__\App\Entity\Entry {#1591 …2}
        +magazine: Proxies\__CG__\App\Entity\Magazine {#1584 …2}
        +image: null
        +parent: null
        +root: null
        +body: """
          Could you do similar to diagram 2, but instead of an N-FET use a P-FET between the battery and first resistor in the potential divider?\n
          \n
          Add a gate pull up resistor to source to ensure the FET is off by default, have the micro pull the gate down to take a measurement. You’ll probably need to add another resistor on the control pin to 0V to limit the voltage there also, but those two can be much much higher values to really limit current. Or use a zener/TVS diode instead of second resistor to clamp the voltage instead of dividing (more robust).\n
          \n
          Switch it with an NFET\n
          \n
          The micro will see 0V or divided/clamped battery voltage on the measurement pin.
          """
        +lang: "en"
        +isAdult: false
        +favouriteCount: 3
        +score: 0
        +lastActive: DateTime @1692955883 {#1439
          date: 2023-08-25 11:31:23.0 +02:00
        }
        +ip: null
        +tags: null
        +mentions: [
          "@nilclass@discuss.tchncs.de"
        ]
        +children: Doctrine\ORM\PersistentCollection {#1579 …}
        +nested: Doctrine\ORM\PersistentCollection {#1577 …}
        +votes: Doctrine\ORM\PersistentCollection {#1578 …}
        +reports: Doctrine\ORM\PersistentCollection {#1571 …}
        +favourites: Doctrine\ORM\PersistentCollection {#1574 …}
        +notifications: Doctrine\ORM\PersistentCollection {#1667 …}
        -id: 26779
        -bodyTs: "'0v':70,117 '2':7 'add':30,62 'also':76 'anoth':63 'batteri':22,120 'clamp':100 'control':67 'could':1 'current':89 'default':45 'diagram':6 'diod':94 'divid':29,105 'divided/clamped':119 'ensur':39 'fet':14,19,41 'first':24 'gate':32,51 'higher':84 'instead':9,95,103 'limit':72,88 'll':58 'measur':56,124 'micro':48,114 'much':82,83 'n':13 'n-fet':12 'need':60 'nfet':112 'p':18 'p-fet':17 'pin':68,125 'potenti':28 'probabl':59 'pull':33,49 'realli':87 'resistor':25,35,64,98 'robust':107 'second':97 'see':116 'similar':4 'sourc':37 'switch':108 'take':54 'two':79 'use':15,91 'valu':85 'voltag':74,102,121 'zener/tvs':93"
        +ranking: 0
        +commentCount: 0
        +upVotes: 0
        +downVotes: 0
        +visibility: "visible             "
        +apId: "https://feddit.uk/comment/2185380"
        +editedAt: DateTimeImmutable @1692969047 {#1435
          date: 2023-08-25 15:10:47.0 +02:00
        }
        +createdAt: DateTimeImmutable @1692950595 {#1436
          date: 2023-08-25 10:03:15.0 +02:00
        }
        +"title": 26779
      }
      0 => App\Entity\EntryComment {#1549
        +user: App\Entity\User {#265}
        +entry: Proxies\__CG__\App\Entity\Entry {#1591 …2}
        +magazine: Proxies\__CG__\App\Entity\Magazine {#1584 …2}
        +image: null
        +parent: Proxies\__CG__\App\Entity\EntryComment {#1692 …}
        +root: App\Entity\EntryComment {#1709}
        +body: """
          > Not sure I understand this point. Which resistor would you replace with a diode?\n
          \n
          Sorry, I think I was talking nonesense (doing this in my head and just woke up 😅).\n
          \n
          Not sure it’ll work with just a P-FET actually. You’ll likely need to control the PFET with a NFET, otherwise you still end up with too high a voltage on your control pin when the FET is off due to the gate pullup (unless you can use a fet with a very high Vgs Threshold and then drive it push/pull from the micro, but this isn’t really best practice).\n
          \n
          The above comment about diodes was to protect the microcontroller pin, but you end up not being able to control the FET doing it that way.\n
          \n
          I think either your existing Option 3 or PFET upstream of the divider, switched via an N-FET is the way to go.
          """
        +lang: "en"
        +isAdult: false
        +favouriteCount: 2
        +score: 0
        +lastActive: DateTime @1692955881 {#1673
          date: 2023-08-25 11:31:21.0 +02:00
        }
        +ip: null
        +tags: null
        +mentions: [
          "@nilclass@discuss.tchncs.de"
          "@Yonrak@feddit.uk"
        ]
        +children: Doctrine\ORM\PersistentCollection {#1691 …}
        +nested: Doctrine\ORM\PersistentCollection {#1680 …}
        +votes: Doctrine\ORM\PersistentCollection {#1683 …}
        +reports: Doctrine\ORM\PersistentCollection {#1702 …}
        +favourites: Doctrine\ORM\PersistentCollection {#1596 …}
        +notifications: Doctrine\ORM\PersistentCollection {#1613 …}
        -id: 26782
        -bodyTs: "'3':137 'abl':122 'actual':42 'best':103 'comment':107 'control':48,66,124 'diod':14,109 'divid':143 'drive':92 'due':73 'either':133 'end':57,118 'exist':135 'fet':41,70,83,126,149 'gate':76 'go':154 'head':26 'high':61,87 'isn':100 'like':45 'll':34,44 'micro':97 'microcontrol':114 'n':148 'n-fet':147 'need':46 'nfet':53 'nonesens':21 'option':136 'otherwis':54 'p':40 'p-fet':39 'pfet':50,139 'pin':67,115 'point':6 'practic':104 'protect':112 'pullup':77 'push/pull':94 'realli':102 'replac':11 'resistor':8 'sorri':15 'still':56 'sure':2,32 'switch':144 'talk':20 'think':17,132 'threshold':89 'understand':4 'unless':78 'upstream':140 'use':81 'vgs':88 'via':145 'voltag':63 'way':130,152 'woke':29 'work':35 'would':9"
        +ranking: 0
        +commentCount: 0
        +upVotes: 0
        +downVotes: 0
        +visibility: "visible             "
        +apId: "https://feddit.uk/comment/2186641"
        +editedAt: DateTimeImmutable @1692956099 {#1560
          date: 2023-08-25 11:34:59.0 +02:00
        }
        +createdAt: DateTimeImmutable @1692955881 {#1568
          date: 2023-08-25 11:31:21.0 +02:00
        }
        +"title": 26782
      }
    ]
    -id: 1944
    -titleTs: "'batteri':5 'circuit':7 'improv':3 'measur':6"
    -bodyTs: "'/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)':152 '/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)':188 '/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)':53 '1.1':69,77 '10':107 '100µa':127 '10kω':88 '5v':5 '9v':12 'abl':73 'ad':178 'adc':85,95,165 'add':137 'address':173 'analog':99 'anyon':213 'approxim':106 'arduino':7 'atmega':83,91 'atmega328p':9 'bad':156 'batteri':28,130,170 'block':13 'bother':118 'buck':16 'chosen':56 'circuit':123 'clone':8 'constant':125 'convert':17 'curious':211 'current':197 'datasheet':92 'discuss.tchncs.de':52,151,187 'discuss.tchncs.de/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)':150 'discuss.tchncs.de/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)':186 'discuss.tchncs.de/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)':51 'divid':50,142 'draw':126,195 'except':198 'figur':239 'first':42 'full':38 'get':33 'great':113 'haven':237 'howev':201 'idea':35,43,216 'imped':104 'input':166 'intern':79 'issu':175 'kω':108 'less':110 'let':22 'like':230 'm':210,246 'measur':26,66,149,184,200 'microcontrol':6,24 'mosfet':139,161,181,225 'next':133 'obvious':155 'occasion':25 'oh':242 'optim':97 'output':67,103 'part':207 'path':185 'pleas':251 'possibl':234 'power':3 'quit':204 'r1':86 'r2':87 'refer':80 'resistor':58 'say':93 'second':180 'see':167 'seem':227 'signal':100 'simpl':48 'sinc':89 'singl':224 'someth':248 'stupid':249 'switch':144 'tell':252 'thought':134 'use':10,46,75 'v':70,78 'valu':59 've':55,177 'voltag':29,49,63,171 'want':20 'whole':169 'work':190"
    +cross: false
    +upVotes: 0
    +downVotes: 0
    +ranking: 1693029637
    +visibility: "visible             "
    +apId: "https://discuss.tchncs.de/post/2309537"
    +editedAt: DateTimeImmutable @1692947232 {#1693
      date: 2023-08-25 09:07:12.0 +02:00
    }
    +createdAt: DateTimeImmutable @1692947137 {#1740
      date: 2023-08-25 09:05:37.0 +02:00
    }
    +__isInitialized__: true
     …2
  }
  "dateAsUrl" => true
]
Attributes
[
  "dateAsUrl" => true
]
Component
App\Twig\Components\EntryComponent {#2812
  -authorizationChecker: Symfony\Component\Security\Core\Authorization\AuthorizationChecker {#931 …}
  -newCommentMarkerCount: App\Kbin\NewCommentMarker\NewCommentMarkerCount {#2813 …}
  -cache: Symfony\Component\Cache\Adapter\TraceableTagAwareAdapter {#600 …}
  -twig: Twig\Environment {#1252 …}
  -requestStack: Symfony\Component\HttpFoundation\RequestStack {#1328 …}
  -security: Symfony\Bundle\SecurityBundle\Security {#1101 …}
  +entry: Proxies\__CG__\App\Entity\Entry {#1591
    +user: Proxies\__CG__\App\Entity\User {#2459
      +avatar: null
      +cover: null
      +email: "nilclass@discuss.tchncs.de"
      +username: "@nilclass@discuss.tchncs.de"
      +roles: []
      +followersCount: 0
      +homepage: "front"
      +about: null
      +lastActive: DateTime @1721268563 {#3096
        date: 2024-07-18 04:09:23.0 +02:00
      }
      +markedForDeletionAt: null
      +fields: null
      +oauthGithubId: null
      +oauthGoogleId: null
      +oauthFacebookId: null
      +oauthKeycloakId: null
      +hideAdult: true
      +showSubscribedUsers: true
      +showSubscribedMagazines: true
      +showSubscribedDomains: true
      +preferredLanguages: []
      +featuredMagazines: null
      +showProfileSubscriptions: true
      +showProfileFollowings: true
      +markNewComments: false
      +notifyOnNewEntry: false
      +notifyOnNewEntryReply: false
      +notifyOnNewEntryCommentReply: false
      +notifyOnNewPost: false
      +notifyOnNewPostReply: false
      +notifyOnNewPostCommentReply: false
      +addMentionsEntries: false
      +addMentionsPosts: true
      +isBanned: false
      +isVerified: false
      +isDeleted: false
      +isBot: false
      +spamProtection: true
      +customCss: null
      +ignoreMagazinesCustomCss: false
      +moderatorTokens: Doctrine\ORM\PersistentCollection {#3099 …}
      +magazineOwnershipRequests: Doctrine\ORM\PersistentCollection {#3101 …}
      +moderatorRequests: Doctrine\ORM\PersistentCollection {#3103 …}
      +entries: Doctrine\ORM\PersistentCollection {#3105 …}
      +entryVotes: Doctrine\ORM\PersistentCollection {#3107 …}
      +entryComments: Doctrine\ORM\PersistentCollection {#3109 …}
      +entryCommentVotes: Doctrine\ORM\PersistentCollection {#3111 …}
      +posts: Doctrine\ORM\PersistentCollection {#3113 …}
      +postVotes: Doctrine\ORM\PersistentCollection {#3115 …}
      +postComments: Doctrine\ORM\PersistentCollection {#3117 …}
      +postCommentVotes: Doctrine\ORM\PersistentCollection {#3119 …}
      +subscriptions: Doctrine\ORM\PersistentCollection {#3121 …}
      +subscribedDomains: Doctrine\ORM\PersistentCollection {#3123 …}
      +follows: Doctrine\ORM\PersistentCollection {#3125 …}
      +followers: Doctrine\ORM\PersistentCollection {#3127 …}
      +blocks: Doctrine\ORM\PersistentCollection {#3129 …}
      +blockers: Doctrine\ORM\PersistentCollection {#3131 …}
      +blockedMagazines: Doctrine\ORM\PersistentCollection {#3133 …}
      +blockedDomains: Doctrine\ORM\PersistentCollection {#3135 …}
      +reports: Doctrine\ORM\PersistentCollection {#3137 …}
      +favourites: Doctrine\ORM\PersistentCollection {#3139 …}
      +violations: Doctrine\ORM\PersistentCollection {#3141 …}
      +notifications: Doctrine\ORM\PersistentCollection {#3143 …}
      +awards: Doctrine\ORM\PersistentCollection {#3145 …}
      +subscribedCategories: Doctrine\ORM\PersistentCollection {#3147 …}
      +categories: Doctrine\ORM\PersistentCollection {#3149 …}
      -id: 6046
      -password: "$2y$13$FEroXtR95mjA6.omogLZRe7NJuWUL6hb.9a/FfXkqyIPnPgg4Apme"
      -totpSecret: null
      -totpBackupCodes: []
      -oAuth2UserConsents: Doctrine\ORM\PersistentCollection {#3151 …}
      +apId: "nilclass@discuss.tchncs.de"
      +apProfileId: "https://discuss.tchncs.de/u/nilclass"
      +apPublicUrl: "https://discuss.tchncs.de/u/nilclass"
      +apFollowersUrl: null
      +apInboxUrl: "https://discuss.tchncs.de/inbox"
      +apDomain: "discuss.tchncs.de"
      +apPreferredUsername: "nilclass"
      +apDiscoverable: true
      +apManuallyApprovesFollowers: false
      +privateKey: null
      +publicKey: null
      +apFetchedAt: DateTime @1720630912 {#3097
        date: 2024-07-10 19:01:52.0 +02:00
      }
      +apDeletedAt: null
      +apTimeoutAt: null
      +visibility: "visible             "
      +createdAt: DateTimeImmutable @1687291240 {#3098
        date: 2023-06-20 22:00:40.0 +02:00
      }
      +__isInitialized__: true
       …2
    }
    +magazine: Proxies\__CG__\App\Entity\Magazine {#1584
      +icon: Proxies\__CG__\App\Entity\Image {#2886 …}
      +name: "askelectronics@discuss.tchncs.de"
      +title: "askelectronics"
      +description: """
        **For questions about component-level electronic circuits, tools and equipment.**\n
        \n
        Rules\n
        -----\n
        \n
        1: Be nice.\n
        \n
        2: Be on-topic (eg: *Electronic*, not *electrical*).\n
        \n
        3: No commercial stuff, buying, selling or valuations.\n
        \n
        4: Be safe.\n
        \n
        ---
        """
      +rules: null
      +subscriptionsCount: 1
      +entryCount: 154
      +entryCommentCount: 1230
      +postCount: 1
      +postCommentCount: 4
      +isAdult: false
      +customCss: null
      +lastActive: DateTime @1729413608 {#2865
        date: 2024-10-20 10:40:08.0 +02:00
      }
      +markedForDeletionAt: null
      +tags: null
      +moderators: Doctrine\ORM\PersistentCollection {#2885 …}
      +ownershipRequests: Doctrine\ORM\PersistentCollection {#2883 …}
      +moderatorRequests: Doctrine\ORM\PersistentCollection {#2888 …}
      +entries: Doctrine\ORM\PersistentCollection {#2889 …}
      +posts: Doctrine\ORM\PersistentCollection {#2892 …}
      +subscriptions: Doctrine\ORM\PersistentCollection {#2894 …}
      +bans: Doctrine\ORM\PersistentCollection {#2900 …}
      +reports: Doctrine\ORM\PersistentCollection {#2908 …}
      +badges: Doctrine\ORM\PersistentCollection {#2921 …}
      +logs: Doctrine\ORM\PersistentCollection {#2931 …}
      +awards: Doctrine\ORM\PersistentCollection {#2913 …}
      +categories: Doctrine\ORM\PersistentCollection {#2937 …}
      -id: 11
      +apId: "askelectronics@discuss.tchncs.de"
      +apProfileId: "https://discuss.tchncs.de/c/askelectronics"
      +apPublicUrl: "https://discuss.tchncs.de/c/askelectronics"
      +apFollowersUrl: "https://discuss.tchncs.de/c/askelectronics/followers"
      +apInboxUrl: "https://discuss.tchncs.de/inbox"
      +apDomain: "discuss.tchncs.de"
      +apPreferredUsername: "askelectronics"
      +apDiscoverable: true
      +apManuallyApprovesFollowers: null
      +privateKey: null
      +publicKey: null
      +apFetchedAt: DateTime @1727247714 {#2866
        date: 2024-09-25 09:01:54.0 +02:00
      }
      +apDeletedAt: null
      +apTimeoutAt: null
      +visibility: "visible             "
      +createdAt: DateTimeImmutable @1687144409 {#2867
        date: 2023-06-19 05:13:29.0 +02:00
      }
      +__isInitialized__: true
       …2
    }
    +image: null
    +domain: Proxies\__CG__\App\Entity\Domain {#1630 …}
    +slug: "How-to-improve-my-battery-measurement-circuit"
    +title: "How to improve my battery measurement circuit?"
    +url: null
    +body: """
      I am powering a 5V microcontroller (arduino clone, atmega328p) using a 9V block and a buck converter. Now I want to let the microcontroller occasionally measure the battery voltage, so I can get an idea of how full it is.\n
      \n
      My first idea was to use a simple voltage divider:\n
      \n
      ![](https://discuss.tchncs.de/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)\n
      \n
      I’ve chosen the resistor values so that:\n
      \n
      - the voltage at the measure output is `< 1.1V`, to be able to use the 1.1V internal reference of the atmega’s ADC\n
      - `R1 || R2 < 10kΩ`, since the atmega datasheet says “The ADC is optimized for analog signals with an output impedance of approximately 10 kΩ or less”\n
      \n
      This is great and all, but what bothers me is that this circuit will constantly draw ~100µA from the battery.\n
      \n
      So, my next thought was to add a mosfet to the divider, to switch it on only while measuring:\n
      \n
      ![](https://discuss.tchncs.de/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)\n
      \n
      This is obviously bad, because now when the mosfet is off, the ADC input sees the whole battery voltage.\n
      \n
      To address that issue, I’ve added a second mosfet into the measure path:\n
      \n
      ![](https://discuss.tchncs.de/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)\n
      \n
      This works, and it does not draw any current, except while measuring.\n
      \n
      However, it’s quite a few parts. So I’m curious if anyone has an idea how to do this with just a single mosfet. It seems to me like it should be possible, but I haven’t figured out how.\n
      \n
      Oh, and if I’m doing something stupid here, please tell me :)
      """
    +type: "article"
    +lang: "en"
    +isOc: false
    +hasEmbed: false
    +commentCount: 11
    +favouriteCount: 17
    +score: 0
    +isAdult: false
    +sticky: false
    +lastActive: DateTime @1694781042 {#1715
      date: 2023-09-15 14:30:42.0 +02:00
    }
    +ip: null
    +adaAmount: 0
    +tags: null
    +mentions: null
    +comments: Doctrine\ORM\PersistentCollection {#1629 …}
    +votes: Doctrine\ORM\PersistentCollection {#1626 …}
    +reports: Doctrine\ORM\PersistentCollection {#1625 …}
    +favourites: Doctrine\ORM\PersistentCollection {#2370 …}
    +notifications: Doctrine\ORM\PersistentCollection {#2371 …}
    +badges: Doctrine\ORM\PersistentCollection {#1708 …}
    +children: [
      1 => App\Entity\EntryComment {#1709
        +user: App\Entity\User {#265
          +avatar: null
          +cover: null
          +email: "Yonrak@feddit.uk"
          +username: "@Yonrak@feddit.uk"
          +roles: []
          +followersCount: 0
          +homepage: "front"
          +about: null
          +lastActive: DateTime @1692955883 {#275
            date: 2023-08-25 11:31:23.0 +02:00
          }
          +markedForDeletionAt: null
          +fields: null
          +oauthGithubId: null
          +oauthGoogleId: null
          +oauthFacebookId: null
          +oauthKeycloakId: null
          +hideAdult: true
          +showSubscribedUsers: true
          +showSubscribedMagazines: true
          +showSubscribedDomains: true
          +preferredLanguages: []
          +featuredMagazines: null
          +showProfileSubscriptions: false
          +showProfileFollowings: true
          +markNewComments: false
          +notifyOnNewEntry: false
          +notifyOnNewEntryReply: true
          +notifyOnNewEntryCommentReply: true
          +notifyOnNewPost: false
          +notifyOnNewPostReply: true
          +notifyOnNewPostCommentReply: true
          +addMentionsEntries: false
          +addMentionsPosts: true
          +isBanned: false
          +isVerified: false
          +isDeleted: false
          +isBot: false
          +spamProtection: true
          +customCss: null
          +ignoreMagazinesCustomCss: false
          +moderatorTokens: Doctrine\ORM\PersistentCollection {#253 …}
          +magazineOwnershipRequests: Doctrine\ORM\PersistentCollection {#249 …}
          +moderatorRequests: Doctrine\ORM\PersistentCollection {#238 …}
          +entries: Doctrine\ORM\PersistentCollection {#196 …}
          +entryVotes: Doctrine\ORM\PersistentCollection {#168 …}
          +entryComments: Doctrine\ORM\PersistentCollection {#141 …}
          +entryCommentVotes: Doctrine\ORM\PersistentCollection {#111 …}
          +posts: Doctrine\ORM\PersistentCollection {#84 …}
          +postVotes: Doctrine\ORM\PersistentCollection {#99 …}
          +postComments: Doctrine\ORM\PersistentCollection {#1863 …}
          +postCommentVotes: Doctrine\ORM\PersistentCollection {#1479 …}
          +subscriptions: Doctrine\ORM\PersistentCollection {#1658 …}
          +subscribedDomains: Doctrine\ORM\PersistentCollection {#1868 …}
          +follows: Doctrine\ORM\PersistentCollection {#1917 …}
          +followers: Doctrine\ORM\PersistentCollection {#1601 …}
          +blocks: Doctrine\ORM\PersistentCollection {#1805 …}
          +blockers: Doctrine\ORM\PersistentCollection {#1810 …}
          +blockedMagazines: Doctrine\ORM\PersistentCollection {#1857 …}
          +blockedDomains: Doctrine\ORM\PersistentCollection {#1860 …}
          +reports: Doctrine\ORM\PersistentCollection {#1791 …}
          +favourites: Doctrine\ORM\PersistentCollection {#2416 …}
          +violations: Doctrine\ORM\PersistentCollection {#1824 …}
          +notifications: Doctrine\ORM\PersistentCollection {#1914 …}
          +awards: Doctrine\ORM\PersistentCollection {#1929 …}
          +subscribedCategories: Doctrine\ORM\PersistentCollection {#1867 …}
          +categories: Doctrine\ORM\PersistentCollection {#1880 …}
          -id: 42482
          -password: "$2y$13$NhIMiF1JXctMkB.To0A1l.9Yf5tUWEmnsXRxLOIoPHjfEy4B2UkMe"
          -totpSecret: null
          -totpBackupCodes: []
          -oAuth2UserConsents: Doctrine\ORM\PersistentCollection {#1894 …}
          +apId: "Yonrak@feddit.uk"
          +apProfileId: "https://feddit.uk/u/Yonrak"
          +apPublicUrl: "https://feddit.uk/u/Yonrak"
          +apFollowersUrl: null
          +apInboxUrl: "https://feddit.uk/inbox"
          +apDomain: "feddit.uk"
          +apPreferredUsername: "Yonrak"
          +apDiscoverable: true
          +apManuallyApprovesFollowers: false
          +privateKey: null
          +publicKey: null
          +apFetchedAt: DateTime @1692955883 {#269
            date: 2023-08-25 11:31:23.0 +02:00
          }
          +apDeletedAt: null
          +apTimeoutAt: null
          +visibility: "visible             "
          +createdAt: DateTimeImmutable @1692950596 {#268
            date: 2023-08-25 10:03:16.0 +02:00
          }
        }
        +entry: Proxies\__CG__\App\Entity\Entry {#1591 …2}
        +magazine: Proxies\__CG__\App\Entity\Magazine {#1584 …2}
        +image: null
        +parent: null
        +root: null
        +body: """
          Could you do similar to diagram 2, but instead of an N-FET use a P-FET between the battery and first resistor in the potential divider?\n
          \n
          Add a gate pull up resistor to source to ensure the FET is off by default, have the micro pull the gate down to take a measurement. You’ll probably need to add another resistor on the control pin to 0V to limit the voltage there also, but those two can be much much higher values to really limit current. Or use a zener/TVS diode instead of second resistor to clamp the voltage instead of dividing (more robust).\n
          \n
          Switch it with an NFET\n
          \n
          The micro will see 0V or divided/clamped battery voltage on the measurement pin.
          """
        +lang: "en"
        +isAdult: false
        +favouriteCount: 3
        +score: 0
        +lastActive: DateTime @1692955883 {#1439
          date: 2023-08-25 11:31:23.0 +02:00
        }
        +ip: null
        +tags: null
        +mentions: [
          "@nilclass@discuss.tchncs.de"
        ]
        +children: Doctrine\ORM\PersistentCollection {#1579 …}
        +nested: Doctrine\ORM\PersistentCollection {#1577 …}
        +votes: Doctrine\ORM\PersistentCollection {#1578 …}
        +reports: Doctrine\ORM\PersistentCollection {#1571 …}
        +favourites: Doctrine\ORM\PersistentCollection {#1574 …}
        +notifications: Doctrine\ORM\PersistentCollection {#1667 …}
        -id: 26779
        -bodyTs: "'0v':70,117 '2':7 'add':30,62 'also':76 'anoth':63 'batteri':22,120 'clamp':100 'control':67 'could':1 'current':89 'default':45 'diagram':6 'diod':94 'divid':29,105 'divided/clamped':119 'ensur':39 'fet':14,19,41 'first':24 'gate':32,51 'higher':84 'instead':9,95,103 'limit':72,88 'll':58 'measur':56,124 'micro':48,114 'much':82,83 'n':13 'n-fet':12 'need':60 'nfet':112 'p':18 'p-fet':17 'pin':68,125 'potenti':28 'probabl':59 'pull':33,49 'realli':87 'resistor':25,35,64,98 'robust':107 'second':97 'see':116 'similar':4 'sourc':37 'switch':108 'take':54 'two':79 'use':15,91 'valu':85 'voltag':74,102,121 'zener/tvs':93"
        +ranking: 0
        +commentCount: 0
        +upVotes: 0
        +downVotes: 0
        +visibility: "visible             "
        +apId: "https://feddit.uk/comment/2185380"
        +editedAt: DateTimeImmutable @1692969047 {#1435
          date: 2023-08-25 15:10:47.0 +02:00
        }
        +createdAt: DateTimeImmutable @1692950595 {#1436
          date: 2023-08-25 10:03:15.0 +02:00
        }
        +"title": 26779
      }
      0 => App\Entity\EntryComment {#1549
        +user: App\Entity\User {#265}
        +entry: Proxies\__CG__\App\Entity\Entry {#1591 …2}
        +magazine: Proxies\__CG__\App\Entity\Magazine {#1584 …2}
        +image: null
        +parent: Proxies\__CG__\App\Entity\EntryComment {#1692 …}
        +root: App\Entity\EntryComment {#1709}
        +body: """
          > Not sure I understand this point. Which resistor would you replace with a diode?\n
          \n
          Sorry, I think I was talking nonesense (doing this in my head and just woke up 😅).\n
          \n
          Not sure it’ll work with just a P-FET actually. You’ll likely need to control the PFET with a NFET, otherwise you still end up with too high a voltage on your control pin when the FET is off due to the gate pullup (unless you can use a fet with a very high Vgs Threshold and then drive it push/pull from the micro, but this isn’t really best practice).\n
          \n
          The above comment about diodes was to protect the microcontroller pin, but you end up not being able to control the FET doing it that way.\n
          \n
          I think either your existing Option 3 or PFET upstream of the divider, switched via an N-FET is the way to go.
          """
        +lang: "en"
        +isAdult: false
        +favouriteCount: 2
        +score: 0
        +lastActive: DateTime @1692955881 {#1673
          date: 2023-08-25 11:31:21.0 +02:00
        }
        +ip: null
        +tags: null
        +mentions: [
          "@nilclass@discuss.tchncs.de"
          "@Yonrak@feddit.uk"
        ]
        +children: Doctrine\ORM\PersistentCollection {#1691 …}
        +nested: Doctrine\ORM\PersistentCollection {#1680 …}
        +votes: Doctrine\ORM\PersistentCollection {#1683 …}
        +reports: Doctrine\ORM\PersistentCollection {#1702 …}
        +favourites: Doctrine\ORM\PersistentCollection {#1596 …}
        +notifications: Doctrine\ORM\PersistentCollection {#1613 …}
        -id: 26782
        -bodyTs: "'3':137 'abl':122 'actual':42 'best':103 'comment':107 'control':48,66,124 'diod':14,109 'divid':143 'drive':92 'due':73 'either':133 'end':57,118 'exist':135 'fet':41,70,83,126,149 'gate':76 'go':154 'head':26 'high':61,87 'isn':100 'like':45 'll':34,44 'micro':97 'microcontrol':114 'n':148 'n-fet':147 'need':46 'nfet':53 'nonesens':21 'option':136 'otherwis':54 'p':40 'p-fet':39 'pfet':50,139 'pin':67,115 'point':6 'practic':104 'protect':112 'pullup':77 'push/pull':94 'realli':102 'replac':11 'resistor':8 'sorri':15 'still':56 'sure':2,32 'switch':144 'talk':20 'think':17,132 'threshold':89 'understand':4 'unless':78 'upstream':140 'use':81 'vgs':88 'via':145 'voltag':63 'way':130,152 'woke':29 'work':35 'would':9"
        +ranking: 0
        +commentCount: 0
        +upVotes: 0
        +downVotes: 0
        +visibility: "visible             "
        +apId: "https://feddit.uk/comment/2186641"
        +editedAt: DateTimeImmutable @1692956099 {#1560
          date: 2023-08-25 11:34:59.0 +02:00
        }
        +createdAt: DateTimeImmutable @1692955881 {#1568
          date: 2023-08-25 11:31:21.0 +02:00
        }
        +"title": 26782
      }
    ]
    -id: 1944
    -titleTs: "'batteri':5 'circuit':7 'improv':3 'measur':6"
    -bodyTs: "'/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)':152 '/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)':188 '/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)':53 '1.1':69,77 '10':107 '100µa':127 '10kω':88 '5v':5 '9v':12 'abl':73 'ad':178 'adc':85,95,165 'add':137 'address':173 'analog':99 'anyon':213 'approxim':106 'arduino':7 'atmega':83,91 'atmega328p':9 'bad':156 'batteri':28,130,170 'block':13 'bother':118 'buck':16 'chosen':56 'circuit':123 'clone':8 'constant':125 'convert':17 'curious':211 'current':197 'datasheet':92 'discuss.tchncs.de':52,151,187 'discuss.tchncs.de/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)':150 'discuss.tchncs.de/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)':186 'discuss.tchncs.de/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)':51 'divid':50,142 'draw':126,195 'except':198 'figur':239 'first':42 'full':38 'get':33 'great':113 'haven':237 'howev':201 'idea':35,43,216 'imped':104 'input':166 'intern':79 'issu':175 'kω':108 'less':110 'let':22 'like':230 'm':210,246 'measur':26,66,149,184,200 'microcontrol':6,24 'mosfet':139,161,181,225 'next':133 'obvious':155 'occasion':25 'oh':242 'optim':97 'output':67,103 'part':207 'path':185 'pleas':251 'possibl':234 'power':3 'quit':204 'r1':86 'r2':87 'refer':80 'resistor':58 'say':93 'second':180 'see':167 'seem':227 'signal':100 'simpl':48 'sinc':89 'singl':224 'someth':248 'stupid':249 'switch':144 'tell':252 'thought':134 'use':10,46,75 'v':70,78 'valu':59 've':55,177 'voltag':29,49,63,171 'want':20 'whole':169 'work':190"
    +cross: false
    +upVotes: 0
    +downVotes: 0
    +ranking: 1693029637
    +visibility: "visible             "
    +apId: "https://discuss.tchncs.de/post/2309537"
    +editedAt: DateTimeImmutable @1692947232 {#1693
      date: 2023-08-25 09:07:12.0 +02:00
    }
    +createdAt: DateTimeImmutable @1692947137 {#1740
      date: 2023-08-25 09:05:37.0 +02:00
    }
    +__isInitialized__: true
     …2
  }
  +isSingle: false
  +showShortSentence: true
  +showBody: false
  +showMagazineName: true
  +canSeeTrash: false
  +newComments: 0
}
user_inline App\Twig\Components\UserInlineComponent 12.0 MiB 0.56 ms
Input props
[
  "user" => Proxies\__CG__\App\Entity\User {#2459
    +avatar: null
    +cover: null
    +email: "nilclass@discuss.tchncs.de"
    +username: "@nilclass@discuss.tchncs.de"
    +roles: []
    +followersCount: 0
    +homepage: "front"
    +about: null
    +lastActive: DateTime @1721268563 {#3096
      date: 2024-07-18 04:09:23.0 +02:00
    }
    +markedForDeletionAt: null
    +fields: null
    +oauthGithubId: null
    +oauthGoogleId: null
    +oauthFacebookId: null
    +oauthKeycloakId: null
    +hideAdult: true
    +showSubscribedUsers: true
    +showSubscribedMagazines: true
    +showSubscribedDomains: true
    +preferredLanguages: []
    +featuredMagazines: null
    +showProfileSubscriptions: true
    +showProfileFollowings: true
    +markNewComments: false
    +notifyOnNewEntry: false
    +notifyOnNewEntryReply: false
    +notifyOnNewEntryCommentReply: false
    +notifyOnNewPost: false
    +notifyOnNewPostReply: false
    +notifyOnNewPostCommentReply: false
    +addMentionsEntries: false
    +addMentionsPosts: true
    +isBanned: false
    +isVerified: false
    +isDeleted: false
    +isBot: false
    +spamProtection: true
    +customCss: null
    +ignoreMagazinesCustomCss: false
    +moderatorTokens: Doctrine\ORM\PersistentCollection {#3099 …}
    +magazineOwnershipRequests: Doctrine\ORM\PersistentCollection {#3101 …}
    +moderatorRequests: Doctrine\ORM\PersistentCollection {#3103 …}
    +entries: Doctrine\ORM\PersistentCollection {#3105 …}
    +entryVotes: Doctrine\ORM\PersistentCollection {#3107 …}
    +entryComments: Doctrine\ORM\PersistentCollection {#3109 …}
    +entryCommentVotes: Doctrine\ORM\PersistentCollection {#3111 …}
    +posts: Doctrine\ORM\PersistentCollection {#3113 …}
    +postVotes: Doctrine\ORM\PersistentCollection {#3115 …}
    +postComments: Doctrine\ORM\PersistentCollection {#3117 …}
    +postCommentVotes: Doctrine\ORM\PersistentCollection {#3119 …}
    +subscriptions: Doctrine\ORM\PersistentCollection {#3121 …}
    +subscribedDomains: Doctrine\ORM\PersistentCollection {#3123 …}
    +follows: Doctrine\ORM\PersistentCollection {#3125 …}
    +followers: Doctrine\ORM\PersistentCollection {#3127 …}
    +blocks: Doctrine\ORM\PersistentCollection {#3129 …}
    +blockers: Doctrine\ORM\PersistentCollection {#3131 …}
    +blockedMagazines: Doctrine\ORM\PersistentCollection {#3133 …}
    +blockedDomains: Doctrine\ORM\PersistentCollection {#3135 …}
    +reports: Doctrine\ORM\PersistentCollection {#3137 …}
    +favourites: Doctrine\ORM\PersistentCollection {#3139 …}
    +violations: Doctrine\ORM\PersistentCollection {#3141 …}
    +notifications: Doctrine\ORM\PersistentCollection {#3143 …}
    +awards: Doctrine\ORM\PersistentCollection {#3145 …}
    +subscribedCategories: Doctrine\ORM\PersistentCollection {#3147 …}
    +categories: Doctrine\ORM\PersistentCollection {#3149 …}
    -id: 6046
    -password: "$2y$13$FEroXtR95mjA6.omogLZRe7NJuWUL6hb.9a/FfXkqyIPnPgg4Apme"
    -totpSecret: null
    -totpBackupCodes: []
    -oAuth2UserConsents: Doctrine\ORM\PersistentCollection {#3151 …}
    +apId: "nilclass@discuss.tchncs.de"
    +apProfileId: "https://discuss.tchncs.de/u/nilclass"
    +apPublicUrl: "https://discuss.tchncs.de/u/nilclass"
    +apFollowersUrl: null
    +apInboxUrl: "https://discuss.tchncs.de/inbox"
    +apDomain: "discuss.tchncs.de"
    +apPreferredUsername: "nilclass"
    +apDiscoverable: true
    +apManuallyApprovesFollowers: false
    +privateKey: null
    +publicKey: null
    +apFetchedAt: DateTime @1720630912 {#3097
      date: 2024-07-10 19:01:52.0 +02:00
    }
    +apDeletedAt: null
    +apTimeoutAt: null
    +visibility: "visible             "
    +createdAt: DateTimeImmutable @1687291240 {#3098
      date: 2023-06-20 22:00:40.0 +02:00
    }
    +__isInitialized__: true
     …2
  }
  "showAvatar" => false
]
Attributes
[]
Component
App\Twig\Components\UserInlineComponent {#3051
  +user: Proxies\__CG__\App\Entity\User {#2459
    +avatar: null
    +cover: null
    +email: "nilclass@discuss.tchncs.de"
    +username: "@nilclass@discuss.tchncs.de"
    +roles: []
    +followersCount: 0
    +homepage: "front"
    +about: null
    +lastActive: DateTime @1721268563 {#3096
      date: 2024-07-18 04:09:23.0 +02:00
    }
    +markedForDeletionAt: null
    +fields: null
    +oauthGithubId: null
    +oauthGoogleId: null
    +oauthFacebookId: null
    +oauthKeycloakId: null
    +hideAdult: true
    +showSubscribedUsers: true
    +showSubscribedMagazines: true
    +showSubscribedDomains: true
    +preferredLanguages: []
    +featuredMagazines: null
    +showProfileSubscriptions: true
    +showProfileFollowings: true
    +markNewComments: false
    +notifyOnNewEntry: false
    +notifyOnNewEntryReply: false
    +notifyOnNewEntryCommentReply: false
    +notifyOnNewPost: false
    +notifyOnNewPostReply: false
    +notifyOnNewPostCommentReply: false
    +addMentionsEntries: false
    +addMentionsPosts: true
    +isBanned: false
    +isVerified: false
    +isDeleted: false
    +isBot: false
    +spamProtection: true
    +customCss: null
    +ignoreMagazinesCustomCss: false
    +moderatorTokens: Doctrine\ORM\PersistentCollection {#3099 …}
    +magazineOwnershipRequests: Doctrine\ORM\PersistentCollection {#3101 …}
    +moderatorRequests: Doctrine\ORM\PersistentCollection {#3103 …}
    +entries: Doctrine\ORM\PersistentCollection {#3105 …}
    +entryVotes: Doctrine\ORM\PersistentCollection {#3107 …}
    +entryComments: Doctrine\ORM\PersistentCollection {#3109 …}
    +entryCommentVotes: Doctrine\ORM\PersistentCollection {#3111 …}
    +posts: Doctrine\ORM\PersistentCollection {#3113 …}
    +postVotes: Doctrine\ORM\PersistentCollection {#3115 …}
    +postComments: Doctrine\ORM\PersistentCollection {#3117 …}
    +postCommentVotes: Doctrine\ORM\PersistentCollection {#3119 …}
    +subscriptions: Doctrine\ORM\PersistentCollection {#3121 …}
    +subscribedDomains: Doctrine\ORM\PersistentCollection {#3123 …}
    +follows: Doctrine\ORM\PersistentCollection {#3125 …}
    +followers: Doctrine\ORM\PersistentCollection {#3127 …}
    +blocks: Doctrine\ORM\PersistentCollection {#3129 …}
    +blockers: Doctrine\ORM\PersistentCollection {#3131 …}
    +blockedMagazines: Doctrine\ORM\PersistentCollection {#3133 …}
    +blockedDomains: Doctrine\ORM\PersistentCollection {#3135 …}
    +reports: Doctrine\ORM\PersistentCollection {#3137 …}
    +favourites: Doctrine\ORM\PersistentCollection {#3139 …}
    +violations: Doctrine\ORM\PersistentCollection {#3141 …}
    +notifications: Doctrine\ORM\PersistentCollection {#3143 …}
    +awards: Doctrine\ORM\PersistentCollection {#3145 …}
    +subscribedCategories: Doctrine\ORM\PersistentCollection {#3147 …}
    +categories: Doctrine\ORM\PersistentCollection {#3149 …}
    -id: 6046
    -password: "$2y$13$FEroXtR95mjA6.omogLZRe7NJuWUL6hb.9a/FfXkqyIPnPgg4Apme"
    -totpSecret: null
    -totpBackupCodes: []
    -oAuth2UserConsents: Doctrine\ORM\PersistentCollection {#3151 …}
    +apId: "nilclass@discuss.tchncs.de"
    +apProfileId: "https://discuss.tchncs.de/u/nilclass"
    +apPublicUrl: "https://discuss.tchncs.de/u/nilclass"
    +apFollowersUrl: null
    +apInboxUrl: "https://discuss.tchncs.de/inbox"
    +apDomain: "discuss.tchncs.de"
    +apPreferredUsername: "nilclass"
    +apDiscoverable: true
    +apManuallyApprovesFollowers: false
    +privateKey: null
    +publicKey: null
    +apFetchedAt: DateTime @1720630912 {#3097
      date: 2024-07-10 19:01:52.0 +02:00
    }
    +apDeletedAt: null
    +apTimeoutAt: null
    +visibility: "visible             "
    +createdAt: DateTimeImmutable @1687291240 {#3098
      date: 2023-06-20 22:00:40.0 +02:00
    }
    +__isInitialized__: true
     …2
  }
  +showAvatar: false
}
date App\Twig\Components\DateComponent 12.0 MiB 0.37 ms
Input props
[
  "date" => DateTimeImmutable @1692947137 {#1740
    date: 2023-08-25 09:05:37.0 +02:00
  }
]
Attributes
[]
Component
App\Twig\Components\DateComponent {#3174
  +date: DateTimeImmutable @1692947137 {#1740
    date: 2023-08-25 09:05:37.0 +02:00
  }
}
date_edited App\Twig\Components\DateEditedComponent 12.0 MiB 0.15 ms
Input props
[
  "createdAt" => DateTimeImmutable @1692947137 {#1740
    date: 2023-08-25 09:05:37.0 +02:00
  }
  "editedAt" => DateTimeImmutable @1692947232 {#1693
    date: 2023-08-25 09:07:12.0 +02:00
  }
]
Attributes
[]
Component
App\Twig\Components\DateEditedComponent {#3238
  +createdAt: DateTimeImmutable @1692947137 {#1740
    date: 2023-08-25 09:05:37.0 +02:00
  }
  +editedAt: DateTimeImmutable @1692947232 {#1693
    date: 2023-08-25 09:07:12.0 +02:00
  }
}
magazine_inline App\Twig\Components\MagazineInlineComponent 12.0 MiB 0.23 ms
Input props
[
  "magazine" => Proxies\__CG__\App\Entity\Magazine {#1584
    +icon: Proxies\__CG__\App\Entity\Image {#2886 …}
    +name: "askelectronics@discuss.tchncs.de"
    +title: "askelectronics"
    +description: """
      **For questions about component-level electronic circuits, tools and equipment.**\n
      \n
      Rules\n
      -----\n
      \n
      1: Be nice.\n
      \n
      2: Be on-topic (eg: *Electronic*, not *electrical*).\n
      \n
      3: No commercial stuff, buying, selling or valuations.\n
      \n
      4: Be safe.\n
      \n
      ---
      """
    +rules: null
    +subscriptionsCount: 1
    +entryCount: 154
    +entryCommentCount: 1230
    +postCount: 1
    +postCommentCount: 4
    +isAdult: false
    +customCss: null
    +lastActive: DateTime @1729413608 {#2865
      date: 2024-10-20 10:40:08.0 +02:00
    }
    +markedForDeletionAt: null
    +tags: null
    +moderators: Doctrine\ORM\PersistentCollection {#2885 …}
    +ownershipRequests: Doctrine\ORM\PersistentCollection {#2883 …}
    +moderatorRequests: Doctrine\ORM\PersistentCollection {#2888 …}
    +entries: Doctrine\ORM\PersistentCollection {#2889 …}
    +posts: Doctrine\ORM\PersistentCollection {#2892 …}
    +subscriptions: Doctrine\ORM\PersistentCollection {#2894 …}
    +bans: Doctrine\ORM\PersistentCollection {#2900 …}
    +reports: Doctrine\ORM\PersistentCollection {#2908 …}
    +badges: Doctrine\ORM\PersistentCollection {#2921 …}
    +logs: Doctrine\ORM\PersistentCollection {#2931 …}
    +awards: Doctrine\ORM\PersistentCollection {#2913 …}
    +categories: Doctrine\ORM\PersistentCollection {#2937 …}
    -id: 11
    +apId: "askelectronics@discuss.tchncs.de"
    +apProfileId: "https://discuss.tchncs.de/c/askelectronics"
    +apPublicUrl: "https://discuss.tchncs.de/c/askelectronics"
    +apFollowersUrl: "https://discuss.tchncs.de/c/askelectronics/followers"
    +apInboxUrl: "https://discuss.tchncs.de/inbox"
    +apDomain: "discuss.tchncs.de"
    +apPreferredUsername: "askelectronics"
    +apDiscoverable: true
    +apManuallyApprovesFollowers: null
    +privateKey: null
    +publicKey: null
    +apFetchedAt: DateTime @1727247714 {#2866
      date: 2024-09-25 09:01:54.0 +02:00
    }
    +apDeletedAt: null
    +apTimeoutAt: null
    +visibility: "visible             "
    +createdAt: DateTimeImmutable @1687144409 {#2867
      date: 2023-06-19 05:13:29.0 +02:00
    }
    +__isInitialized__: true
     …2
  }
  "showAvatar" => false
]
Attributes
[]
Component
App\Twig\Components\MagazineInlineComponent {#3303
  +magazine: Proxies\__CG__\App\Entity\Magazine {#1584
    +icon: Proxies\__CG__\App\Entity\Image {#2886 …}
    +name: "askelectronics@discuss.tchncs.de"
    +title: "askelectronics"
    +description: """
      **For questions about component-level electronic circuits, tools and equipment.**\n
      \n
      Rules\n
      -----\n
      \n
      1: Be nice.\n
      \n
      2: Be on-topic (eg: *Electronic*, not *electrical*).\n
      \n
      3: No commercial stuff, buying, selling or valuations.\n
      \n
      4: Be safe.\n
      \n
      ---
      """
    +rules: null
    +subscriptionsCount: 1
    +entryCount: 154
    +entryCommentCount: 1230
    +postCount: 1
    +postCommentCount: 4
    +isAdult: false
    +customCss: null
    +lastActive: DateTime @1729413608 {#2865
      date: 2024-10-20 10:40:08.0 +02:00
    }
    +markedForDeletionAt: null
    +tags: null
    +moderators: Doctrine\ORM\PersistentCollection {#2885 …}
    +ownershipRequests: Doctrine\ORM\PersistentCollection {#2883 …}
    +moderatorRequests: Doctrine\ORM\PersistentCollection {#2888 …}
    +entries: Doctrine\ORM\PersistentCollection {#2889 …}
    +posts: Doctrine\ORM\PersistentCollection {#2892 …}
    +subscriptions: Doctrine\ORM\PersistentCollection {#2894 …}
    +bans: Doctrine\ORM\PersistentCollection {#2900 …}
    +reports: Doctrine\ORM\PersistentCollection {#2908 …}
    +badges: Doctrine\ORM\PersistentCollection {#2921 …}
    +logs: Doctrine\ORM\PersistentCollection {#2931 …}
    +awards: Doctrine\ORM\PersistentCollection {#2913 …}
    +categories: Doctrine\ORM\PersistentCollection {#2937 …}
    -id: 11
    +apId: "askelectronics@discuss.tchncs.de"
    +apProfileId: "https://discuss.tchncs.de/c/askelectronics"
    +apPublicUrl: "https://discuss.tchncs.de/c/askelectronics"
    +apFollowersUrl: "https://discuss.tchncs.de/c/askelectronics/followers"
    +apInboxUrl: "https://discuss.tchncs.de/inbox"
    +apDomain: "discuss.tchncs.de"
    +apPreferredUsername: "askelectronics"
    +apDiscoverable: true
    +apManuallyApprovesFollowers: null
    +privateKey: null
    +publicKey: null
    +apFetchedAt: DateTime @1727247714 {#2866
      date: 2024-09-25 09:01:54.0 +02:00
    }
    +apDeletedAt: null
    +apTimeoutAt: null
    +visibility: "visible             "
    +createdAt: DateTimeImmutable @1687144409 {#2867
      date: 2023-06-19 05:13:29.0 +02:00
    }
    +__isInitialized__: true
     …2
  }
  +showTitle: true
  +fullName: false
  +stretchedLink: false
  +showAvatar: false
}
vote App\Twig\Components\VoteComponent 12.0 MiB 0.44 ms
Input props
[
  "subject" => Proxies\__CG__\App\Entity\Entry {#1591
    +user: Proxies\__CG__\App\Entity\User {#2459
      +avatar: null
      +cover: null
      +email: "nilclass@discuss.tchncs.de"
      +username: "@nilclass@discuss.tchncs.de"
      +roles: []
      +followersCount: 0
      +homepage: "front"
      +about: null
      +lastActive: DateTime @1721268563 {#3096
        date: 2024-07-18 04:09:23.0 +02:00
      }
      +markedForDeletionAt: null
      +fields: null
      +oauthGithubId: null
      +oauthGoogleId: null
      +oauthFacebookId: null
      +oauthKeycloakId: null
      +hideAdult: true
      +showSubscribedUsers: true
      +showSubscribedMagazines: true
      +showSubscribedDomains: true
      +preferredLanguages: []
      +featuredMagazines: null
      +showProfileSubscriptions: true
      +showProfileFollowings: true
      +markNewComments: false
      +notifyOnNewEntry: false
      +notifyOnNewEntryReply: false
      +notifyOnNewEntryCommentReply: false
      +notifyOnNewPost: false
      +notifyOnNewPostReply: false
      +notifyOnNewPostCommentReply: false
      +addMentionsEntries: false
      +addMentionsPosts: true
      +isBanned: false
      +isVerified: false
      +isDeleted: false
      +isBot: false
      +spamProtection: true
      +customCss: null
      +ignoreMagazinesCustomCss: false
      +moderatorTokens: Doctrine\ORM\PersistentCollection {#3099 …}
      +magazineOwnershipRequests: Doctrine\ORM\PersistentCollection {#3101 …}
      +moderatorRequests: Doctrine\ORM\PersistentCollection {#3103 …}
      +entries: Doctrine\ORM\PersistentCollection {#3105 …}
      +entryVotes: Doctrine\ORM\PersistentCollection {#3107 …}
      +entryComments: Doctrine\ORM\PersistentCollection {#3109 …}
      +entryCommentVotes: Doctrine\ORM\PersistentCollection {#3111 …}
      +posts: Doctrine\ORM\PersistentCollection {#3113 …}
      +postVotes: Doctrine\ORM\PersistentCollection {#3115 …}
      +postComments: Doctrine\ORM\PersistentCollection {#3117 …}
      +postCommentVotes: Doctrine\ORM\PersistentCollection {#3119 …}
      +subscriptions: Doctrine\ORM\PersistentCollection {#3121 …}
      +subscribedDomains: Doctrine\ORM\PersistentCollection {#3123 …}
      +follows: Doctrine\ORM\PersistentCollection {#3125 …}
      +followers: Doctrine\ORM\PersistentCollection {#3127 …}
      +blocks: Doctrine\ORM\PersistentCollection {#3129 …}
      +blockers: Doctrine\ORM\PersistentCollection {#3131 …}
      +blockedMagazines: Doctrine\ORM\PersistentCollection {#3133 …}
      +blockedDomains: Doctrine\ORM\PersistentCollection {#3135 …}
      +reports: Doctrine\ORM\PersistentCollection {#3137 …}
      +favourites: Doctrine\ORM\PersistentCollection {#3139 …}
      +violations: Doctrine\ORM\PersistentCollection {#3141 …}
      +notifications: Doctrine\ORM\PersistentCollection {#3143 …}
      +awards: Doctrine\ORM\PersistentCollection {#3145 …}
      +subscribedCategories: Doctrine\ORM\PersistentCollection {#3147 …}
      +categories: Doctrine\ORM\PersistentCollection {#3149 …}
      -id: 6046
      -password: "$2y$13$FEroXtR95mjA6.omogLZRe7NJuWUL6hb.9a/FfXkqyIPnPgg4Apme"
      -totpSecret: null
      -totpBackupCodes: []
      -oAuth2UserConsents: Doctrine\ORM\PersistentCollection {#3151 …}
      +apId: "nilclass@discuss.tchncs.de"
      +apProfileId: "https://discuss.tchncs.de/u/nilclass"
      +apPublicUrl: "https://discuss.tchncs.de/u/nilclass"
      +apFollowersUrl: null
      +apInboxUrl: "https://discuss.tchncs.de/inbox"
      +apDomain: "discuss.tchncs.de"
      +apPreferredUsername: "nilclass"
      +apDiscoverable: true
      +apManuallyApprovesFollowers: false
      +privateKey: null
      +publicKey: null
      +apFetchedAt: DateTime @1720630912 {#3097
        date: 2024-07-10 19:01:52.0 +02:00
      }
      +apDeletedAt: null
      +apTimeoutAt: null
      +visibility: "visible             "
      +createdAt: DateTimeImmutable @1687291240 {#3098
        date: 2023-06-20 22:00:40.0 +02:00
      }
      +__isInitialized__: true
       …2
    }
    +magazine: Proxies\__CG__\App\Entity\Magazine {#1584
      +icon: Proxies\__CG__\App\Entity\Image {#2886 …}
      +name: "askelectronics@discuss.tchncs.de"
      +title: "askelectronics"
      +description: """
        **For questions about component-level electronic circuits, tools and equipment.**\n
        \n
        Rules\n
        -----\n
        \n
        1: Be nice.\n
        \n
        2: Be on-topic (eg: *Electronic*, not *electrical*).\n
        \n
        3: No commercial stuff, buying, selling or valuations.\n
        \n
        4: Be safe.\n
        \n
        ---
        """
      +rules: null
      +subscriptionsCount: 1
      +entryCount: 154
      +entryCommentCount: 1230
      +postCount: 1
      +postCommentCount: 4
      +isAdult: false
      +customCss: null
      +lastActive: DateTime @1729413608 {#2865
        date: 2024-10-20 10:40:08.0 +02:00
      }
      +markedForDeletionAt: null
      +tags: null
      +moderators: Doctrine\ORM\PersistentCollection {#2885 …}
      +ownershipRequests: Doctrine\ORM\PersistentCollection {#2883 …}
      +moderatorRequests: Doctrine\ORM\PersistentCollection {#2888 …}
      +entries: Doctrine\ORM\PersistentCollection {#2889 …}
      +posts: Doctrine\ORM\PersistentCollection {#2892 …}
      +subscriptions: Doctrine\ORM\PersistentCollection {#2894 …}
      +bans: Doctrine\ORM\PersistentCollection {#2900 …}
      +reports: Doctrine\ORM\PersistentCollection {#2908 …}
      +badges: Doctrine\ORM\PersistentCollection {#2921 …}
      +logs: Doctrine\ORM\PersistentCollection {#2931 …}
      +awards: Doctrine\ORM\PersistentCollection {#2913 …}
      +categories: Doctrine\ORM\PersistentCollection {#2937 …}
      -id: 11
      +apId: "askelectronics@discuss.tchncs.de"
      +apProfileId: "https://discuss.tchncs.de/c/askelectronics"
      +apPublicUrl: "https://discuss.tchncs.de/c/askelectronics"
      +apFollowersUrl: "https://discuss.tchncs.de/c/askelectronics/followers"
      +apInboxUrl: "https://discuss.tchncs.de/inbox"
      +apDomain: "discuss.tchncs.de"
      +apPreferredUsername: "askelectronics"
      +apDiscoverable: true
      +apManuallyApprovesFollowers: null
      +privateKey: null
      +publicKey: null
      +apFetchedAt: DateTime @1727247714 {#2866
        date: 2024-09-25 09:01:54.0 +02:00
      }
      +apDeletedAt: null
      +apTimeoutAt: null
      +visibility: "visible             "
      +createdAt: DateTimeImmutable @1687144409 {#2867
        date: 2023-06-19 05:13:29.0 +02:00
      }
      +__isInitialized__: true
       …2
    }
    +image: null
    +domain: Proxies\__CG__\App\Entity\Domain {#1630 …}
    +slug: "How-to-improve-my-battery-measurement-circuit"
    +title: "How to improve my battery measurement circuit?"
    +url: null
    +body: """
      I am powering a 5V microcontroller (arduino clone, atmega328p) using a 9V block and a buck converter. Now I want to let the microcontroller occasionally measure the battery voltage, so I can get an idea of how full it is.\n
      \n
      My first idea was to use a simple voltage divider:\n
      \n
      ![](https://discuss.tchncs.de/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)\n
      \n
      I’ve chosen the resistor values so that:\n
      \n
      - the voltage at the measure output is `< 1.1V`, to be able to use the 1.1V internal reference of the atmega’s ADC\n
      - `R1 || R2 < 10kΩ`, since the atmega datasheet says “The ADC is optimized for analog signals with an output impedance of approximately 10 kΩ or less”\n
      \n
      This is great and all, but what bothers me is that this circuit will constantly draw ~100µA from the battery.\n
      \n
      So, my next thought was to add a mosfet to the divider, to switch it on only while measuring:\n
      \n
      ![](https://discuss.tchncs.de/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)\n
      \n
      This is obviously bad, because now when the mosfet is off, the ADC input sees the whole battery voltage.\n
      \n
      To address that issue, I’ve added a second mosfet into the measure path:\n
      \n
      ![](https://discuss.tchncs.de/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)\n
      \n
      This works, and it does not draw any current, except while measuring.\n
      \n
      However, it’s quite a few parts. So I’m curious if anyone has an idea how to do this with just a single mosfet. It seems to me like it should be possible, but I haven’t figured out how.\n
      \n
      Oh, and if I’m doing something stupid here, please tell me :)
      """
    +type: "article"
    +lang: "en"
    +isOc: false
    +hasEmbed: false
    +commentCount: 11
    +favouriteCount: 17
    +score: 0
    +isAdult: false
    +sticky: false
    +lastActive: DateTime @1694781042 {#1715
      date: 2023-09-15 14:30:42.0 +02:00
    }
    +ip: null
    +adaAmount: 0
    +tags: null
    +mentions: null
    +comments: Doctrine\ORM\PersistentCollection {#1629 …}
    +votes: Doctrine\ORM\PersistentCollection {#1626 …}
    +reports: Doctrine\ORM\PersistentCollection {#1625 …}
    +favourites: Doctrine\ORM\PersistentCollection {#2370 …}
    +notifications: Doctrine\ORM\PersistentCollection {#2371 …}
    +badges: Doctrine\ORM\PersistentCollection {#1708 …}
    +children: [
      1 => App\Entity\EntryComment {#1709
        +user: App\Entity\User {#265
          +avatar: null
          +cover: null
          +email: "Yonrak@feddit.uk"
          +username: "@Yonrak@feddit.uk"
          +roles: []
          +followersCount: 0
          +homepage: "front"
          +about: null
          +lastActive: DateTime @1692955883 {#275
            date: 2023-08-25 11:31:23.0 +02:00
          }
          +markedForDeletionAt: null
          +fields: null
          +oauthGithubId: null
          +oauthGoogleId: null
          +oauthFacebookId: null
          +oauthKeycloakId: null
          +hideAdult: true
          +showSubscribedUsers: true
          +showSubscribedMagazines: true
          +showSubscribedDomains: true
          +preferredLanguages: []
          +featuredMagazines: null
          +showProfileSubscriptions: false
          +showProfileFollowings: true
          +markNewComments: false
          +notifyOnNewEntry: false
          +notifyOnNewEntryReply: true
          +notifyOnNewEntryCommentReply: true
          +notifyOnNewPost: false
          +notifyOnNewPostReply: true
          +notifyOnNewPostCommentReply: true
          +addMentionsEntries: false
          +addMentionsPosts: true
          +isBanned: false
          +isVerified: false
          +isDeleted: false
          +isBot: false
          +spamProtection: true
          +customCss: null
          +ignoreMagazinesCustomCss: false
          +moderatorTokens: Doctrine\ORM\PersistentCollection {#253 …}
          +magazineOwnershipRequests: Doctrine\ORM\PersistentCollection {#249 …}
          +moderatorRequests: Doctrine\ORM\PersistentCollection {#238 …}
          +entries: Doctrine\ORM\PersistentCollection {#196 …}
          +entryVotes: Doctrine\ORM\PersistentCollection {#168 …}
          +entryComments: Doctrine\ORM\PersistentCollection {#141 …}
          +entryCommentVotes: Doctrine\ORM\PersistentCollection {#111 …}
          +posts: Doctrine\ORM\PersistentCollection {#84 …}
          +postVotes: Doctrine\ORM\PersistentCollection {#99 …}
          +postComments: Doctrine\ORM\PersistentCollection {#1863 …}
          +postCommentVotes: Doctrine\ORM\PersistentCollection {#1479 …}
          +subscriptions: Doctrine\ORM\PersistentCollection {#1658 …}
          +subscribedDomains: Doctrine\ORM\PersistentCollection {#1868 …}
          +follows: Doctrine\ORM\PersistentCollection {#1917 …}
          +followers: Doctrine\ORM\PersistentCollection {#1601 …}
          +blocks: Doctrine\ORM\PersistentCollection {#1805 …}
          +blockers: Doctrine\ORM\PersistentCollection {#1810 …}
          +blockedMagazines: Doctrine\ORM\PersistentCollection {#1857 …}
          +blockedDomains: Doctrine\ORM\PersistentCollection {#1860 …}
          +reports: Doctrine\ORM\PersistentCollection {#1791 …}
          +favourites: Doctrine\ORM\PersistentCollection {#2416 …}
          +violations: Doctrine\ORM\PersistentCollection {#1824 …}
          +notifications: Doctrine\ORM\PersistentCollection {#1914 …}
          +awards: Doctrine\ORM\PersistentCollection {#1929 …}
          +subscribedCategories: Doctrine\ORM\PersistentCollection {#1867 …}
          +categories: Doctrine\ORM\PersistentCollection {#1880 …}
          -id: 42482
          -password: "$2y$13$NhIMiF1JXctMkB.To0A1l.9Yf5tUWEmnsXRxLOIoPHjfEy4B2UkMe"
          -totpSecret: null
          -totpBackupCodes: []
          -oAuth2UserConsents: Doctrine\ORM\PersistentCollection {#1894 …}
          +apId: "Yonrak@feddit.uk"
          +apProfileId: "https://feddit.uk/u/Yonrak"
          +apPublicUrl: "https://feddit.uk/u/Yonrak"
          +apFollowersUrl: null
          +apInboxUrl: "https://feddit.uk/inbox"
          +apDomain: "feddit.uk"
          +apPreferredUsername: "Yonrak"
          +apDiscoverable: true
          +apManuallyApprovesFollowers: false
          +privateKey: null
          +publicKey: null
          +apFetchedAt: DateTime @1692955883 {#269
            date: 2023-08-25 11:31:23.0 +02:00
          }
          +apDeletedAt: null
          +apTimeoutAt: null
          +visibility: "visible             "
          +createdAt: DateTimeImmutable @1692950596 {#268
            date: 2023-08-25 10:03:16.0 +02:00
          }
        }
        +entry: Proxies\__CG__\App\Entity\Entry {#1591 …2}
        +magazine: Proxies\__CG__\App\Entity\Magazine {#1584 …2}
        +image: null
        +parent: null
        +root: null
        +body: """
          Could you do similar to diagram 2, but instead of an N-FET use a P-FET between the battery and first resistor in the potential divider?\n
          \n
          Add a gate pull up resistor to source to ensure the FET is off by default, have the micro pull the gate down to take a measurement. You’ll probably need to add another resistor on the control pin to 0V to limit the voltage there also, but those two can be much much higher values to really limit current. Or use a zener/TVS diode instead of second resistor to clamp the voltage instead of dividing (more robust).\n
          \n
          Switch it with an NFET\n
          \n
          The micro will see 0V or divided/clamped battery voltage on the measurement pin.
          """
        +lang: "en"
        +isAdult: false
        +favouriteCount: 3
        +score: 0
        +lastActive: DateTime @1692955883 {#1439
          date: 2023-08-25 11:31:23.0 +02:00
        }
        +ip: null
        +tags: null
        +mentions: [
          "@nilclass@discuss.tchncs.de"
        ]
        +children: Doctrine\ORM\PersistentCollection {#1579 …}
        +nested: Doctrine\ORM\PersistentCollection {#1577 …}
        +votes: Doctrine\ORM\PersistentCollection {#1578 …}
        +reports: Doctrine\ORM\PersistentCollection {#1571 …}
        +favourites: Doctrine\ORM\PersistentCollection {#1574 …}
        +notifications: Doctrine\ORM\PersistentCollection {#1667 …}
        -id: 26779
        -bodyTs: "'0v':70,117 '2':7 'add':30,62 'also':76 'anoth':63 'batteri':22,120 'clamp':100 'control':67 'could':1 'current':89 'default':45 'diagram':6 'diod':94 'divid':29,105 'divided/clamped':119 'ensur':39 'fet':14,19,41 'first':24 'gate':32,51 'higher':84 'instead':9,95,103 'limit':72,88 'll':58 'measur':56,124 'micro':48,114 'much':82,83 'n':13 'n-fet':12 'need':60 'nfet':112 'p':18 'p-fet':17 'pin':68,125 'potenti':28 'probabl':59 'pull':33,49 'realli':87 'resistor':25,35,64,98 'robust':107 'second':97 'see':116 'similar':4 'sourc':37 'switch':108 'take':54 'two':79 'use':15,91 'valu':85 'voltag':74,102,121 'zener/tvs':93"
        +ranking: 0
        +commentCount: 0
        +upVotes: 0
        +downVotes: 0
        +visibility: "visible             "
        +apId: "https://feddit.uk/comment/2185380"
        +editedAt: DateTimeImmutable @1692969047 {#1435
          date: 2023-08-25 15:10:47.0 +02:00
        }
        +createdAt: DateTimeImmutable @1692950595 {#1436
          date: 2023-08-25 10:03:15.0 +02:00
        }
        +"title": 26779
      }
      0 => App\Entity\EntryComment {#1549
        +user: App\Entity\User {#265}
        +entry: Proxies\__CG__\App\Entity\Entry {#1591 …2}
        +magazine: Proxies\__CG__\App\Entity\Magazine {#1584 …2}
        +image: null
        +parent: Proxies\__CG__\App\Entity\EntryComment {#1692 …}
        +root: App\Entity\EntryComment {#1709}
        +body: """
          > Not sure I understand this point. Which resistor would you replace with a diode?\n
          \n
          Sorry, I think I was talking nonesense (doing this in my head and just woke up 😅).\n
          \n
          Not sure it’ll work with just a P-FET actually. You’ll likely need to control the PFET with a NFET, otherwise you still end up with too high a voltage on your control pin when the FET is off due to the gate pullup (unless you can use a fet with a very high Vgs Threshold and then drive it push/pull from the micro, but this isn’t really best practice).\n
          \n
          The above comment about diodes was to protect the microcontroller pin, but you end up not being able to control the FET doing it that way.\n
          \n
          I think either your existing Option 3 or PFET upstream of the divider, switched via an N-FET is the way to go.
          """
        +lang: "en"
        +isAdult: false
        +favouriteCount: 2
        +score: 0
        +lastActive: DateTime @1692955881 {#1673
          date: 2023-08-25 11:31:21.0 +02:00
        }
        +ip: null
        +tags: null
        +mentions: [
          "@nilclass@discuss.tchncs.de"
          "@Yonrak@feddit.uk"
        ]
        +children: Doctrine\ORM\PersistentCollection {#1691 …}
        +nested: Doctrine\ORM\PersistentCollection {#1680 …}
        +votes: Doctrine\ORM\PersistentCollection {#1683 …}
        +reports: Doctrine\ORM\PersistentCollection {#1702 …}
        +favourites: Doctrine\ORM\PersistentCollection {#1596 …}
        +notifications: Doctrine\ORM\PersistentCollection {#1613 …}
        -id: 26782
        -bodyTs: "'3':137 'abl':122 'actual':42 'best':103 'comment':107 'control':48,66,124 'diod':14,109 'divid':143 'drive':92 'due':73 'either':133 'end':57,118 'exist':135 'fet':41,70,83,126,149 'gate':76 'go':154 'head':26 'high':61,87 'isn':100 'like':45 'll':34,44 'micro':97 'microcontrol':114 'n':148 'n-fet':147 'need':46 'nfet':53 'nonesens':21 'option':136 'otherwis':54 'p':40 'p-fet':39 'pfet':50,139 'pin':67,115 'point':6 'practic':104 'protect':112 'pullup':77 'push/pull':94 'realli':102 'replac':11 'resistor':8 'sorri':15 'still':56 'sure':2,32 'switch':144 'talk':20 'think':17,132 'threshold':89 'understand':4 'unless':78 'upstream':140 'use':81 'vgs':88 'via':145 'voltag':63 'way':130,152 'woke':29 'work':35 'would':9"
        +ranking: 0
        +commentCount: 0
        +upVotes: 0
        +downVotes: 0
        +visibility: "visible             "
        +apId: "https://feddit.uk/comment/2186641"
        +editedAt: DateTimeImmutable @1692956099 {#1560
          date: 2023-08-25 11:34:59.0 +02:00
        }
        +createdAt: DateTimeImmutable @1692955881 {#1568
          date: 2023-08-25 11:31:21.0 +02:00
        }
        +"title": 26782
      }
    ]
    -id: 1944
    -titleTs: "'batteri':5 'circuit':7 'improv':3 'measur':6"
    -bodyTs: "'/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)':152 '/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)':188 '/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)':53 '1.1':69,77 '10':107 '100µa':127 '10kω':88 '5v':5 '9v':12 'abl':73 'ad':178 'adc':85,95,165 'add':137 'address':173 'analog':99 'anyon':213 'approxim':106 'arduino':7 'atmega':83,91 'atmega328p':9 'bad':156 'batteri':28,130,170 'block':13 'bother':118 'buck':16 'chosen':56 'circuit':123 'clone':8 'constant':125 'convert':17 'curious':211 'current':197 'datasheet':92 'discuss.tchncs.de':52,151,187 'discuss.tchncs.de/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)':150 'discuss.tchncs.de/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)':186 'discuss.tchncs.de/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)':51 'divid':50,142 'draw':126,195 'except':198 'figur':239 'first':42 'full':38 'get':33 'great':113 'haven':237 'howev':201 'idea':35,43,216 'imped':104 'input':166 'intern':79 'issu':175 'kω':108 'less':110 'let':22 'like':230 'm':210,246 'measur':26,66,149,184,200 'microcontrol':6,24 'mosfet':139,161,181,225 'next':133 'obvious':155 'occasion':25 'oh':242 'optim':97 'output':67,103 'part':207 'path':185 'pleas':251 'possibl':234 'power':3 'quit':204 'r1':86 'r2':87 'refer':80 'resistor':58 'say':93 'second':180 'see':167 'seem':227 'signal':100 'simpl':48 'sinc':89 'singl':224 'someth':248 'stupid':249 'switch':144 'tell':252 'thought':134 'use':10,46,75 'v':70,78 'valu':59 've':55,177 'voltag':29,49,63,171 'want':20 'whole':169 'work':190"
    +cross: false
    +upVotes: 0
    +downVotes: 0
    +ranking: 1693029637
    +visibility: "visible             "
    +apId: "https://discuss.tchncs.de/post/2309537"
    +editedAt: DateTimeImmutable @1692947232 {#1693
      date: 2023-08-25 09:07:12.0 +02:00
    }
    +createdAt: DateTimeImmutable @1692947137 {#1740
      date: 2023-08-25 09:05:37.0 +02:00
    }
    +__isInitialized__: true
     …2
  }
]
Attributes
[]
Component
App\Twig\Components\VoteComponent {#3369
  +subject: Proxies\__CG__\App\Entity\Entry {#1591
    +user: Proxies\__CG__\App\Entity\User {#2459
      +avatar: null
      +cover: null
      +email: "nilclass@discuss.tchncs.de"
      +username: "@nilclass@discuss.tchncs.de"
      +roles: []
      +followersCount: 0
      +homepage: "front"
      +about: null
      +lastActive: DateTime @1721268563 {#3096
        date: 2024-07-18 04:09:23.0 +02:00
      }
      +markedForDeletionAt: null
      +fields: null
      +oauthGithubId: null
      +oauthGoogleId: null
      +oauthFacebookId: null
      +oauthKeycloakId: null
      +hideAdult: true
      +showSubscribedUsers: true
      +showSubscribedMagazines: true
      +showSubscribedDomains: true
      +preferredLanguages: []
      +featuredMagazines: null
      +showProfileSubscriptions: true
      +showProfileFollowings: true
      +markNewComments: false
      +notifyOnNewEntry: false
      +notifyOnNewEntryReply: false
      +notifyOnNewEntryCommentReply: false
      +notifyOnNewPost: false
      +notifyOnNewPostReply: false
      +notifyOnNewPostCommentReply: false
      +addMentionsEntries: false
      +addMentionsPosts: true
      +isBanned: false
      +isVerified: false
      +isDeleted: false
      +isBot: false
      +spamProtection: true
      +customCss: null
      +ignoreMagazinesCustomCss: false
      +moderatorTokens: Doctrine\ORM\PersistentCollection {#3099 …}
      +magazineOwnershipRequests: Doctrine\ORM\PersistentCollection {#3101 …}
      +moderatorRequests: Doctrine\ORM\PersistentCollection {#3103 …}
      +entries: Doctrine\ORM\PersistentCollection {#3105 …}
      +entryVotes: Doctrine\ORM\PersistentCollection {#3107 …}
      +entryComments: Doctrine\ORM\PersistentCollection {#3109 …}
      +entryCommentVotes: Doctrine\ORM\PersistentCollection {#3111 …}
      +posts: Doctrine\ORM\PersistentCollection {#3113 …}
      +postVotes: Doctrine\ORM\PersistentCollection {#3115 …}
      +postComments: Doctrine\ORM\PersistentCollection {#3117 …}
      +postCommentVotes: Doctrine\ORM\PersistentCollection {#3119 …}
      +subscriptions: Doctrine\ORM\PersistentCollection {#3121 …}
      +subscribedDomains: Doctrine\ORM\PersistentCollection {#3123 …}
      +follows: Doctrine\ORM\PersistentCollection {#3125 …}
      +followers: Doctrine\ORM\PersistentCollection {#3127 …}
      +blocks: Doctrine\ORM\PersistentCollection {#3129 …}
      +blockers: Doctrine\ORM\PersistentCollection {#3131 …}
      +blockedMagazines: Doctrine\ORM\PersistentCollection {#3133 …}
      +blockedDomains: Doctrine\ORM\PersistentCollection {#3135 …}
      +reports: Doctrine\ORM\PersistentCollection {#3137 …}
      +favourites: Doctrine\ORM\PersistentCollection {#3139 …}
      +violations: Doctrine\ORM\PersistentCollection {#3141 …}
      +notifications: Doctrine\ORM\PersistentCollection {#3143 …}
      +awards: Doctrine\ORM\PersistentCollection {#3145 …}
      +subscribedCategories: Doctrine\ORM\PersistentCollection {#3147 …}
      +categories: Doctrine\ORM\PersistentCollection {#3149 …}
      -id: 6046
      -password: "$2y$13$FEroXtR95mjA6.omogLZRe7NJuWUL6hb.9a/FfXkqyIPnPgg4Apme"
      -totpSecret: null
      -totpBackupCodes: []
      -oAuth2UserConsents: Doctrine\ORM\PersistentCollection {#3151 …}
      +apId: "nilclass@discuss.tchncs.de"
      +apProfileId: "https://discuss.tchncs.de/u/nilclass"
      +apPublicUrl: "https://discuss.tchncs.de/u/nilclass"
      +apFollowersUrl: null
      +apInboxUrl: "https://discuss.tchncs.de/inbox"
      +apDomain: "discuss.tchncs.de"
      +apPreferredUsername: "nilclass"
      +apDiscoverable: true
      +apManuallyApprovesFollowers: false
      +privateKey: null
      +publicKey: null
      +apFetchedAt: DateTime @1720630912 {#3097
        date: 2024-07-10 19:01:52.0 +02:00
      }
      +apDeletedAt: null
      +apTimeoutAt: null
      +visibility: "visible             "
      +createdAt: DateTimeImmutable @1687291240 {#3098
        date: 2023-06-20 22:00:40.0 +02:00
      }
      +__isInitialized__: true
       …2
    }
    +magazine: Proxies\__CG__\App\Entity\Magazine {#1584
      +icon: Proxies\__CG__\App\Entity\Image {#2886 …}
      +name: "askelectronics@discuss.tchncs.de"
      +title: "askelectronics"
      +description: """
        **For questions about component-level electronic circuits, tools and equipment.**\n
        \n
        Rules\n
        -----\n
        \n
        1: Be nice.\n
        \n
        2: Be on-topic (eg: *Electronic*, not *electrical*).\n
        \n
        3: No commercial stuff, buying, selling or valuations.\n
        \n
        4: Be safe.\n
        \n
        ---
        """
      +rules: null
      +subscriptionsCount: 1
      +entryCount: 154
      +entryCommentCount: 1230
      +postCount: 1
      +postCommentCount: 4
      +isAdult: false
      +customCss: null
      +lastActive: DateTime @1729413608 {#2865
        date: 2024-10-20 10:40:08.0 +02:00
      }
      +markedForDeletionAt: null
      +tags: null
      +moderators: Doctrine\ORM\PersistentCollection {#2885 …}
      +ownershipRequests: Doctrine\ORM\PersistentCollection {#2883 …}
      +moderatorRequests: Doctrine\ORM\PersistentCollection {#2888 …}
      +entries: Doctrine\ORM\PersistentCollection {#2889 …}
      +posts: Doctrine\ORM\PersistentCollection {#2892 …}
      +subscriptions: Doctrine\ORM\PersistentCollection {#2894 …}
      +bans: Doctrine\ORM\PersistentCollection {#2900 …}
      +reports: Doctrine\ORM\PersistentCollection {#2908 …}
      +badges: Doctrine\ORM\PersistentCollection {#2921 …}
      +logs: Doctrine\ORM\PersistentCollection {#2931 …}
      +awards: Doctrine\ORM\PersistentCollection {#2913 …}
      +categories: Doctrine\ORM\PersistentCollection {#2937 …}
      -id: 11
      +apId: "askelectronics@discuss.tchncs.de"
      +apProfileId: "https://discuss.tchncs.de/c/askelectronics"
      +apPublicUrl: "https://discuss.tchncs.de/c/askelectronics"
      +apFollowersUrl: "https://discuss.tchncs.de/c/askelectronics/followers"
      +apInboxUrl: "https://discuss.tchncs.de/inbox"
      +apDomain: "discuss.tchncs.de"
      +apPreferredUsername: "askelectronics"
      +apDiscoverable: true
      +apManuallyApprovesFollowers: null
      +privateKey: null
      +publicKey: null
      +apFetchedAt: DateTime @1727247714 {#2866
        date: 2024-09-25 09:01:54.0 +02:00
      }
      +apDeletedAt: null
      +apTimeoutAt: null
      +visibility: "visible             "
      +createdAt: DateTimeImmutable @1687144409 {#2867
        date: 2023-06-19 05:13:29.0 +02:00
      }
      +__isInitialized__: true
       …2
    }
    +image: null
    +domain: Proxies\__CG__\App\Entity\Domain {#1630 …}
    +slug: "How-to-improve-my-battery-measurement-circuit"
    +title: "How to improve my battery measurement circuit?"
    +url: null
    +body: """
      I am powering a 5V microcontroller (arduino clone, atmega328p) using a 9V block and a buck converter. Now I want to let the microcontroller occasionally measure the battery voltage, so I can get an idea of how full it is.\n
      \n
      My first idea was to use a simple voltage divider:\n
      \n
      ![](https://discuss.tchncs.de/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)\n
      \n
      I’ve chosen the resistor values so that:\n
      \n
      - the voltage at the measure output is `< 1.1V`, to be able to use the 1.1V internal reference of the atmega’s ADC\n
      - `R1 || R2 < 10kΩ`, since the atmega datasheet says “The ADC is optimized for analog signals with an output impedance of approximately 10 kΩ or less”\n
      \n
      This is great and all, but what bothers me is that this circuit will constantly draw ~100µA from the battery.\n
      \n
      So, my next thought was to add a mosfet to the divider, to switch it on only while measuring:\n
      \n
      ![](https://discuss.tchncs.de/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)\n
      \n
      This is obviously bad, because now when the mosfet is off, the ADC input sees the whole battery voltage.\n
      \n
      To address that issue, I’ve added a second mosfet into the measure path:\n
      \n
      ![](https://discuss.tchncs.de/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)\n
      \n
      This works, and it does not draw any current, except while measuring.\n
      \n
      However, it’s quite a few parts. So I’m curious if anyone has an idea how to do this with just a single mosfet. It seems to me like it should be possible, but I haven’t figured out how.\n
      \n
      Oh, and if I’m doing something stupid here, please tell me :)
      """
    +type: "article"
    +lang: "en"
    +isOc: false
    +hasEmbed: false
    +commentCount: 11
    +favouriteCount: 17
    +score: 0
    +isAdult: false
    +sticky: false
    +lastActive: DateTime @1694781042 {#1715
      date: 2023-09-15 14:30:42.0 +02:00
    }
    +ip: null
    +adaAmount: 0
    +tags: null
    +mentions: null
    +comments: Doctrine\ORM\PersistentCollection {#1629 …}
    +votes: Doctrine\ORM\PersistentCollection {#1626 …}
    +reports: Doctrine\ORM\PersistentCollection {#1625 …}
    +favourites: Doctrine\ORM\PersistentCollection {#2370 …}
    +notifications: Doctrine\ORM\PersistentCollection {#2371 …}
    +badges: Doctrine\ORM\PersistentCollection {#1708 …}
    +children: [
      1 => App\Entity\EntryComment {#1709
        +user: App\Entity\User {#265
          +avatar: null
          +cover: null
          +email: "Yonrak@feddit.uk"
          +username: "@Yonrak@feddit.uk"
          +roles: []
          +followersCount: 0
          +homepage: "front"
          +about: null
          +lastActive: DateTime @1692955883 {#275
            date: 2023-08-25 11:31:23.0 +02:00
          }
          +markedForDeletionAt: null
          +fields: null
          +oauthGithubId: null
          +oauthGoogleId: null
          +oauthFacebookId: null
          +oauthKeycloakId: null
          +hideAdult: true
          +showSubscribedUsers: true
          +showSubscribedMagazines: true
          +showSubscribedDomains: true
          +preferredLanguages: []
          +featuredMagazines: null
          +showProfileSubscriptions: false
          +showProfileFollowings: true
          +markNewComments: false
          +notifyOnNewEntry: false
          +notifyOnNewEntryReply: true
          +notifyOnNewEntryCommentReply: true
          +notifyOnNewPost: false
          +notifyOnNewPostReply: true
          +notifyOnNewPostCommentReply: true
          +addMentionsEntries: false
          +addMentionsPosts: true
          +isBanned: false
          +isVerified: false
          +isDeleted: false
          +isBot: false
          +spamProtection: true
          +customCss: null
          +ignoreMagazinesCustomCss: false
          +moderatorTokens: Doctrine\ORM\PersistentCollection {#253 …}
          +magazineOwnershipRequests: Doctrine\ORM\PersistentCollection {#249 …}
          +moderatorRequests: Doctrine\ORM\PersistentCollection {#238 …}
          +entries: Doctrine\ORM\PersistentCollection {#196 …}
          +entryVotes: Doctrine\ORM\PersistentCollection {#168 …}
          +entryComments: Doctrine\ORM\PersistentCollection {#141 …}
          +entryCommentVotes: Doctrine\ORM\PersistentCollection {#111 …}
          +posts: Doctrine\ORM\PersistentCollection {#84 …}
          +postVotes: Doctrine\ORM\PersistentCollection {#99 …}
          +postComments: Doctrine\ORM\PersistentCollection {#1863 …}
          +postCommentVotes: Doctrine\ORM\PersistentCollection {#1479 …}
          +subscriptions: Doctrine\ORM\PersistentCollection {#1658 …}
          +subscribedDomains: Doctrine\ORM\PersistentCollection {#1868 …}
          +follows: Doctrine\ORM\PersistentCollection {#1917 …}
          +followers: Doctrine\ORM\PersistentCollection {#1601 …}
          +blocks: Doctrine\ORM\PersistentCollection {#1805 …}
          +blockers: Doctrine\ORM\PersistentCollection {#1810 …}
          +blockedMagazines: Doctrine\ORM\PersistentCollection {#1857 …}
          +blockedDomains: Doctrine\ORM\PersistentCollection {#1860 …}
          +reports: Doctrine\ORM\PersistentCollection {#1791 …}
          +favourites: Doctrine\ORM\PersistentCollection {#2416 …}
          +violations: Doctrine\ORM\PersistentCollection {#1824 …}
          +notifications: Doctrine\ORM\PersistentCollection {#1914 …}
          +awards: Doctrine\ORM\PersistentCollection {#1929 …}
          +subscribedCategories: Doctrine\ORM\PersistentCollection {#1867 …}
          +categories: Doctrine\ORM\PersistentCollection {#1880 …}
          -id: 42482
          -password: "$2y$13$NhIMiF1JXctMkB.To0A1l.9Yf5tUWEmnsXRxLOIoPHjfEy4B2UkMe"
          -totpSecret: null
          -totpBackupCodes: []
          -oAuth2UserConsents: Doctrine\ORM\PersistentCollection {#1894 …}
          +apId: "Yonrak@feddit.uk"
          +apProfileId: "https://feddit.uk/u/Yonrak"
          +apPublicUrl: "https://feddit.uk/u/Yonrak"
          +apFollowersUrl: null
          +apInboxUrl: "https://feddit.uk/inbox"
          +apDomain: "feddit.uk"
          +apPreferredUsername: "Yonrak"
          +apDiscoverable: true
          +apManuallyApprovesFollowers: false
          +privateKey: null
          +publicKey: null
          +apFetchedAt: DateTime @1692955883 {#269
            date: 2023-08-25 11:31:23.0 +02:00
          }
          +apDeletedAt: null
          +apTimeoutAt: null
          +visibility: "visible             "
          +createdAt: DateTimeImmutable @1692950596 {#268
            date: 2023-08-25 10:03:16.0 +02:00
          }
        }
        +entry: Proxies\__CG__\App\Entity\Entry {#1591 …2}
        +magazine: Proxies\__CG__\App\Entity\Magazine {#1584 …2}
        +image: null
        +parent: null
        +root: null
        +body: """
          Could you do similar to diagram 2, but instead of an N-FET use a P-FET between the battery and first resistor in the potential divider?\n
          \n
          Add a gate pull up resistor to source to ensure the FET is off by default, have the micro pull the gate down to take a measurement. You’ll probably need to add another resistor on the control pin to 0V to limit the voltage there also, but those two can be much much higher values to really limit current. Or use a zener/TVS diode instead of second resistor to clamp the voltage instead of dividing (more robust).\n
          \n
          Switch it with an NFET\n
          \n
          The micro will see 0V or divided/clamped battery voltage on the measurement pin.
          """
        +lang: "en"
        +isAdult: false
        +favouriteCount: 3
        +score: 0
        +lastActive: DateTime @1692955883 {#1439
          date: 2023-08-25 11:31:23.0 +02:00
        }
        +ip: null
        +tags: null
        +mentions: [
          "@nilclass@discuss.tchncs.de"
        ]
        +children: Doctrine\ORM\PersistentCollection {#1579 …}
        +nested: Doctrine\ORM\PersistentCollection {#1577 …}
        +votes: Doctrine\ORM\PersistentCollection {#1578 …}
        +reports: Doctrine\ORM\PersistentCollection {#1571 …}
        +favourites: Doctrine\ORM\PersistentCollection {#1574 …}
        +notifications: Doctrine\ORM\PersistentCollection {#1667 …}
        -id: 26779
        -bodyTs: "'0v':70,117 '2':7 'add':30,62 'also':76 'anoth':63 'batteri':22,120 'clamp':100 'control':67 'could':1 'current':89 'default':45 'diagram':6 'diod':94 'divid':29,105 'divided/clamped':119 'ensur':39 'fet':14,19,41 'first':24 'gate':32,51 'higher':84 'instead':9,95,103 'limit':72,88 'll':58 'measur':56,124 'micro':48,114 'much':82,83 'n':13 'n-fet':12 'need':60 'nfet':112 'p':18 'p-fet':17 'pin':68,125 'potenti':28 'probabl':59 'pull':33,49 'realli':87 'resistor':25,35,64,98 'robust':107 'second':97 'see':116 'similar':4 'sourc':37 'switch':108 'take':54 'two':79 'use':15,91 'valu':85 'voltag':74,102,121 'zener/tvs':93"
        +ranking: 0
        +commentCount: 0
        +upVotes: 0
        +downVotes: 0
        +visibility: "visible             "
        +apId: "https://feddit.uk/comment/2185380"
        +editedAt: DateTimeImmutable @1692969047 {#1435
          date: 2023-08-25 15:10:47.0 +02:00
        }
        +createdAt: DateTimeImmutable @1692950595 {#1436
          date: 2023-08-25 10:03:15.0 +02:00
        }
        +"title": 26779
      }
      0 => App\Entity\EntryComment {#1549
        +user: App\Entity\User {#265}
        +entry: Proxies\__CG__\App\Entity\Entry {#1591 …2}
        +magazine: Proxies\__CG__\App\Entity\Magazine {#1584 …2}
        +image: null
        +parent: Proxies\__CG__\App\Entity\EntryComment {#1692 …}
        +root: App\Entity\EntryComment {#1709}
        +body: """
          > Not sure I understand this point. Which resistor would you replace with a diode?\n
          \n
          Sorry, I think I was talking nonesense (doing this in my head and just woke up 😅).\n
          \n
          Not sure it’ll work with just a P-FET actually. You’ll likely need to control the PFET with a NFET, otherwise you still end up with too high a voltage on your control pin when the FET is off due to the gate pullup (unless you can use a fet with a very high Vgs Threshold and then drive it push/pull from the micro, but this isn’t really best practice).\n
          \n
          The above comment about diodes was to protect the microcontroller pin, but you end up not being able to control the FET doing it that way.\n
          \n
          I think either your existing Option 3 or PFET upstream of the divider, switched via an N-FET is the way to go.
          """
        +lang: "en"
        +isAdult: false
        +favouriteCount: 2
        +score: 0
        +lastActive: DateTime @1692955881 {#1673
          date: 2023-08-25 11:31:21.0 +02:00
        }
        +ip: null
        +tags: null
        +mentions: [
          "@nilclass@discuss.tchncs.de"
          "@Yonrak@feddit.uk"
        ]
        +children: Doctrine\ORM\PersistentCollection {#1691 …}
        +nested: Doctrine\ORM\PersistentCollection {#1680 …}
        +votes: Doctrine\ORM\PersistentCollection {#1683 …}
        +reports: Doctrine\ORM\PersistentCollection {#1702 …}
        +favourites: Doctrine\ORM\PersistentCollection {#1596 …}
        +notifications: Doctrine\ORM\PersistentCollection {#1613 …}
        -id: 26782
        -bodyTs: "'3':137 'abl':122 'actual':42 'best':103 'comment':107 'control':48,66,124 'diod':14,109 'divid':143 'drive':92 'due':73 'either':133 'end':57,118 'exist':135 'fet':41,70,83,126,149 'gate':76 'go':154 'head':26 'high':61,87 'isn':100 'like':45 'll':34,44 'micro':97 'microcontrol':114 'n':148 'n-fet':147 'need':46 'nfet':53 'nonesens':21 'option':136 'otherwis':54 'p':40 'p-fet':39 'pfet':50,139 'pin':67,115 'point':6 'practic':104 'protect':112 'pullup':77 'push/pull':94 'realli':102 'replac':11 'resistor':8 'sorri':15 'still':56 'sure':2,32 'switch':144 'talk':20 'think':17,132 'threshold':89 'understand':4 'unless':78 'upstream':140 'use':81 'vgs':88 'via':145 'voltag':63 'way':130,152 'woke':29 'work':35 'would':9"
        +ranking: 0
        +commentCount: 0
        +upVotes: 0
        +downVotes: 0
        +visibility: "visible             "
        +apId: "https://feddit.uk/comment/2186641"
        +editedAt: DateTimeImmutable @1692956099 {#1560
          date: 2023-08-25 11:34:59.0 +02:00
        }
        +createdAt: DateTimeImmutable @1692955881 {#1568
          date: 2023-08-25 11:31:21.0 +02:00
        }
        +"title": 26782
      }
    ]
    -id: 1944
    -titleTs: "'batteri':5 'circuit':7 'improv':3 'measur':6"
    -bodyTs: "'/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)':152 '/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)':188 '/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)':53 '1.1':69,77 '10':107 '100µa':127 '10kω':88 '5v':5 '9v':12 'abl':73 'ad':178 'adc':85,95,165 'add':137 'address':173 'analog':99 'anyon':213 'approxim':106 'arduino':7 'atmega':83,91 'atmega328p':9 'bad':156 'batteri':28,130,170 'block':13 'bother':118 'buck':16 'chosen':56 'circuit':123 'clone':8 'constant':125 'convert':17 'curious':211 'current':197 'datasheet':92 'discuss.tchncs.de':52,151,187 'discuss.tchncs.de/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)':150 'discuss.tchncs.de/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)':186 'discuss.tchncs.de/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)':51 'divid':50,142 'draw':126,195 'except':198 'figur':239 'first':42 'full':38 'get':33 'great':113 'haven':237 'howev':201 'idea':35,43,216 'imped':104 'input':166 'intern':79 'issu':175 'kω':108 'less':110 'let':22 'like':230 'm':210,246 'measur':26,66,149,184,200 'microcontrol':6,24 'mosfet':139,161,181,225 'next':133 'obvious':155 'occasion':25 'oh':242 'optim':97 'output':67,103 'part':207 'path':185 'pleas':251 'possibl':234 'power':3 'quit':204 'r1':86 'r2':87 'refer':80 'resistor':58 'say':93 'second':180 'see':167 'seem':227 'signal':100 'simpl':48 'sinc':89 'singl':224 'someth':248 'stupid':249 'switch':144 'tell':252 'thought':134 'use':10,46,75 'v':70,78 'valu':59 've':55,177 'voltag':29,49,63,171 'want':20 'whole':169 'work':190"
    +cross: false
    +upVotes: 0
    +downVotes: 0
    +ranking: 1693029637
    +visibility: "visible             "
    +apId: "https://discuss.tchncs.de/post/2309537"
    +editedAt: DateTimeImmutable @1692947232 {#1693
      date: 2023-08-25 09:07:12.0 +02:00
    }
    +createdAt: DateTimeImmutable @1692947137 {#1740
      date: 2023-08-25 09:05:37.0 +02:00
    }
    +__isInitialized__: true
     …2
  }
  +formDest: "entry"
  +showDownvote: true
  -cache: Symfony\Component\Cache\Adapter\TraceableTagAwareAdapter {#600 …}
}
boost App\Twig\Components\BoostComponent 12.0 MiB 1.46 ms
Input props
[
  "subject" => Proxies\__CG__\App\Entity\Entry {#1591
    +user: Proxies\__CG__\App\Entity\User {#2459
      +avatar: null
      +cover: null
      +email: "nilclass@discuss.tchncs.de"
      +username: "@nilclass@discuss.tchncs.de"
      +roles: []
      +followersCount: 0
      +homepage: "front"
      +about: null
      +lastActive: DateTime @1721268563 {#3096
        date: 2024-07-18 04:09:23.0 +02:00
      }
      +markedForDeletionAt: null
      +fields: null
      +oauthGithubId: null
      +oauthGoogleId: null
      +oauthFacebookId: null
      +oauthKeycloakId: null
      +hideAdult: true
      +showSubscribedUsers: true
      +showSubscribedMagazines: true
      +showSubscribedDomains: true
      +preferredLanguages: []
      +featuredMagazines: null
      +showProfileSubscriptions: true
      +showProfileFollowings: true
      +markNewComments: false
      +notifyOnNewEntry: false
      +notifyOnNewEntryReply: false
      +notifyOnNewEntryCommentReply: false
      +notifyOnNewPost: false
      +notifyOnNewPostReply: false
      +notifyOnNewPostCommentReply: false
      +addMentionsEntries: false
      +addMentionsPosts: true
      +isBanned: false
      +isVerified: false
      +isDeleted: false
      +isBot: false
      +spamProtection: true
      +customCss: null
      +ignoreMagazinesCustomCss: false
      +moderatorTokens: Doctrine\ORM\PersistentCollection {#3099 …}
      +magazineOwnershipRequests: Doctrine\ORM\PersistentCollection {#3101 …}
      +moderatorRequests: Doctrine\ORM\PersistentCollection {#3103 …}
      +entries: Doctrine\ORM\PersistentCollection {#3105 …}
      +entryVotes: Doctrine\ORM\PersistentCollection {#3107 …}
      +entryComments: Doctrine\ORM\PersistentCollection {#3109 …}
      +entryCommentVotes: Doctrine\ORM\PersistentCollection {#3111 …}
      +posts: Doctrine\ORM\PersistentCollection {#3113 …}
      +postVotes: Doctrine\ORM\PersistentCollection {#3115 …}
      +postComments: Doctrine\ORM\PersistentCollection {#3117 …}
      +postCommentVotes: Doctrine\ORM\PersistentCollection {#3119 …}
      +subscriptions: Doctrine\ORM\PersistentCollection {#3121 …}
      +subscribedDomains: Doctrine\ORM\PersistentCollection {#3123 …}
      +follows: Doctrine\ORM\PersistentCollection {#3125 …}
      +followers: Doctrine\ORM\PersistentCollection {#3127 …}
      +blocks: Doctrine\ORM\PersistentCollection {#3129 …}
      +blockers: Doctrine\ORM\PersistentCollection {#3131 …}
      +blockedMagazines: Doctrine\ORM\PersistentCollection {#3133 …}
      +blockedDomains: Doctrine\ORM\PersistentCollection {#3135 …}
      +reports: Doctrine\ORM\PersistentCollection {#3137 …}
      +favourites: Doctrine\ORM\PersistentCollection {#3139 …}
      +violations: Doctrine\ORM\PersistentCollection {#3141 …}
      +notifications: Doctrine\ORM\PersistentCollection {#3143 …}
      +awards: Doctrine\ORM\PersistentCollection {#3145 …}
      +subscribedCategories: Doctrine\ORM\PersistentCollection {#3147 …}
      +categories: Doctrine\ORM\PersistentCollection {#3149 …}
      -id: 6046
      -password: "$2y$13$FEroXtR95mjA6.omogLZRe7NJuWUL6hb.9a/FfXkqyIPnPgg4Apme"
      -totpSecret: null
      -totpBackupCodes: []
      -oAuth2UserConsents: Doctrine\ORM\PersistentCollection {#3151 …}
      +apId: "nilclass@discuss.tchncs.de"
      +apProfileId: "https://discuss.tchncs.de/u/nilclass"
      +apPublicUrl: "https://discuss.tchncs.de/u/nilclass"
      +apFollowersUrl: null
      +apInboxUrl: "https://discuss.tchncs.de/inbox"
      +apDomain: "discuss.tchncs.de"
      +apPreferredUsername: "nilclass"
      +apDiscoverable: true
      +apManuallyApprovesFollowers: false
      +privateKey: null
      +publicKey: null
      +apFetchedAt: DateTime @1720630912 {#3097
        date: 2024-07-10 19:01:52.0 +02:00
      }
      +apDeletedAt: null
      +apTimeoutAt: null
      +visibility: "visible             "
      +createdAt: DateTimeImmutable @1687291240 {#3098
        date: 2023-06-20 22:00:40.0 +02:00
      }
      +__isInitialized__: true
       …2
    }
    +magazine: Proxies\__CG__\App\Entity\Magazine {#1584
      +icon: Proxies\__CG__\App\Entity\Image {#2886 …}
      +name: "askelectronics@discuss.tchncs.de"
      +title: "askelectronics"
      +description: """
        **For questions about component-level electronic circuits, tools and equipment.**\n
        \n
        Rules\n
        -----\n
        \n
        1: Be nice.\n
        \n
        2: Be on-topic (eg: *Electronic*, not *electrical*).\n
        \n
        3: No commercial stuff, buying, selling or valuations.\n
        \n
        4: Be safe.\n
        \n
        ---
        """
      +rules: null
      +subscriptionsCount: 1
      +entryCount: 154
      +entryCommentCount: 1230
      +postCount: 1
      +postCommentCount: 4
      +isAdult: false
      +customCss: null
      +lastActive: DateTime @1729413608 {#2865
        date: 2024-10-20 10:40:08.0 +02:00
      }
      +markedForDeletionAt: null
      +tags: null
      +moderators: Doctrine\ORM\PersistentCollection {#2885 …}
      +ownershipRequests: Doctrine\ORM\PersistentCollection {#2883 …}
      +moderatorRequests: Doctrine\ORM\PersistentCollection {#2888 …}
      +entries: Doctrine\ORM\PersistentCollection {#2889 …}
      +posts: Doctrine\ORM\PersistentCollection {#2892 …}
      +subscriptions: Doctrine\ORM\PersistentCollection {#2894 …}
      +bans: Doctrine\ORM\PersistentCollection {#2900 …}
      +reports: Doctrine\ORM\PersistentCollection {#2908 …}
      +badges: Doctrine\ORM\PersistentCollection {#2921 …}
      +logs: Doctrine\ORM\PersistentCollection {#2931 …}
      +awards: Doctrine\ORM\PersistentCollection {#2913 …}
      +categories: Doctrine\ORM\PersistentCollection {#2937 …}
      -id: 11
      +apId: "askelectronics@discuss.tchncs.de"
      +apProfileId: "https://discuss.tchncs.de/c/askelectronics"
      +apPublicUrl: "https://discuss.tchncs.de/c/askelectronics"
      +apFollowersUrl: "https://discuss.tchncs.de/c/askelectronics/followers"
      +apInboxUrl: "https://discuss.tchncs.de/inbox"
      +apDomain: "discuss.tchncs.de"
      +apPreferredUsername: "askelectronics"
      +apDiscoverable: true
      +apManuallyApprovesFollowers: null
      +privateKey: null
      +publicKey: null
      +apFetchedAt: DateTime @1727247714 {#2866
        date: 2024-09-25 09:01:54.0 +02:00
      }
      +apDeletedAt: null
      +apTimeoutAt: null
      +visibility: "visible             "
      +createdAt: DateTimeImmutable @1687144409 {#2867
        date: 2023-06-19 05:13:29.0 +02:00
      }
      +__isInitialized__: true
       …2
    }
    +image: null
    +domain: Proxies\__CG__\App\Entity\Domain {#1630 …}
    +slug: "How-to-improve-my-battery-measurement-circuit"
    +title: "How to improve my battery measurement circuit?"
    +url: null
    +body: """
      I am powering a 5V microcontroller (arduino clone, atmega328p) using a 9V block and a buck converter. Now I want to let the microcontroller occasionally measure the battery voltage, so I can get an idea of how full it is.\n
      \n
      My first idea was to use a simple voltage divider:\n
      \n
      ![](https://discuss.tchncs.de/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)\n
      \n
      I’ve chosen the resistor values so that:\n
      \n
      - the voltage at the measure output is `< 1.1V`, to be able to use the 1.1V internal reference of the atmega’s ADC\n
      - `R1 || R2 < 10kΩ`, since the atmega datasheet says “The ADC is optimized for analog signals with an output impedance of approximately 10 kΩ or less”\n
      \n
      This is great and all, but what bothers me is that this circuit will constantly draw ~100µA from the battery.\n
      \n
      So, my next thought was to add a mosfet to the divider, to switch it on only while measuring:\n
      \n
      ![](https://discuss.tchncs.de/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)\n
      \n
      This is obviously bad, because now when the mosfet is off, the ADC input sees the whole battery voltage.\n
      \n
      To address that issue, I’ve added a second mosfet into the measure path:\n
      \n
      ![](https://discuss.tchncs.de/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)\n
      \n
      This works, and it does not draw any current, except while measuring.\n
      \n
      However, it’s quite a few parts. So I’m curious if anyone has an idea how to do this with just a single mosfet. It seems to me like it should be possible, but I haven’t figured out how.\n
      \n
      Oh, and if I’m doing something stupid here, please tell me :)
      """
    +type: "article"
    +lang: "en"
    +isOc: false
    +hasEmbed: false
    +commentCount: 11
    +favouriteCount: 17
    +score: 0
    +isAdult: false
    +sticky: false
    +lastActive: DateTime @1694781042 {#1715
      date: 2023-09-15 14:30:42.0 +02:00
    }
    +ip: null
    +adaAmount: 0
    +tags: null
    +mentions: null
    +comments: Doctrine\ORM\PersistentCollection {#1629 …}
    +votes: Doctrine\ORM\PersistentCollection {#1626 …}
    +reports: Doctrine\ORM\PersistentCollection {#1625 …}
    +favourites: Doctrine\ORM\PersistentCollection {#2370 …}
    +notifications: Doctrine\ORM\PersistentCollection {#2371 …}
    +badges: Doctrine\ORM\PersistentCollection {#1708 …}
    +children: [
      1 => App\Entity\EntryComment {#1709
        +user: App\Entity\User {#265
          +avatar: null
          +cover: null
          +email: "Yonrak@feddit.uk"
          +username: "@Yonrak@feddit.uk"
          +roles: []
          +followersCount: 0
          +homepage: "front"
          +about: null
          +lastActive: DateTime @1692955883 {#275
            date: 2023-08-25 11:31:23.0 +02:00
          }
          +markedForDeletionAt: null
          +fields: null
          +oauthGithubId: null
          +oauthGoogleId: null
          +oauthFacebookId: null
          +oauthKeycloakId: null
          +hideAdult: true
          +showSubscribedUsers: true
          +showSubscribedMagazines: true
          +showSubscribedDomains: true
          +preferredLanguages: []
          +featuredMagazines: null
          +showProfileSubscriptions: false
          +showProfileFollowings: true
          +markNewComments: false
          +notifyOnNewEntry: false
          +notifyOnNewEntryReply: true
          +notifyOnNewEntryCommentReply: true
          +notifyOnNewPost: false
          +notifyOnNewPostReply: true
          +notifyOnNewPostCommentReply: true
          +addMentionsEntries: false
          +addMentionsPosts: true
          +isBanned: false
          +isVerified: false
          +isDeleted: false
          +isBot: false
          +spamProtection: true
          +customCss: null
          +ignoreMagazinesCustomCss: false
          +moderatorTokens: Doctrine\ORM\PersistentCollection {#253 …}
          +magazineOwnershipRequests: Doctrine\ORM\PersistentCollection {#249 …}
          +moderatorRequests: Doctrine\ORM\PersistentCollection {#238 …}
          +entries: Doctrine\ORM\PersistentCollection {#196 …}
          +entryVotes: Doctrine\ORM\PersistentCollection {#168 …}
          +entryComments: Doctrine\ORM\PersistentCollection {#141 …}
          +entryCommentVotes: Doctrine\ORM\PersistentCollection {#111 …}
          +posts: Doctrine\ORM\PersistentCollection {#84 …}
          +postVotes: Doctrine\ORM\PersistentCollection {#99 …}
          +postComments: Doctrine\ORM\PersistentCollection {#1863 …}
          +postCommentVotes: Doctrine\ORM\PersistentCollection {#1479 …}
          +subscriptions: Doctrine\ORM\PersistentCollection {#1658 …}
          +subscribedDomains: Doctrine\ORM\PersistentCollection {#1868 …}
          +follows: Doctrine\ORM\PersistentCollection {#1917 …}
          +followers: Doctrine\ORM\PersistentCollection {#1601 …}
          +blocks: Doctrine\ORM\PersistentCollection {#1805 …}
          +blockers: Doctrine\ORM\PersistentCollection {#1810 …}
          +blockedMagazines: Doctrine\ORM\PersistentCollection {#1857 …}
          +blockedDomains: Doctrine\ORM\PersistentCollection {#1860 …}
          +reports: Doctrine\ORM\PersistentCollection {#1791 …}
          +favourites: Doctrine\ORM\PersistentCollection {#2416 …}
          +violations: Doctrine\ORM\PersistentCollection {#1824 …}
          +notifications: Doctrine\ORM\PersistentCollection {#1914 …}
          +awards: Doctrine\ORM\PersistentCollection {#1929 …}
          +subscribedCategories: Doctrine\ORM\PersistentCollection {#1867 …}
          +categories: Doctrine\ORM\PersistentCollection {#1880 …}
          -id: 42482
          -password: "$2y$13$NhIMiF1JXctMkB.To0A1l.9Yf5tUWEmnsXRxLOIoPHjfEy4B2UkMe"
          -totpSecret: null
          -totpBackupCodes: []
          -oAuth2UserConsents: Doctrine\ORM\PersistentCollection {#1894 …}
          +apId: "Yonrak@feddit.uk"
          +apProfileId: "https://feddit.uk/u/Yonrak"
          +apPublicUrl: "https://feddit.uk/u/Yonrak"
          +apFollowersUrl: null
          +apInboxUrl: "https://feddit.uk/inbox"
          +apDomain: "feddit.uk"
          +apPreferredUsername: "Yonrak"
          +apDiscoverable: true
          +apManuallyApprovesFollowers: false
          +privateKey: null
          +publicKey: null
          +apFetchedAt: DateTime @1692955883 {#269
            date: 2023-08-25 11:31:23.0 +02:00
          }
          +apDeletedAt: null
          +apTimeoutAt: null
          +visibility: "visible             "
          +createdAt: DateTimeImmutable @1692950596 {#268
            date: 2023-08-25 10:03:16.0 +02:00
          }
        }
        +entry: Proxies\__CG__\App\Entity\Entry {#1591 …2}
        +magazine: Proxies\__CG__\App\Entity\Magazine {#1584 …2}
        +image: null
        +parent: null
        +root: null
        +body: """
          Could you do similar to diagram 2, but instead of an N-FET use a P-FET between the battery and first resistor in the potential divider?\n
          \n
          Add a gate pull up resistor to source to ensure the FET is off by default, have the micro pull the gate down to take a measurement. You’ll probably need to add another resistor on the control pin to 0V to limit the voltage there also, but those two can be much much higher values to really limit current. Or use a zener/TVS diode instead of second resistor to clamp the voltage instead of dividing (more robust).\n
          \n
          Switch it with an NFET\n
          \n
          The micro will see 0V or divided/clamped battery voltage on the measurement pin.
          """
        +lang: "en"
        +isAdult: false
        +favouriteCount: 3
        +score: 0
        +lastActive: DateTime @1692955883 {#1439
          date: 2023-08-25 11:31:23.0 +02:00
        }
        +ip: null
        +tags: null
        +mentions: [
          "@nilclass@discuss.tchncs.de"
        ]
        +children: Doctrine\ORM\PersistentCollection {#1579 …}
        +nested: Doctrine\ORM\PersistentCollection {#1577 …}
        +votes: Doctrine\ORM\PersistentCollection {#1578 …}
        +reports: Doctrine\ORM\PersistentCollection {#1571 …}
        +favourites: Doctrine\ORM\PersistentCollection {#1574 …}
        +notifications: Doctrine\ORM\PersistentCollection {#1667 …}
        -id: 26779
        -bodyTs: "'0v':70,117 '2':7 'add':30,62 'also':76 'anoth':63 'batteri':22,120 'clamp':100 'control':67 'could':1 'current':89 'default':45 'diagram':6 'diod':94 'divid':29,105 'divided/clamped':119 'ensur':39 'fet':14,19,41 'first':24 'gate':32,51 'higher':84 'instead':9,95,103 'limit':72,88 'll':58 'measur':56,124 'micro':48,114 'much':82,83 'n':13 'n-fet':12 'need':60 'nfet':112 'p':18 'p-fet':17 'pin':68,125 'potenti':28 'probabl':59 'pull':33,49 'realli':87 'resistor':25,35,64,98 'robust':107 'second':97 'see':116 'similar':4 'sourc':37 'switch':108 'take':54 'two':79 'use':15,91 'valu':85 'voltag':74,102,121 'zener/tvs':93"
        +ranking: 0
        +commentCount: 0
        +upVotes: 0
        +downVotes: 0
        +visibility: "visible             "
        +apId: "https://feddit.uk/comment/2185380"
        +editedAt: DateTimeImmutable @1692969047 {#1435
          date: 2023-08-25 15:10:47.0 +02:00
        }
        +createdAt: DateTimeImmutable @1692950595 {#1436
          date: 2023-08-25 10:03:15.0 +02:00
        }
        +"title": 26779
      }
      0 => App\Entity\EntryComment {#1549
        +user: App\Entity\User {#265}
        +entry: Proxies\__CG__\App\Entity\Entry {#1591 …2}
        +magazine: Proxies\__CG__\App\Entity\Magazine {#1584 …2}
        +image: null
        +parent: Proxies\__CG__\App\Entity\EntryComment {#1692 …}
        +root: App\Entity\EntryComment {#1709}
        +body: """
          > Not sure I understand this point. Which resistor would you replace with a diode?\n
          \n
          Sorry, I think I was talking nonesense (doing this in my head and just woke up 😅).\n
          \n
          Not sure it’ll work with just a P-FET actually. You’ll likely need to control the PFET with a NFET, otherwise you still end up with too high a voltage on your control pin when the FET is off due to the gate pullup (unless you can use a fet with a very high Vgs Threshold and then drive it push/pull from the micro, but this isn’t really best practice).\n
          \n
          The above comment about diodes was to protect the microcontroller pin, but you end up not being able to control the FET doing it that way.\n
          \n
          I think either your existing Option 3 or PFET upstream of the divider, switched via an N-FET is the way to go.
          """
        +lang: "en"
        +isAdult: false
        +favouriteCount: 2
        +score: 0
        +lastActive: DateTime @1692955881 {#1673
          date: 2023-08-25 11:31:21.0 +02:00
        }
        +ip: null
        +tags: null
        +mentions: [
          "@nilclass@discuss.tchncs.de"
          "@Yonrak@feddit.uk"
        ]
        +children: Doctrine\ORM\PersistentCollection {#1691 …}
        +nested: Doctrine\ORM\PersistentCollection {#1680 …}
        +votes: Doctrine\ORM\PersistentCollection {#1683 …}
        +reports: Doctrine\ORM\PersistentCollection {#1702 …}
        +favourites: Doctrine\ORM\PersistentCollection {#1596 …}
        +notifications: Doctrine\ORM\PersistentCollection {#1613 …}
        -id: 26782
        -bodyTs: "'3':137 'abl':122 'actual':42 'best':103 'comment':107 'control':48,66,124 'diod':14,109 'divid':143 'drive':92 'due':73 'either':133 'end':57,118 'exist':135 'fet':41,70,83,126,149 'gate':76 'go':154 'head':26 'high':61,87 'isn':100 'like':45 'll':34,44 'micro':97 'microcontrol':114 'n':148 'n-fet':147 'need':46 'nfet':53 'nonesens':21 'option':136 'otherwis':54 'p':40 'p-fet':39 'pfet':50,139 'pin':67,115 'point':6 'practic':104 'protect':112 'pullup':77 'push/pull':94 'realli':102 'replac':11 'resistor':8 'sorri':15 'still':56 'sure':2,32 'switch':144 'talk':20 'think':17,132 'threshold':89 'understand':4 'unless':78 'upstream':140 'use':81 'vgs':88 'via':145 'voltag':63 'way':130,152 'woke':29 'work':35 'would':9"
        +ranking: 0
        +commentCount: 0
        +upVotes: 0
        +downVotes: 0
        +visibility: "visible             "
        +apId: "https://feddit.uk/comment/2186641"
        +editedAt: DateTimeImmutable @1692956099 {#1560
          date: 2023-08-25 11:34:59.0 +02:00
        }
        +createdAt: DateTimeImmutable @1692955881 {#1568
          date: 2023-08-25 11:31:21.0 +02:00
        }
        +"title": 26782
      }
    ]
    -id: 1944
    -titleTs: "'batteri':5 'circuit':7 'improv':3 'measur':6"
    -bodyTs: "'/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)':152 '/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)':188 '/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)':53 '1.1':69,77 '10':107 '100µa':127 '10kω':88 '5v':5 '9v':12 'abl':73 'ad':178 'adc':85,95,165 'add':137 'address':173 'analog':99 'anyon':213 'approxim':106 'arduino':7 'atmega':83,91 'atmega328p':9 'bad':156 'batteri':28,130,170 'block':13 'bother':118 'buck':16 'chosen':56 'circuit':123 'clone':8 'constant':125 'convert':17 'curious':211 'current':197 'datasheet':92 'discuss.tchncs.de':52,151,187 'discuss.tchncs.de/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)':150 'discuss.tchncs.de/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)':186 'discuss.tchncs.de/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)':51 'divid':50,142 'draw':126,195 'except':198 'figur':239 'first':42 'full':38 'get':33 'great':113 'haven':237 'howev':201 'idea':35,43,216 'imped':104 'input':166 'intern':79 'issu':175 'kω':108 'less':110 'let':22 'like':230 'm':210,246 'measur':26,66,149,184,200 'microcontrol':6,24 'mosfet':139,161,181,225 'next':133 'obvious':155 'occasion':25 'oh':242 'optim':97 'output':67,103 'part':207 'path':185 'pleas':251 'possibl':234 'power':3 'quit':204 'r1':86 'r2':87 'refer':80 'resistor':58 'say':93 'second':180 'see':167 'seem':227 'signal':100 'simpl':48 'sinc':89 'singl':224 'someth':248 'stupid':249 'switch':144 'tell':252 'thought':134 'use':10,46,75 'v':70,78 'valu':59 've':55,177 'voltag':29,49,63,171 'want':20 'whole':169 'work':190"
    +cross: false
    +upVotes: 0
    +downVotes: 0
    +ranking: 1693029637
    +visibility: "visible             "
    +apId: "https://discuss.tchncs.de/post/2309537"
    +editedAt: DateTimeImmutable @1692947232 {#1693
      date: 2023-08-25 09:07:12.0 +02:00
    }
    +createdAt: DateTimeImmutable @1692947137 {#1740
      date: 2023-08-25 09:05:37.0 +02:00
    }
    +__isInitialized__: true
     …2
  }
]
Attributes
[]
Component
App\Twig\Components\BoostComponent {#3434
  +formDest: "entry"
  +subject: Proxies\__CG__\App\Entity\Entry {#1591
    +user: Proxies\__CG__\App\Entity\User {#2459
      +avatar: null
      +cover: null
      +email: "nilclass@discuss.tchncs.de"
      +username: "@nilclass@discuss.tchncs.de"
      +roles: []
      +followersCount: 0
      +homepage: "front"
      +about: null
      +lastActive: DateTime @1721268563 {#3096
        date: 2024-07-18 04:09:23.0 +02:00
      }
      +markedForDeletionAt: null
      +fields: null
      +oauthGithubId: null
      +oauthGoogleId: null
      +oauthFacebookId: null
      +oauthKeycloakId: null
      +hideAdult: true
      +showSubscribedUsers: true
      +showSubscribedMagazines: true
      +showSubscribedDomains: true
      +preferredLanguages: []
      +featuredMagazines: null
      +showProfileSubscriptions: true
      +showProfileFollowings: true
      +markNewComments: false
      +notifyOnNewEntry: false
      +notifyOnNewEntryReply: false
      +notifyOnNewEntryCommentReply: false
      +notifyOnNewPost: false
      +notifyOnNewPostReply: false
      +notifyOnNewPostCommentReply: false
      +addMentionsEntries: false
      +addMentionsPosts: true
      +isBanned: false
      +isVerified: false
      +isDeleted: false
      +isBot: false
      +spamProtection: true
      +customCss: null
      +ignoreMagazinesCustomCss: false
      +moderatorTokens: Doctrine\ORM\PersistentCollection {#3099 …}
      +magazineOwnershipRequests: Doctrine\ORM\PersistentCollection {#3101 …}
      +moderatorRequests: Doctrine\ORM\PersistentCollection {#3103 …}
      +entries: Doctrine\ORM\PersistentCollection {#3105 …}
      +entryVotes: Doctrine\ORM\PersistentCollection {#3107 …}
      +entryComments: Doctrine\ORM\PersistentCollection {#3109 …}
      +entryCommentVotes: Doctrine\ORM\PersistentCollection {#3111 …}
      +posts: Doctrine\ORM\PersistentCollection {#3113 …}
      +postVotes: Doctrine\ORM\PersistentCollection {#3115 …}
      +postComments: Doctrine\ORM\PersistentCollection {#3117 …}
      +postCommentVotes: Doctrine\ORM\PersistentCollection {#3119 …}
      +subscriptions: Doctrine\ORM\PersistentCollection {#3121 …}
      +subscribedDomains: Doctrine\ORM\PersistentCollection {#3123 …}
      +follows: Doctrine\ORM\PersistentCollection {#3125 …}
      +followers: Doctrine\ORM\PersistentCollection {#3127 …}
      +blocks: Doctrine\ORM\PersistentCollection {#3129 …}
      +blockers: Doctrine\ORM\PersistentCollection {#3131 …}
      +blockedMagazines: Doctrine\ORM\PersistentCollection {#3133 …}
      +blockedDomains: Doctrine\ORM\PersistentCollection {#3135 …}
      +reports: Doctrine\ORM\PersistentCollection {#3137 …}
      +favourites: Doctrine\ORM\PersistentCollection {#3139 …}
      +violations: Doctrine\ORM\PersistentCollection {#3141 …}
      +notifications: Doctrine\ORM\PersistentCollection {#3143 …}
      +awards: Doctrine\ORM\PersistentCollection {#3145 …}
      +subscribedCategories: Doctrine\ORM\PersistentCollection {#3147 …}
      +categories: Doctrine\ORM\PersistentCollection {#3149 …}
      -id: 6046
      -password: "$2y$13$FEroXtR95mjA6.omogLZRe7NJuWUL6hb.9a/FfXkqyIPnPgg4Apme"
      -totpSecret: null
      -totpBackupCodes: []
      -oAuth2UserConsents: Doctrine\ORM\PersistentCollection {#3151 …}
      +apId: "nilclass@discuss.tchncs.de"
      +apProfileId: "https://discuss.tchncs.de/u/nilclass"
      +apPublicUrl: "https://discuss.tchncs.de/u/nilclass"
      +apFollowersUrl: null
      +apInboxUrl: "https://discuss.tchncs.de/inbox"
      +apDomain: "discuss.tchncs.de"
      +apPreferredUsername: "nilclass"
      +apDiscoverable: true
      +apManuallyApprovesFollowers: false
      +privateKey: null
      +publicKey: null
      +apFetchedAt: DateTime @1720630912 {#3097
        date: 2024-07-10 19:01:52.0 +02:00
      }
      +apDeletedAt: null
      +apTimeoutAt: null
      +visibility: "visible             "
      +createdAt: DateTimeImmutable @1687291240 {#3098
        date: 2023-06-20 22:00:40.0 +02:00
      }
      +__isInitialized__: true
       …2
    }
    +magazine: Proxies\__CG__\App\Entity\Magazine {#1584
      +icon: Proxies\__CG__\App\Entity\Image {#2886 …}
      +name: "askelectronics@discuss.tchncs.de"
      +title: "askelectronics"
      +description: """
        **For questions about component-level electronic circuits, tools and equipment.**\n
        \n
        Rules\n
        -----\n
        \n
        1: Be nice.\n
        \n
        2: Be on-topic (eg: *Electronic*, not *electrical*).\n
        \n
        3: No commercial stuff, buying, selling or valuations.\n
        \n
        4: Be safe.\n
        \n
        ---
        """
      +rules: null
      +subscriptionsCount: 1
      +entryCount: 154
      +entryCommentCount: 1230
      +postCount: 1
      +postCommentCount: 4
      +isAdult: false
      +customCss: null
      +lastActive: DateTime @1729413608 {#2865
        date: 2024-10-20 10:40:08.0 +02:00
      }
      +markedForDeletionAt: null
      +tags: null
      +moderators: Doctrine\ORM\PersistentCollection {#2885 …}
      +ownershipRequests: Doctrine\ORM\PersistentCollection {#2883 …}
      +moderatorRequests: Doctrine\ORM\PersistentCollection {#2888 …}
      +entries: Doctrine\ORM\PersistentCollection {#2889 …}
      +posts: Doctrine\ORM\PersistentCollection {#2892 …}
      +subscriptions: Doctrine\ORM\PersistentCollection {#2894 …}
      +bans: Doctrine\ORM\PersistentCollection {#2900 …}
      +reports: Doctrine\ORM\PersistentCollection {#2908 …}
      +badges: Doctrine\ORM\PersistentCollection {#2921 …}
      +logs: Doctrine\ORM\PersistentCollection {#2931 …}
      +awards: Doctrine\ORM\PersistentCollection {#2913 …}
      +categories: Doctrine\ORM\PersistentCollection {#2937 …}
      -id: 11
      +apId: "askelectronics@discuss.tchncs.de"
      +apProfileId: "https://discuss.tchncs.de/c/askelectronics"
      +apPublicUrl: "https://discuss.tchncs.de/c/askelectronics"
      +apFollowersUrl: "https://discuss.tchncs.de/c/askelectronics/followers"
      +apInboxUrl: "https://discuss.tchncs.de/inbox"
      +apDomain: "discuss.tchncs.de"
      +apPreferredUsername: "askelectronics"
      +apDiscoverable: true
      +apManuallyApprovesFollowers: null
      +privateKey: null
      +publicKey: null
      +apFetchedAt: DateTime @1727247714 {#2866
        date: 2024-09-25 09:01:54.0 +02:00
      }
      +apDeletedAt: null
      +apTimeoutAt: null
      +visibility: "visible             "
      +createdAt: DateTimeImmutable @1687144409 {#2867
        date: 2023-06-19 05:13:29.0 +02:00
      }
      +__isInitialized__: true
       …2
    }
    +image: null
    +domain: Proxies\__CG__\App\Entity\Domain {#1630 …}
    +slug: "How-to-improve-my-battery-measurement-circuit"
    +title: "How to improve my battery measurement circuit?"
    +url: null
    +body: """
      I am powering a 5V microcontroller (arduino clone, atmega328p) using a 9V block and a buck converter. Now I want to let the microcontroller occasionally measure the battery voltage, so I can get an idea of how full it is.\n
      \n
      My first idea was to use a simple voltage divider:\n
      \n
      ![](https://discuss.tchncs.de/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)\n
      \n
      I’ve chosen the resistor values so that:\n
      \n
      - the voltage at the measure output is `< 1.1V`, to be able to use the 1.1V internal reference of the atmega’s ADC\n
      - `R1 || R2 < 10kΩ`, since the atmega datasheet says “The ADC is optimized for analog signals with an output impedance of approximately 10 kΩ or less”\n
      \n
      This is great and all, but what bothers me is that this circuit will constantly draw ~100µA from the battery.\n
      \n
      So, my next thought was to add a mosfet to the divider, to switch it on only while measuring:\n
      \n
      ![](https://discuss.tchncs.de/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)\n
      \n
      This is obviously bad, because now when the mosfet is off, the ADC input sees the whole battery voltage.\n
      \n
      To address that issue, I’ve added a second mosfet into the measure path:\n
      \n
      ![](https://discuss.tchncs.de/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)\n
      \n
      This works, and it does not draw any current, except while measuring.\n
      \n
      However, it’s quite a few parts. So I’m curious if anyone has an idea how to do this with just a single mosfet. It seems to me like it should be possible, but I haven’t figured out how.\n
      \n
      Oh, and if I’m doing something stupid here, please tell me :)
      """
    +type: "article"
    +lang: "en"
    +isOc: false
    +hasEmbed: false
    +commentCount: 11
    +favouriteCount: 17
    +score: 0
    +isAdult: false
    +sticky: false
    +lastActive: DateTime @1694781042 {#1715
      date: 2023-09-15 14:30:42.0 +02:00
    }
    +ip: null
    +adaAmount: 0
    +tags: null
    +mentions: null
    +comments: Doctrine\ORM\PersistentCollection {#1629 …}
    +votes: Doctrine\ORM\PersistentCollection {#1626 …}
    +reports: Doctrine\ORM\PersistentCollection {#1625 …}
    +favourites: Doctrine\ORM\PersistentCollection {#2370 …}
    +notifications: Doctrine\ORM\PersistentCollection {#2371 …}
    +badges: Doctrine\ORM\PersistentCollection {#1708 …}
    +children: [
      1 => App\Entity\EntryComment {#1709
        +user: App\Entity\User {#265
          +avatar: null
          +cover: null
          +email: "Yonrak@feddit.uk"
          +username: "@Yonrak@feddit.uk"
          +roles: []
          +followersCount: 0
          +homepage: "front"
          +about: null
          +lastActive: DateTime @1692955883 {#275
            date: 2023-08-25 11:31:23.0 +02:00
          }
          +markedForDeletionAt: null
          +fields: null
          +oauthGithubId: null
          +oauthGoogleId: null
          +oauthFacebookId: null
          +oauthKeycloakId: null
          +hideAdult: true
          +showSubscribedUsers: true
          +showSubscribedMagazines: true
          +showSubscribedDomains: true
          +preferredLanguages: []
          +featuredMagazines: null
          +showProfileSubscriptions: false
          +showProfileFollowings: true
          +markNewComments: false
          +notifyOnNewEntry: false
          +notifyOnNewEntryReply: true
          +notifyOnNewEntryCommentReply: true
          +notifyOnNewPost: false
          +notifyOnNewPostReply: true
          +notifyOnNewPostCommentReply: true
          +addMentionsEntries: false
          +addMentionsPosts: true
          +isBanned: false
          +isVerified: false
          +isDeleted: false
          +isBot: false
          +spamProtection: true
          +customCss: null
          +ignoreMagazinesCustomCss: false
          +moderatorTokens: Doctrine\ORM\PersistentCollection {#253 …}
          +magazineOwnershipRequests: Doctrine\ORM\PersistentCollection {#249 …}
          +moderatorRequests: Doctrine\ORM\PersistentCollection {#238 …}
          +entries: Doctrine\ORM\PersistentCollection {#196 …}
          +entryVotes: Doctrine\ORM\PersistentCollection {#168 …}
          +entryComments: Doctrine\ORM\PersistentCollection {#141 …}
          +entryCommentVotes: Doctrine\ORM\PersistentCollection {#111 …}
          +posts: Doctrine\ORM\PersistentCollection {#84 …}
          +postVotes: Doctrine\ORM\PersistentCollection {#99 …}
          +postComments: Doctrine\ORM\PersistentCollection {#1863 …}
          +postCommentVotes: Doctrine\ORM\PersistentCollection {#1479 …}
          +subscriptions: Doctrine\ORM\PersistentCollection {#1658 …}
          +subscribedDomains: Doctrine\ORM\PersistentCollection {#1868 …}
          +follows: Doctrine\ORM\PersistentCollection {#1917 …}
          +followers: Doctrine\ORM\PersistentCollection {#1601 …}
          +blocks: Doctrine\ORM\PersistentCollection {#1805 …}
          +blockers: Doctrine\ORM\PersistentCollection {#1810 …}
          +blockedMagazines: Doctrine\ORM\PersistentCollection {#1857 …}
          +blockedDomains: Doctrine\ORM\PersistentCollection {#1860 …}
          +reports: Doctrine\ORM\PersistentCollection {#1791 …}
          +favourites: Doctrine\ORM\PersistentCollection {#2416 …}
          +violations: Doctrine\ORM\PersistentCollection {#1824 …}
          +notifications: Doctrine\ORM\PersistentCollection {#1914 …}
          +awards: Doctrine\ORM\PersistentCollection {#1929 …}
          +subscribedCategories: Doctrine\ORM\PersistentCollection {#1867 …}
          +categories: Doctrine\ORM\PersistentCollection {#1880 …}
          -id: 42482
          -password: "$2y$13$NhIMiF1JXctMkB.To0A1l.9Yf5tUWEmnsXRxLOIoPHjfEy4B2UkMe"
          -totpSecret: null
          -totpBackupCodes: []
          -oAuth2UserConsents: Doctrine\ORM\PersistentCollection {#1894 …}
          +apId: "Yonrak@feddit.uk"
          +apProfileId: "https://feddit.uk/u/Yonrak"
          +apPublicUrl: "https://feddit.uk/u/Yonrak"
          +apFollowersUrl: null
          +apInboxUrl: "https://feddit.uk/inbox"
          +apDomain: "feddit.uk"
          +apPreferredUsername: "Yonrak"
          +apDiscoverable: true
          +apManuallyApprovesFollowers: false
          +privateKey: null
          +publicKey: null
          +apFetchedAt: DateTime @1692955883 {#269
            date: 2023-08-25 11:31:23.0 +02:00
          }
          +apDeletedAt: null
          +apTimeoutAt: null
          +visibility: "visible             "
          +createdAt: DateTimeImmutable @1692950596 {#268
            date: 2023-08-25 10:03:16.0 +02:00
          }
        }
        +entry: Proxies\__CG__\App\Entity\Entry {#1591 …2}
        +magazine: Proxies\__CG__\App\Entity\Magazine {#1584 …2}
        +image: null
        +parent: null
        +root: null
        +body: """
          Could you do similar to diagram 2, but instead of an N-FET use a P-FET between the battery and first resistor in the potential divider?\n
          \n
          Add a gate pull up resistor to source to ensure the FET is off by default, have the micro pull the gate down to take a measurement. You’ll probably need to add another resistor on the control pin to 0V to limit the voltage there also, but those two can be much much higher values to really limit current. Or use a zener/TVS diode instead of second resistor to clamp the voltage instead of dividing (more robust).\n
          \n
          Switch it with an NFET\n
          \n
          The micro will see 0V or divided/clamped battery voltage on the measurement pin.
          """
        +lang: "en"
        +isAdult: false
        +favouriteCount: 3
        +score: 0
        +lastActive: DateTime @1692955883 {#1439
          date: 2023-08-25 11:31:23.0 +02:00
        }
        +ip: null
        +tags: null
        +mentions: [
          "@nilclass@discuss.tchncs.de"
        ]
        +children: Doctrine\ORM\PersistentCollection {#1579 …}
        +nested: Doctrine\ORM\PersistentCollection {#1577 …}
        +votes: Doctrine\ORM\PersistentCollection {#1578 …}
        +reports: Doctrine\ORM\PersistentCollection {#1571 …}
        +favourites: Doctrine\ORM\PersistentCollection {#1574 …}
        +notifications: Doctrine\ORM\PersistentCollection {#1667 …}
        -id: 26779
        -bodyTs: "'0v':70,117 '2':7 'add':30,62 'also':76 'anoth':63 'batteri':22,120 'clamp':100 'control':67 'could':1 'current':89 'default':45 'diagram':6 'diod':94 'divid':29,105 'divided/clamped':119 'ensur':39 'fet':14,19,41 'first':24 'gate':32,51 'higher':84 'instead':9,95,103 'limit':72,88 'll':58 'measur':56,124 'micro':48,114 'much':82,83 'n':13 'n-fet':12 'need':60 'nfet':112 'p':18 'p-fet':17 'pin':68,125 'potenti':28 'probabl':59 'pull':33,49 'realli':87 'resistor':25,35,64,98 'robust':107 'second':97 'see':116 'similar':4 'sourc':37 'switch':108 'take':54 'two':79 'use':15,91 'valu':85 'voltag':74,102,121 'zener/tvs':93"
        +ranking: 0
        +commentCount: 0
        +upVotes: 0
        +downVotes: 0
        +visibility: "visible             "
        +apId: "https://feddit.uk/comment/2185380"
        +editedAt: DateTimeImmutable @1692969047 {#1435
          date: 2023-08-25 15:10:47.0 +02:00
        }
        +createdAt: DateTimeImmutable @1692950595 {#1436
          date: 2023-08-25 10:03:15.0 +02:00
        }
        +"title": 26779
      }
      0 => App\Entity\EntryComment {#1549
        +user: App\Entity\User {#265}
        +entry: Proxies\__CG__\App\Entity\Entry {#1591 …2}
        +magazine: Proxies\__CG__\App\Entity\Magazine {#1584 …2}
        +image: null
        +parent: Proxies\__CG__\App\Entity\EntryComment {#1692 …}
        +root: App\Entity\EntryComment {#1709}
        +body: """
          > Not sure I understand this point. Which resistor would you replace with a diode?\n
          \n
          Sorry, I think I was talking nonesense (doing this in my head and just woke up 😅).\n
          \n
          Not sure it’ll work with just a P-FET actually. You’ll likely need to control the PFET with a NFET, otherwise you still end up with too high a voltage on your control pin when the FET is off due to the gate pullup (unless you can use a fet with a very high Vgs Threshold and then drive it push/pull from the micro, but this isn’t really best practice).\n
          \n
          The above comment about diodes was to protect the microcontroller pin, but you end up not being able to control the FET doing it that way.\n
          \n
          I think either your existing Option 3 or PFET upstream of the divider, switched via an N-FET is the way to go.
          """
        +lang: "en"
        +isAdult: false
        +favouriteCount: 2
        +score: 0
        +lastActive: DateTime @1692955881 {#1673
          date: 2023-08-25 11:31:21.0 +02:00
        }
        +ip: null
        +tags: null
        +mentions: [
          "@nilclass@discuss.tchncs.de"
          "@Yonrak@feddit.uk"
        ]
        +children: Doctrine\ORM\PersistentCollection {#1691 …}
        +nested: Doctrine\ORM\PersistentCollection {#1680 …}
        +votes: Doctrine\ORM\PersistentCollection {#1683 …}
        +reports: Doctrine\ORM\PersistentCollection {#1702 …}
        +favourites: Doctrine\ORM\PersistentCollection {#1596 …}
        +notifications: Doctrine\ORM\PersistentCollection {#1613 …}
        -id: 26782
        -bodyTs: "'3':137 'abl':122 'actual':42 'best':103 'comment':107 'control':48,66,124 'diod':14,109 'divid':143 'drive':92 'due':73 'either':133 'end':57,118 'exist':135 'fet':41,70,83,126,149 'gate':76 'go':154 'head':26 'high':61,87 'isn':100 'like':45 'll':34,44 'micro':97 'microcontrol':114 'n':148 'n-fet':147 'need':46 'nfet':53 'nonesens':21 'option':136 'otherwis':54 'p':40 'p-fet':39 'pfet':50,139 'pin':67,115 'point':6 'practic':104 'protect':112 'pullup':77 'push/pull':94 'realli':102 'replac':11 'resistor':8 'sorri':15 'still':56 'sure':2,32 'switch':144 'talk':20 'think':17,132 'threshold':89 'understand':4 'unless':78 'upstream':140 'use':81 'vgs':88 'via':145 'voltag':63 'way':130,152 'woke':29 'work':35 'would':9"
        +ranking: 0
        +commentCount: 0
        +upVotes: 0
        +downVotes: 0
        +visibility: "visible             "
        +apId: "https://feddit.uk/comment/2186641"
        +editedAt: DateTimeImmutable @1692956099 {#1560
          date: 2023-08-25 11:34:59.0 +02:00
        }
        +createdAt: DateTimeImmutable @1692955881 {#1568
          date: 2023-08-25 11:31:21.0 +02:00
        }
        +"title": 26782
      }
    ]
    -id: 1944
    -titleTs: "'batteri':5 'circuit':7 'improv':3 'measur':6"
    -bodyTs: "'/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)':152 '/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)':188 '/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)':53 '1.1':69,77 '10':107 '100µa':127 '10kω':88 '5v':5 '9v':12 'abl':73 'ad':178 'adc':85,95,165 'add':137 'address':173 'analog':99 'anyon':213 'approxim':106 'arduino':7 'atmega':83,91 'atmega328p':9 'bad':156 'batteri':28,130,170 'block':13 'bother':118 'buck':16 'chosen':56 'circuit':123 'clone':8 'constant':125 'convert':17 'curious':211 'current':197 'datasheet':92 'discuss.tchncs.de':52,151,187 'discuss.tchncs.de/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)':150 'discuss.tchncs.de/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)':186 'discuss.tchncs.de/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)':51 'divid':50,142 'draw':126,195 'except':198 'figur':239 'first':42 'full':38 'get':33 'great':113 'haven':237 'howev':201 'idea':35,43,216 'imped':104 'input':166 'intern':79 'issu':175 'kω':108 'less':110 'let':22 'like':230 'm':210,246 'measur':26,66,149,184,200 'microcontrol':6,24 'mosfet':139,161,181,225 'next':133 'obvious':155 'occasion':25 'oh':242 'optim':97 'output':67,103 'part':207 'path':185 'pleas':251 'possibl':234 'power':3 'quit':204 'r1':86 'r2':87 'refer':80 'resistor':58 'say':93 'second':180 'see':167 'seem':227 'signal':100 'simpl':48 'sinc':89 'singl':224 'someth':248 'stupid':249 'switch':144 'tell':252 'thought':134 'use':10,46,75 'v':70,78 'valu':59 've':55,177 'voltag':29,49,63,171 'want':20 'whole':169 'work':190"
    +cross: false
    +upVotes: 0
    +downVotes: 0
    +ranking: 1693029637
    +visibility: "visible             "
    +apId: "https://discuss.tchncs.de/post/2309537"
    +editedAt: DateTimeImmutable @1692947232 {#1693
      date: 2023-08-25 09:07:12.0 +02:00
    }
    +createdAt: DateTimeImmutable @1692947137 {#1740
      date: 2023-08-25 09:05:37.0 +02:00
    }
    +__isInitialized__: true
     …2
  }
  -cache: Symfony\Component\Cache\Adapter\TraceableTagAwareAdapter {#600 …}
}
entry_comment App\Twig\Components\EntryCommentComponent 12.0 MiB 16.37 ms
Input props
[
  "comment" => App\Entity\EntryComment {#1709
    +user: App\Entity\User {#265
      +avatar: null
      +cover: null
      +email: "Yonrak@feddit.uk"
      +username: "@Yonrak@feddit.uk"
      +roles: []
      +followersCount: 0
      +homepage: "front"
      +about: null
      +lastActive: DateTime @1692955883 {#275
        date: 2023-08-25 11:31:23.0 +02:00
      }
      +markedForDeletionAt: null
      +fields: null
      +oauthGithubId: null
      +oauthGoogleId: null
      +oauthFacebookId: null
      +oauthKeycloakId: null
      +hideAdult: true
      +showSubscribedUsers: true
      +showSubscribedMagazines: true
      +showSubscribedDomains: true
      +preferredLanguages: []
      +featuredMagazines: null
      +showProfileSubscriptions: false
      +showProfileFollowings: true
      +markNewComments: false
      +notifyOnNewEntry: false
      +notifyOnNewEntryReply: true
      +notifyOnNewEntryCommentReply: true
      +notifyOnNewPost: false
      +notifyOnNewPostReply: true
      +notifyOnNewPostCommentReply: true
      +addMentionsEntries: false
      +addMentionsPosts: true
      +isBanned: false
      +isVerified: false
      +isDeleted: false
      +isBot: false
      +spamProtection: true
      +customCss: null
      +ignoreMagazinesCustomCss: false
      +moderatorTokens: Doctrine\ORM\PersistentCollection {#253 …}
      +magazineOwnershipRequests: Doctrine\ORM\PersistentCollection {#249 …}
      +moderatorRequests: Doctrine\ORM\PersistentCollection {#238 …}
      +entries: Doctrine\ORM\PersistentCollection {#196 …}
      +entryVotes: Doctrine\ORM\PersistentCollection {#168 …}
      +entryComments: Doctrine\ORM\PersistentCollection {#141 …}
      +entryCommentVotes: Doctrine\ORM\PersistentCollection {#111 …}
      +posts: Doctrine\ORM\PersistentCollection {#84 …}
      +postVotes: Doctrine\ORM\PersistentCollection {#99 …}
      +postComments: Doctrine\ORM\PersistentCollection {#1863 …}
      +postCommentVotes: Doctrine\ORM\PersistentCollection {#1479 …}
      +subscriptions: Doctrine\ORM\PersistentCollection {#1658 …}
      +subscribedDomains: Doctrine\ORM\PersistentCollection {#1868 …}
      +follows: Doctrine\ORM\PersistentCollection {#1917 …}
      +followers: Doctrine\ORM\PersistentCollection {#1601 …}
      +blocks: Doctrine\ORM\PersistentCollection {#1805 …}
      +blockers: Doctrine\ORM\PersistentCollection {#1810 …}
      +blockedMagazines: Doctrine\ORM\PersistentCollection {#1857 …}
      +blockedDomains: Doctrine\ORM\PersistentCollection {#1860 …}
      +reports: Doctrine\ORM\PersistentCollection {#1791 …}
      +favourites: Doctrine\ORM\PersistentCollection {#2416 …}
      +violations: Doctrine\ORM\PersistentCollection {#1824 …}
      +notifications: Doctrine\ORM\PersistentCollection {#1914 …}
      +awards: Doctrine\ORM\PersistentCollection {#1929 …}
      +subscribedCategories: Doctrine\ORM\PersistentCollection {#1867 …}
      +categories: Doctrine\ORM\PersistentCollection {#1880 …}
      -id: 42482
      -password: "$2y$13$NhIMiF1JXctMkB.To0A1l.9Yf5tUWEmnsXRxLOIoPHjfEy4B2UkMe"
      -totpSecret: null
      -totpBackupCodes: []
      -oAuth2UserConsents: Doctrine\ORM\PersistentCollection {#1894 …}
      +apId: "Yonrak@feddit.uk"
      +apProfileId: "https://feddit.uk/u/Yonrak"
      +apPublicUrl: "https://feddit.uk/u/Yonrak"
      +apFollowersUrl: null
      +apInboxUrl: "https://feddit.uk/inbox"
      +apDomain: "feddit.uk"
      +apPreferredUsername: "Yonrak"
      +apDiscoverable: true
      +apManuallyApprovesFollowers: false
      +privateKey: null
      +publicKey: null
      +apFetchedAt: DateTime @1692955883 {#269
        date: 2023-08-25 11:31:23.0 +02:00
      }
      +apDeletedAt: null
      +apTimeoutAt: null
      +visibility: "visible             "
      +createdAt: DateTimeImmutable @1692950596 {#268
        date: 2023-08-25 10:03:16.0 +02:00
      }
    }
    +entry: Proxies\__CG__\App\Entity\Entry {#1591
      +user: Proxies\__CG__\App\Entity\User {#2459
        +avatar: null
        +cover: null
        +email: "nilclass@discuss.tchncs.de"
        +username: "@nilclass@discuss.tchncs.de"
        +roles: []
        +followersCount: 0
        +homepage: "front"
        +about: null
        +lastActive: DateTime @1721268563 {#3096
          date: 2024-07-18 04:09:23.0 +02:00
        }
        +markedForDeletionAt: null
        +fields: null
        +oauthGithubId: null
        +oauthGoogleId: null
        +oauthFacebookId: null
        +oauthKeycloakId: null
        +hideAdult: true
        +showSubscribedUsers: true
        +showSubscribedMagazines: true
        +showSubscribedDomains: true
        +preferredLanguages: []
        +featuredMagazines: null
        +showProfileSubscriptions: true
        +showProfileFollowings: true
        +markNewComments: false
        +notifyOnNewEntry: false
        +notifyOnNewEntryReply: false
        +notifyOnNewEntryCommentReply: false
        +notifyOnNewPost: false
        +notifyOnNewPostReply: false
        +notifyOnNewPostCommentReply: false
        +addMentionsEntries: false
        +addMentionsPosts: true
        +isBanned: false
        +isVerified: false
        +isDeleted: false
        +isBot: false
        +spamProtection: true
        +customCss: null
        +ignoreMagazinesCustomCss: false
        +moderatorTokens: Doctrine\ORM\PersistentCollection {#3099 …}
        +magazineOwnershipRequests: Doctrine\ORM\PersistentCollection {#3101 …}
        +moderatorRequests: Doctrine\ORM\PersistentCollection {#3103 …}
        +entries: Doctrine\ORM\PersistentCollection {#3105 …}
        +entryVotes: Doctrine\ORM\PersistentCollection {#3107 …}
        +entryComments: Doctrine\ORM\PersistentCollection {#3109 …}
        +entryCommentVotes: Doctrine\ORM\PersistentCollection {#3111 …}
        +posts: Doctrine\ORM\PersistentCollection {#3113 …}
        +postVotes: Doctrine\ORM\PersistentCollection {#3115 …}
        +postComments: Doctrine\ORM\PersistentCollection {#3117 …}
        +postCommentVotes: Doctrine\ORM\PersistentCollection {#3119 …}
        +subscriptions: Doctrine\ORM\PersistentCollection {#3121 …}
        +subscribedDomains: Doctrine\ORM\PersistentCollection {#3123 …}
        +follows: Doctrine\ORM\PersistentCollection {#3125 …}
        +followers: Doctrine\ORM\PersistentCollection {#3127 …}
        +blocks: Doctrine\ORM\PersistentCollection {#3129 …}
        +blockers: Doctrine\ORM\PersistentCollection {#3131 …}
        +blockedMagazines: Doctrine\ORM\PersistentCollection {#3133 …}
        +blockedDomains: Doctrine\ORM\PersistentCollection {#3135 …}
        +reports: Doctrine\ORM\PersistentCollection {#3137 …}
        +favourites: Doctrine\ORM\PersistentCollection {#3139 …}
        +violations: Doctrine\ORM\PersistentCollection {#3141 …}
        +notifications: Doctrine\ORM\PersistentCollection {#3143 …}
        +awards: Doctrine\ORM\PersistentCollection {#3145 …}
        +subscribedCategories: Doctrine\ORM\PersistentCollection {#3147 …}
        +categories: Doctrine\ORM\PersistentCollection {#3149 …}
        -id: 6046
        -password: "$2y$13$FEroXtR95mjA6.omogLZRe7NJuWUL6hb.9a/FfXkqyIPnPgg4Apme"
        -totpSecret: null
        -totpBackupCodes: []
        -oAuth2UserConsents: Doctrine\ORM\PersistentCollection {#3151 …}
        +apId: "nilclass@discuss.tchncs.de"
        +apProfileId: "https://discuss.tchncs.de/u/nilclass"
        +apPublicUrl: "https://discuss.tchncs.de/u/nilclass"
        +apFollowersUrl: null
        +apInboxUrl: "https://discuss.tchncs.de/inbox"
        +apDomain: "discuss.tchncs.de"
        +apPreferredUsername: "nilclass"
        +apDiscoverable: true
        +apManuallyApprovesFollowers: false
        +privateKey: null
        +publicKey: null
        +apFetchedAt: DateTime @1720630912 {#3097
          date: 2024-07-10 19:01:52.0 +02:00
        }
        +apDeletedAt: null
        +apTimeoutAt: null
        +visibility: "visible             "
        +createdAt: DateTimeImmutable @1687291240 {#3098
          date: 2023-06-20 22:00:40.0 +02:00
        }
        +__isInitialized__: true
         …2
      }
      +magazine: Proxies\__CG__\App\Entity\Magazine {#1584
        +icon: Proxies\__CG__\App\Entity\Image {#2886 …}
        +name: "askelectronics@discuss.tchncs.de"
        +title: "askelectronics"
        +description: """
          **For questions about component-level electronic circuits, tools and equipment.**\n
          \n
          Rules\n
          -----\n
          \n
          1: Be nice.\n
          \n
          2: Be on-topic (eg: *Electronic*, not *electrical*).\n
          \n
          3: No commercial stuff, buying, selling or valuations.\n
          \n
          4: Be safe.\n
          \n
          ---
          """
        +rules: null
        +subscriptionsCount: 1
        +entryCount: 154
        +entryCommentCount: 1230
        +postCount: 1
        +postCommentCount: 4
        +isAdult: false
        +customCss: null
        +lastActive: DateTime @1729413608 {#2865
          date: 2024-10-20 10:40:08.0 +02:00
        }
        +markedForDeletionAt: null
        +tags: null
        +moderators: Doctrine\ORM\PersistentCollection {#2885 …}
        +ownershipRequests: Doctrine\ORM\PersistentCollection {#2883 …}
        +moderatorRequests: Doctrine\ORM\PersistentCollection {#2888 …}
        +entries: Doctrine\ORM\PersistentCollection {#2889 …}
        +posts: Doctrine\ORM\PersistentCollection {#2892 …}
        +subscriptions: Doctrine\ORM\PersistentCollection {#2894 …}
        +bans: Doctrine\ORM\PersistentCollection {#2900 …}
        +reports: Doctrine\ORM\PersistentCollection {#2908 …}
        +badges: Doctrine\ORM\PersistentCollection {#2921 …}
        +logs: Doctrine\ORM\PersistentCollection {#2931 …}
        +awards: Doctrine\ORM\PersistentCollection {#2913 …}
        +categories: Doctrine\ORM\PersistentCollection {#2937 …}
        -id: 11
        +apId: "askelectronics@discuss.tchncs.de"
        +apProfileId: "https://discuss.tchncs.de/c/askelectronics"
        +apPublicUrl: "https://discuss.tchncs.de/c/askelectronics"
        +apFollowersUrl: "https://discuss.tchncs.de/c/askelectronics/followers"
        +apInboxUrl: "https://discuss.tchncs.de/inbox"
        +apDomain: "discuss.tchncs.de"
        +apPreferredUsername: "askelectronics"
        +apDiscoverable: true
        +apManuallyApprovesFollowers: null
        +privateKey: null
        +publicKey: null
        +apFetchedAt: DateTime @1727247714 {#2866
          date: 2024-09-25 09:01:54.0 +02:00
        }
        +apDeletedAt: null
        +apTimeoutAt: null
        +visibility: "visible             "
        +createdAt: DateTimeImmutable @1687144409 {#2867
          date: 2023-06-19 05:13:29.0 +02:00
        }
        +__isInitialized__: true
         …2
      }
      +image: null
      +domain: Proxies\__CG__\App\Entity\Domain {#1630 …}
      +slug: "How-to-improve-my-battery-measurement-circuit"
      +title: "How to improve my battery measurement circuit?"
      +url: null
      +body: """
        I am powering a 5V microcontroller (arduino clone, atmega328p) using a 9V block and a buck converter. Now I want to let the microcontroller occasionally measure the battery voltage, so I can get an idea of how full it is.\n
        \n
        My first idea was to use a simple voltage divider:\n
        \n
        ![](https://discuss.tchncs.de/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)\n
        \n
        I’ve chosen the resistor values so that:\n
        \n
        - the voltage at the measure output is `< 1.1V`, to be able to use the 1.1V internal reference of the atmega’s ADC\n
        - `R1 || R2 < 10kΩ`, since the atmega datasheet says “The ADC is optimized for analog signals with an output impedance of approximately 10 kΩ or less”\n
        \n
        This is great and all, but what bothers me is that this circuit will constantly draw ~100µA from the battery.\n
        \n
        So, my next thought was to add a mosfet to the divider, to switch it on only while measuring:\n
        \n
        ![](https://discuss.tchncs.de/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)\n
        \n
        This is obviously bad, because now when the mosfet is off, the ADC input sees the whole battery voltage.\n
        \n
        To address that issue, I’ve added a second mosfet into the measure path:\n
        \n
        ![](https://discuss.tchncs.de/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)\n
        \n
        This works, and it does not draw any current, except while measuring.\n
        \n
        However, it’s quite a few parts. So I’m curious if anyone has an idea how to do this with just a single mosfet. It seems to me like it should be possible, but I haven’t figured out how.\n
        \n
        Oh, and if I’m doing something stupid here, please tell me :)
        """
      +type: "article"
      +lang: "en"
      +isOc: false
      +hasEmbed: false
      +commentCount: 11
      +favouriteCount: 17
      +score: 0
      +isAdult: false
      +sticky: false
      +lastActive: DateTime @1694781042 {#1715
        date: 2023-09-15 14:30:42.0 +02:00
      }
      +ip: null
      +adaAmount: 0
      +tags: null
      +mentions: null
      +comments: Doctrine\ORM\PersistentCollection {#1629 …}
      +votes: Doctrine\ORM\PersistentCollection {#1626 …}
      +reports: Doctrine\ORM\PersistentCollection {#1625 …}
      +favourites: Doctrine\ORM\PersistentCollection {#2370 …}
      +notifications: Doctrine\ORM\PersistentCollection {#2371 …}
      +badges: Doctrine\ORM\PersistentCollection {#1708 …}
      +children: [
        1 => App\Entity\EntryComment {#1709}
        0 => App\Entity\EntryComment {#1549
          +user: App\Entity\User {#265}
          +entry: Proxies\__CG__\App\Entity\Entry {#1591 …2}
          +magazine: Proxies\__CG__\App\Entity\Magazine {#1584 …2}
          +image: null
          +parent: Proxies\__CG__\App\Entity\EntryComment {#1692 …}
          +root: App\Entity\EntryComment {#1709}
          +body: """
            > Not sure I understand this point. Which resistor would you replace with a diode?\n
            \n
            Sorry, I think I was talking nonesense (doing this in my head and just woke up 😅).\n
            \n
            Not sure it’ll work with just a P-FET actually. You’ll likely need to control the PFET with a NFET, otherwise you still end up with too high a voltage on your control pin when the FET is off due to the gate pullup (unless you can use a fet with a very high Vgs Threshold and then drive it push/pull from the micro, but this isn’t really best practice).\n
            \n
            The above comment about diodes was to protect the microcontroller pin, but you end up not being able to control the FET doing it that way.\n
            \n
            I think either your existing Option 3 or PFET upstream of the divider, switched via an N-FET is the way to go.
            """
          +lang: "en"
          +isAdult: false
          +favouriteCount: 2
          +score: 0
          +lastActive: DateTime @1692955881 {#1673
            date: 2023-08-25 11:31:21.0 +02:00
          }
          +ip: null
          +tags: null
          +mentions: [
            "@nilclass@discuss.tchncs.de"
            "@Yonrak@feddit.uk"
          ]
          +children: Doctrine\ORM\PersistentCollection {#1691 …}
          +nested: Doctrine\ORM\PersistentCollection {#1680 …}
          +votes: Doctrine\ORM\PersistentCollection {#1683 …}
          +reports: Doctrine\ORM\PersistentCollection {#1702 …}
          +favourites: Doctrine\ORM\PersistentCollection {#1596 …}
          +notifications: Doctrine\ORM\PersistentCollection {#1613 …}
          -id: 26782
          -bodyTs: "'3':137 'abl':122 'actual':42 'best':103 'comment':107 'control':48,66,124 'diod':14,109 'divid':143 'drive':92 'due':73 'either':133 'end':57,118 'exist':135 'fet':41,70,83,126,149 'gate':76 'go':154 'head':26 'high':61,87 'isn':100 'like':45 'll':34,44 'micro':97 'microcontrol':114 'n':148 'n-fet':147 'need':46 'nfet':53 'nonesens':21 'option':136 'otherwis':54 'p':40 'p-fet':39 'pfet':50,139 'pin':67,115 'point':6 'practic':104 'protect':112 'pullup':77 'push/pull':94 'realli':102 'replac':11 'resistor':8 'sorri':15 'still':56 'sure':2,32 'switch':144 'talk':20 'think':17,132 'threshold':89 'understand':4 'unless':78 'upstream':140 'use':81 'vgs':88 'via':145 'voltag':63 'way':130,152 'woke':29 'work':35 'would':9"
          +ranking: 0
          +commentCount: 0
          +upVotes: 0
          +downVotes: 0
          +visibility: "visible             "
          +apId: "https://feddit.uk/comment/2186641"
          +editedAt: DateTimeImmutable @1692956099 {#1560
            date: 2023-08-25 11:34:59.0 +02:00
          }
          +createdAt: DateTimeImmutable @1692955881 {#1568
            date: 2023-08-25 11:31:21.0 +02:00
          }
          +"title": 26782
        }
      ]
      -id: 1944
      -titleTs: "'batteri':5 'circuit':7 'improv':3 'measur':6"
      -bodyTs: "'/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)':152 '/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)':188 '/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)':53 '1.1':69,77 '10':107 '100µa':127 '10kω':88 '5v':5 '9v':12 'abl':73 'ad':178 'adc':85,95,165 'add':137 'address':173 'analog':99 'anyon':213 'approxim':106 'arduino':7 'atmega':83,91 'atmega328p':9 'bad':156 'batteri':28,130,170 'block':13 'bother':118 'buck':16 'chosen':56 'circuit':123 'clone':8 'constant':125 'convert':17 'curious':211 'current':197 'datasheet':92 'discuss.tchncs.de':52,151,187 'discuss.tchncs.de/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)':150 'discuss.tchncs.de/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)':186 'discuss.tchncs.de/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)':51 'divid':50,142 'draw':126,195 'except':198 'figur':239 'first':42 'full':38 'get':33 'great':113 'haven':237 'howev':201 'idea':35,43,216 'imped':104 'input':166 'intern':79 'issu':175 'kω':108 'less':110 'let':22 'like':230 'm':210,246 'measur':26,66,149,184,200 'microcontrol':6,24 'mosfet':139,161,181,225 'next':133 'obvious':155 'occasion':25 'oh':242 'optim':97 'output':67,103 'part':207 'path':185 'pleas':251 'possibl':234 'power':3 'quit':204 'r1':86 'r2':87 'refer':80 'resistor':58 'say':93 'second':180 'see':167 'seem':227 'signal':100 'simpl':48 'sinc':89 'singl':224 'someth':248 'stupid':249 'switch':144 'tell':252 'thought':134 'use':10,46,75 'v':70,78 'valu':59 've':55,177 'voltag':29,49,63,171 'want':20 'whole':169 'work':190"
      +cross: false
      +upVotes: 0
      +downVotes: 0
      +ranking: 1693029637
      +visibility: "visible             "
      +apId: "https://discuss.tchncs.de/post/2309537"
      +editedAt: DateTimeImmutable @1692947232 {#1693
        date: 2023-08-25 09:07:12.0 +02:00
      }
      +createdAt: DateTimeImmutable @1692947137 {#1740
        date: 2023-08-25 09:05:37.0 +02:00
      }
      +__isInitialized__: true
       …2
    }
    +magazine: Proxies\__CG__\App\Entity\Magazine {#1584 …2}
    +image: null
    +parent: null
    +root: null
    +body: """
      Could you do similar to diagram 2, but instead of an N-FET use a P-FET between the battery and first resistor in the potential divider?\n
      \n
      Add a gate pull up resistor to source to ensure the FET is off by default, have the micro pull the gate down to take a measurement. You’ll probably need to add another resistor on the control pin to 0V to limit the voltage there also, but those two can be much much higher values to really limit current. Or use a zener/TVS diode instead of second resistor to clamp the voltage instead of dividing (more robust).\n
      \n
      Switch it with an NFET\n
      \n
      The micro will see 0V or divided/clamped battery voltage on the measurement pin.
      """
    +lang: "en"
    +isAdult: false
    +favouriteCount: 3
    +score: 0
    +lastActive: DateTime @1692955883 {#1439
      date: 2023-08-25 11:31:23.0 +02:00
    }
    +ip: null
    +tags: null
    +mentions: [
      "@nilclass@discuss.tchncs.de"
    ]
    +children: Doctrine\ORM\PersistentCollection {#1579 …}
    +nested: Doctrine\ORM\PersistentCollection {#1577 …}
    +votes: Doctrine\ORM\PersistentCollection {#1578 …}
    +reports: Doctrine\ORM\PersistentCollection {#1571 …}
    +favourites: Doctrine\ORM\PersistentCollection {#1574 …}
    +notifications: Doctrine\ORM\PersistentCollection {#1667 …}
    -id: 26779
    -bodyTs: "'0v':70,117 '2':7 'add':30,62 'also':76 'anoth':63 'batteri':22,120 'clamp':100 'control':67 'could':1 'current':89 'default':45 'diagram':6 'diod':94 'divid':29,105 'divided/clamped':119 'ensur':39 'fet':14,19,41 'first':24 'gate':32,51 'higher':84 'instead':9,95,103 'limit':72,88 'll':58 'measur':56,124 'micro':48,114 'much':82,83 'n':13 'n-fet':12 'need':60 'nfet':112 'p':18 'p-fet':17 'pin':68,125 'potenti':28 'probabl':59 'pull':33,49 'realli':87 'resistor':25,35,64,98 'robust':107 'second':97 'see':116 'similar':4 'sourc':37 'switch':108 'take':54 'two':79 'use':15,91 'valu':85 'voltag':74,102,121 'zener/tvs':93"
    +ranking: 0
    +commentCount: 0
    +upVotes: 0
    +downVotes: 0
    +visibility: "visible             "
    +apId: "https://feddit.uk/comment/2185380"
    +editedAt: DateTimeImmutable @1692969047 {#1435
      date: 2023-08-25 15:10:47.0 +02:00
    }
    +createdAt: DateTimeImmutable @1692950595 {#1436
      date: 2023-08-25 10:03:15.0 +02:00
    }
    +"title": 26779
  }
  "showEntryTitle" => false
  "dateAsUrl" => true
  "showMagazineName" => false
]
Attributes
[]
Component
App\Twig\Components\EntryCommentComponent {#3750
  +comment: App\Entity\EntryComment {#1709
    +user: App\Entity\User {#265
      +avatar: null
      +cover: null
      +email: "Yonrak@feddit.uk"
      +username: "@Yonrak@feddit.uk"
      +roles: []
      +followersCount: 0
      +homepage: "front"
      +about: null
      +lastActive: DateTime @1692955883 {#275
        date: 2023-08-25 11:31:23.0 +02:00
      }
      +markedForDeletionAt: null
      +fields: null
      +oauthGithubId: null
      +oauthGoogleId: null
      +oauthFacebookId: null
      +oauthKeycloakId: null
      +hideAdult: true
      +showSubscribedUsers: true
      +showSubscribedMagazines: true
      +showSubscribedDomains: true
      +preferredLanguages: []
      +featuredMagazines: null
      +showProfileSubscriptions: false
      +showProfileFollowings: true
      +markNewComments: false
      +notifyOnNewEntry: false
      +notifyOnNewEntryReply: true
      +notifyOnNewEntryCommentReply: true
      +notifyOnNewPost: false
      +notifyOnNewPostReply: true
      +notifyOnNewPostCommentReply: true
      +addMentionsEntries: false
      +addMentionsPosts: true
      +isBanned: false
      +isVerified: false
      +isDeleted: false
      +isBot: false
      +spamProtection: true
      +customCss: null
      +ignoreMagazinesCustomCss: false
      +moderatorTokens: Doctrine\ORM\PersistentCollection {#253 …}
      +magazineOwnershipRequests: Doctrine\ORM\PersistentCollection {#249 …}
      +moderatorRequests: Doctrine\ORM\PersistentCollection {#238 …}
      +entries: Doctrine\ORM\PersistentCollection {#196 …}
      +entryVotes: Doctrine\ORM\PersistentCollection {#168 …}
      +entryComments: Doctrine\ORM\PersistentCollection {#141 …}
      +entryCommentVotes: Doctrine\ORM\PersistentCollection {#111 …}
      +posts: Doctrine\ORM\PersistentCollection {#84 …}
      +postVotes: Doctrine\ORM\PersistentCollection {#99 …}
      +postComments: Doctrine\ORM\PersistentCollection {#1863 …}
      +postCommentVotes: Doctrine\ORM\PersistentCollection {#1479 …}
      +subscriptions: Doctrine\ORM\PersistentCollection {#1658 …}
      +subscribedDomains: Doctrine\ORM\PersistentCollection {#1868 …}
      +follows: Doctrine\ORM\PersistentCollection {#1917 …}
      +followers: Doctrine\ORM\PersistentCollection {#1601 …}
      +blocks: Doctrine\ORM\PersistentCollection {#1805 …}
      +blockers: Doctrine\ORM\PersistentCollection {#1810 …}
      +blockedMagazines: Doctrine\ORM\PersistentCollection {#1857 …}
      +blockedDomains: Doctrine\ORM\PersistentCollection {#1860 …}
      +reports: Doctrine\ORM\PersistentCollection {#1791 …}
      +favourites: Doctrine\ORM\PersistentCollection {#2416 …}
      +violations: Doctrine\ORM\PersistentCollection {#1824 …}
      +notifications: Doctrine\ORM\PersistentCollection {#1914 …}
      +awards: Doctrine\ORM\PersistentCollection {#1929 …}
      +subscribedCategories: Doctrine\ORM\PersistentCollection {#1867 …}
      +categories: Doctrine\ORM\PersistentCollection {#1880 …}
      -id: 42482
      -password: "$2y$13$NhIMiF1JXctMkB.To0A1l.9Yf5tUWEmnsXRxLOIoPHjfEy4B2UkMe"
      -totpSecret: null
      -totpBackupCodes: []
      -oAuth2UserConsents: Doctrine\ORM\PersistentCollection {#1894 …}
      +apId: "Yonrak@feddit.uk"
      +apProfileId: "https://feddit.uk/u/Yonrak"
      +apPublicUrl: "https://feddit.uk/u/Yonrak"
      +apFollowersUrl: null
      +apInboxUrl: "https://feddit.uk/inbox"
      +apDomain: "feddit.uk"
      +apPreferredUsername: "Yonrak"
      +apDiscoverable: true
      +apManuallyApprovesFollowers: false
      +privateKey: null
      +publicKey: null
      +apFetchedAt: DateTime @1692955883 {#269
        date: 2023-08-25 11:31:23.0 +02:00
      }
      +apDeletedAt: null
      +apTimeoutAt: null
      +visibility: "visible             "
      +createdAt: DateTimeImmutable @1692950596 {#268
        date: 2023-08-25 10:03:16.0 +02:00
      }
    }
    +entry: Proxies\__CG__\App\Entity\Entry {#1591
      +user: Proxies\__CG__\App\Entity\User {#2459
        +avatar: null
        +cover: null
        +email: "nilclass@discuss.tchncs.de"
        +username: "@nilclass@discuss.tchncs.de"
        +roles: []
        +followersCount: 0
        +homepage: "front"
        +about: null
        +lastActive: DateTime @1721268563 {#3096
          date: 2024-07-18 04:09:23.0 +02:00
        }
        +markedForDeletionAt: null
        +fields: null
        +oauthGithubId: null
        +oauthGoogleId: null
        +oauthFacebookId: null
        +oauthKeycloakId: null
        +hideAdult: true
        +showSubscribedUsers: true
        +showSubscribedMagazines: true
        +showSubscribedDomains: true
        +preferredLanguages: []
        +featuredMagazines: null
        +showProfileSubscriptions: true
        +showProfileFollowings: true
        +markNewComments: false
        +notifyOnNewEntry: false
        +notifyOnNewEntryReply: false
        +notifyOnNewEntryCommentReply: false
        +notifyOnNewPost: false
        +notifyOnNewPostReply: false
        +notifyOnNewPostCommentReply: false
        +addMentionsEntries: false
        +addMentionsPosts: true
        +isBanned: false
        +isVerified: false
        +isDeleted: false
        +isBot: false
        +spamProtection: true
        +customCss: null
        +ignoreMagazinesCustomCss: false
        +moderatorTokens: Doctrine\ORM\PersistentCollection {#3099 …}
        +magazineOwnershipRequests: Doctrine\ORM\PersistentCollection {#3101 …}
        +moderatorRequests: Doctrine\ORM\PersistentCollection {#3103 …}
        +entries: Doctrine\ORM\PersistentCollection {#3105 …}
        +entryVotes: Doctrine\ORM\PersistentCollection {#3107 …}
        +entryComments: Doctrine\ORM\PersistentCollection {#3109 …}
        +entryCommentVotes: Doctrine\ORM\PersistentCollection {#3111 …}
        +posts: Doctrine\ORM\PersistentCollection {#3113 …}
        +postVotes: Doctrine\ORM\PersistentCollection {#3115 …}
        +postComments: Doctrine\ORM\PersistentCollection {#3117 …}
        +postCommentVotes: Doctrine\ORM\PersistentCollection {#3119 …}
        +subscriptions: Doctrine\ORM\PersistentCollection {#3121 …}
        +subscribedDomains: Doctrine\ORM\PersistentCollection {#3123 …}
        +follows: Doctrine\ORM\PersistentCollection {#3125 …}
        +followers: Doctrine\ORM\PersistentCollection {#3127 …}
        +blocks: Doctrine\ORM\PersistentCollection {#3129 …}
        +blockers: Doctrine\ORM\PersistentCollection {#3131 …}
        +blockedMagazines: Doctrine\ORM\PersistentCollection {#3133 …}
        +blockedDomains: Doctrine\ORM\PersistentCollection {#3135 …}
        +reports: Doctrine\ORM\PersistentCollection {#3137 …}
        +favourites: Doctrine\ORM\PersistentCollection {#3139 …}
        +violations: Doctrine\ORM\PersistentCollection {#3141 …}
        +notifications: Doctrine\ORM\PersistentCollection {#3143 …}
        +awards: Doctrine\ORM\PersistentCollection {#3145 …}
        +subscribedCategories: Doctrine\ORM\PersistentCollection {#3147 …}
        +categories: Doctrine\ORM\PersistentCollection {#3149 …}
        -id: 6046
        -password: "$2y$13$FEroXtR95mjA6.omogLZRe7NJuWUL6hb.9a/FfXkqyIPnPgg4Apme"
        -totpSecret: null
        -totpBackupCodes: []
        -oAuth2UserConsents: Doctrine\ORM\PersistentCollection {#3151 …}
        +apId: "nilclass@discuss.tchncs.de"
        +apProfileId: "https://discuss.tchncs.de/u/nilclass"
        +apPublicUrl: "https://discuss.tchncs.de/u/nilclass"
        +apFollowersUrl: null
        +apInboxUrl: "https://discuss.tchncs.de/inbox"
        +apDomain: "discuss.tchncs.de"
        +apPreferredUsername: "nilclass"
        +apDiscoverable: true
        +apManuallyApprovesFollowers: false
        +privateKey: null
        +publicKey: null
        +apFetchedAt: DateTime @1720630912 {#3097
          date: 2024-07-10 19:01:52.0 +02:00
        }
        +apDeletedAt: null
        +apTimeoutAt: null
        +visibility: "visible             "
        +createdAt: DateTimeImmutable @1687291240 {#3098
          date: 2023-06-20 22:00:40.0 +02:00
        }
        +__isInitialized__: true
         …2
      }
      +magazine: Proxies\__CG__\App\Entity\Magazine {#1584
        +icon: Proxies\__CG__\App\Entity\Image {#2886 …}
        +name: "askelectronics@discuss.tchncs.de"
        +title: "askelectronics"
        +description: """
          **For questions about component-level electronic circuits, tools and equipment.**\n
          \n
          Rules\n
          -----\n
          \n
          1: Be nice.\n
          \n
          2: Be on-topic (eg: *Electronic*, not *electrical*).\n
          \n
          3: No commercial stuff, buying, selling or valuations.\n
          \n
          4: Be safe.\n
          \n
          ---
          """
        +rules: null
        +subscriptionsCount: 1
        +entryCount: 154
        +entryCommentCount: 1230
        +postCount: 1
        +postCommentCount: 4
        +isAdult: false
        +customCss: null
        +lastActive: DateTime @1729413608 {#2865
          date: 2024-10-20 10:40:08.0 +02:00
        }
        +markedForDeletionAt: null
        +tags: null
        +moderators: Doctrine\ORM\PersistentCollection {#2885 …}
        +ownershipRequests: Doctrine\ORM\PersistentCollection {#2883 …}
        +moderatorRequests: Doctrine\ORM\PersistentCollection {#2888 …}
        +entries: Doctrine\ORM\PersistentCollection {#2889 …}
        +posts: Doctrine\ORM\PersistentCollection {#2892 …}
        +subscriptions: Doctrine\ORM\PersistentCollection {#2894 …}
        +bans: Doctrine\ORM\PersistentCollection {#2900 …}
        +reports: Doctrine\ORM\PersistentCollection {#2908 …}
        +badges: Doctrine\ORM\PersistentCollection {#2921 …}
        +logs: Doctrine\ORM\PersistentCollection {#2931 …}
        +awards: Doctrine\ORM\PersistentCollection {#2913 …}
        +categories: Doctrine\ORM\PersistentCollection {#2937 …}
        -id: 11
        +apId: "askelectronics@discuss.tchncs.de"
        +apProfileId: "https://discuss.tchncs.de/c/askelectronics"
        +apPublicUrl: "https://discuss.tchncs.de/c/askelectronics"
        +apFollowersUrl: "https://discuss.tchncs.de/c/askelectronics/followers"
        +apInboxUrl: "https://discuss.tchncs.de/inbox"
        +apDomain: "discuss.tchncs.de"
        +apPreferredUsername: "askelectronics"
        +apDiscoverable: true
        +apManuallyApprovesFollowers: null
        +privateKey: null
        +publicKey: null
        +apFetchedAt: DateTime @1727247714 {#2866
          date: 2024-09-25 09:01:54.0 +02:00
        }
        +apDeletedAt: null
        +apTimeoutAt: null
        +visibility: "visible             "
        +createdAt: DateTimeImmutable @1687144409 {#2867
          date: 2023-06-19 05:13:29.0 +02:00
        }
        +__isInitialized__: true
         …2
      }
      +image: null
      +domain: Proxies\__CG__\App\Entity\Domain {#1630 …}
      +slug: "How-to-improve-my-battery-measurement-circuit"
      +title: "How to improve my battery measurement circuit?"
      +url: null
      +body: """
        I am powering a 5V microcontroller (arduino clone, atmega328p) using a 9V block and a buck converter. Now I want to let the microcontroller occasionally measure the battery voltage, so I can get an idea of how full it is.\n
        \n
        My first idea was to use a simple voltage divider:\n
        \n
        ![](https://discuss.tchncs.de/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)\n
        \n
        I’ve chosen the resistor values so that:\n
        \n
        - the voltage at the measure output is `< 1.1V`, to be able to use the 1.1V internal reference of the atmega’s ADC\n
        - `R1 || R2 < 10kΩ`, since the atmega datasheet says “The ADC is optimized for analog signals with an output impedance of approximately 10 kΩ or less”\n
        \n
        This is great and all, but what bothers me is that this circuit will constantly draw ~100µA from the battery.\n
        \n
        So, my next thought was to add a mosfet to the divider, to switch it on only while measuring:\n
        \n
        ![](https://discuss.tchncs.de/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)\n
        \n
        This is obviously bad, because now when the mosfet is off, the ADC input sees the whole battery voltage.\n
        \n
        To address that issue, I’ve added a second mosfet into the measure path:\n
        \n
        ![](https://discuss.tchncs.de/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)\n
        \n
        This works, and it does not draw any current, except while measuring.\n
        \n
        However, it’s quite a few parts. So I’m curious if anyone has an idea how to do this with just a single mosfet. It seems to me like it should be possible, but I haven’t figured out how.\n
        \n
        Oh, and if I’m doing something stupid here, please tell me :)
        """
      +type: "article"
      +lang: "en"
      +isOc: false
      +hasEmbed: false
      +commentCount: 11
      +favouriteCount: 17
      +score: 0
      +isAdult: false
      +sticky: false
      +lastActive: DateTime @1694781042 {#1715
        date: 2023-09-15 14:30:42.0 +02:00
      }
      +ip: null
      +adaAmount: 0
      +tags: null
      +mentions: null
      +comments: Doctrine\ORM\PersistentCollection {#1629 …}
      +votes: Doctrine\ORM\PersistentCollection {#1626 …}
      +reports: Doctrine\ORM\PersistentCollection {#1625 …}
      +favourites: Doctrine\ORM\PersistentCollection {#2370 …}
      +notifications: Doctrine\ORM\PersistentCollection {#2371 …}
      +badges: Doctrine\ORM\PersistentCollection {#1708 …}
      +children: [
        1 => App\Entity\EntryComment {#1709}
        0 => App\Entity\EntryComment {#1549
          +user: App\Entity\User {#265}
          +entry: Proxies\__CG__\App\Entity\Entry {#1591 …2}
          +magazine: Proxies\__CG__\App\Entity\Magazine {#1584 …2}
          +image: null
          +parent: Proxies\__CG__\App\Entity\EntryComment {#1692 …}
          +root: App\Entity\EntryComment {#1709}
          +body: """
            > Not sure I understand this point. Which resistor would you replace with a diode?\n
            \n
            Sorry, I think I was talking nonesense (doing this in my head and just woke up 😅).\n
            \n
            Not sure it’ll work with just a P-FET actually. You’ll likely need to control the PFET with a NFET, otherwise you still end up with too high a voltage on your control pin when the FET is off due to the gate pullup (unless you can use a fet with a very high Vgs Threshold and then drive it push/pull from the micro, but this isn’t really best practice).\n
            \n
            The above comment about diodes was to protect the microcontroller pin, but you end up not being able to control the FET doing it that way.\n
            \n
            I think either your existing Option 3 or PFET upstream of the divider, switched via an N-FET is the way to go.
            """
          +lang: "en"
          +isAdult: false
          +favouriteCount: 2
          +score: 0
          +lastActive: DateTime @1692955881 {#1673
            date: 2023-08-25 11:31:21.0 +02:00
          }
          +ip: null
          +tags: null
          +mentions: [
            "@nilclass@discuss.tchncs.de"
            "@Yonrak@feddit.uk"
          ]
          +children: Doctrine\ORM\PersistentCollection {#1691 …}
          +nested: Doctrine\ORM\PersistentCollection {#1680 …}
          +votes: Doctrine\ORM\PersistentCollection {#1683 …}
          +reports: Doctrine\ORM\PersistentCollection {#1702 …}
          +favourites: Doctrine\ORM\PersistentCollection {#1596 …}
          +notifications: Doctrine\ORM\PersistentCollection {#1613 …}
          -id: 26782
          -bodyTs: "'3':137 'abl':122 'actual':42 'best':103 'comment':107 'control':48,66,124 'diod':14,109 'divid':143 'drive':92 'due':73 'either':133 'end':57,118 'exist':135 'fet':41,70,83,126,149 'gate':76 'go':154 'head':26 'high':61,87 'isn':100 'like':45 'll':34,44 'micro':97 'microcontrol':114 'n':148 'n-fet':147 'need':46 'nfet':53 'nonesens':21 'option':136 'otherwis':54 'p':40 'p-fet':39 'pfet':50,139 'pin':67,115 'point':6 'practic':104 'protect':112 'pullup':77 'push/pull':94 'realli':102 'replac':11 'resistor':8 'sorri':15 'still':56 'sure':2,32 'switch':144 'talk':20 'think':17,132 'threshold':89 'understand':4 'unless':78 'upstream':140 'use':81 'vgs':88 'via':145 'voltag':63 'way':130,152 'woke':29 'work':35 'would':9"
          +ranking: 0
          +commentCount: 0
          +upVotes: 0
          +downVotes: 0
          +visibility: "visible             "
          +apId: "https://feddit.uk/comment/2186641"
          +editedAt: DateTimeImmutable @1692956099 {#1560
            date: 2023-08-25 11:34:59.0 +02:00
          }
          +createdAt: DateTimeImmutable @1692955881 {#1568
            date: 2023-08-25 11:31:21.0 +02:00
          }
          +"title": 26782
        }
      ]
      -id: 1944
      -titleTs: "'batteri':5 'circuit':7 'improv':3 'measur':6"
      -bodyTs: "'/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)':152 '/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)':188 '/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)':53 '1.1':69,77 '10':107 '100µa':127 '10kω':88 '5v':5 '9v':12 'abl':73 'ad':178 'adc':85,95,165 'add':137 'address':173 'analog':99 'anyon':213 'approxim':106 'arduino':7 'atmega':83,91 'atmega328p':9 'bad':156 'batteri':28,130,170 'block':13 'bother':118 'buck':16 'chosen':56 'circuit':123 'clone':8 'constant':125 'convert':17 'curious':211 'current':197 'datasheet':92 'discuss.tchncs.de':52,151,187 'discuss.tchncs.de/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)':150 'discuss.tchncs.de/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)':186 'discuss.tchncs.de/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)':51 'divid':50,142 'draw':126,195 'except':198 'figur':239 'first':42 'full':38 'get':33 'great':113 'haven':237 'howev':201 'idea':35,43,216 'imped':104 'input':166 'intern':79 'issu':175 'kω':108 'less':110 'let':22 'like':230 'm':210,246 'measur':26,66,149,184,200 'microcontrol':6,24 'mosfet':139,161,181,225 'next':133 'obvious':155 'occasion':25 'oh':242 'optim':97 'output':67,103 'part':207 'path':185 'pleas':251 'possibl':234 'power':3 'quit':204 'r1':86 'r2':87 'refer':80 'resistor':58 'say':93 'second':180 'see':167 'seem':227 'signal':100 'simpl':48 'sinc':89 'singl':224 'someth':248 'stupid':249 'switch':144 'tell':252 'thought':134 'use':10,46,75 'v':70,78 'valu':59 've':55,177 'voltag':29,49,63,171 'want':20 'whole':169 'work':190"
      +cross: false
      +upVotes: 0
      +downVotes: 0
      +ranking: 1693029637
      +visibility: "visible             "
      +apId: "https://discuss.tchncs.de/post/2309537"
      +editedAt: DateTimeImmutable @1692947232 {#1693
        date: 2023-08-25 09:07:12.0 +02:00
      }
      +createdAt: DateTimeImmutable @1692947137 {#1740
        date: 2023-08-25 09:05:37.0 +02:00
      }
      +__isInitialized__: true
       …2
    }
    +magazine: Proxies\__CG__\App\Entity\Magazine {#1584 …2}
    +image: null
    +parent: null
    +root: null
    +body: """
      Could you do similar to diagram 2, but instead of an N-FET use a P-FET between the battery and first resistor in the potential divider?\n
      \n
      Add a gate pull up resistor to source to ensure the FET is off by default, have the micro pull the gate down to take a measurement. You’ll probably need to add another resistor on the control pin to 0V to limit the voltage there also, but those two can be much much higher values to really limit current. Or use a zener/TVS diode instead of second resistor to clamp the voltage instead of dividing (more robust).\n
      \n
      Switch it with an NFET\n
      \n
      The micro will see 0V or divided/clamped battery voltage on the measurement pin.
      """
    +lang: "en"
    +isAdult: false
    +favouriteCount: 3
    +score: 0
    +lastActive: DateTime @1692955883 {#1439
      date: 2023-08-25 11:31:23.0 +02:00
    }
    +ip: null
    +tags: null
    +mentions: [
      "@nilclass@discuss.tchncs.de"
    ]
    +children: Doctrine\ORM\PersistentCollection {#1579 …}
    +nested: Doctrine\ORM\PersistentCollection {#1577 …}
    +votes: Doctrine\ORM\PersistentCollection {#1578 …}
    +reports: Doctrine\ORM\PersistentCollection {#1571 …}
    +favourites: Doctrine\ORM\PersistentCollection {#1574 …}
    +notifications: Doctrine\ORM\PersistentCollection {#1667 …}
    -id: 26779
    -bodyTs: "'0v':70,117 '2':7 'add':30,62 'also':76 'anoth':63 'batteri':22,120 'clamp':100 'control':67 'could':1 'current':89 'default':45 'diagram':6 'diod':94 'divid':29,105 'divided/clamped':119 'ensur':39 'fet':14,19,41 'first':24 'gate':32,51 'higher':84 'instead':9,95,103 'limit':72,88 'll':58 'measur':56,124 'micro':48,114 'much':82,83 'n':13 'n-fet':12 'need':60 'nfet':112 'p':18 'p-fet':17 'pin':68,125 'potenti':28 'probabl':59 'pull':33,49 'realli':87 'resistor':25,35,64,98 'robust':107 'second':97 'see':116 'similar':4 'sourc':37 'switch':108 'take':54 'two':79 'use':15,91 'valu':85 'voltag':74,102,121 'zener/tvs':93"
    +ranking: 0
    +commentCount: 0
    +upVotes: 0
    +downVotes: 0
    +visibility: "visible             "
    +apId: "https://feddit.uk/comment/2185380"
    +editedAt: DateTimeImmutable @1692969047 {#1435
      date: 2023-08-25 15:10:47.0 +02:00
    }
    +createdAt: DateTimeImmutable @1692950595 {#1436
      date: 2023-08-25 10:03:15.0 +02:00
    }
    +"title": 26779
  }
  +showMagazineName: false
  +showEntryTitle: false
  +showNested: false
  +level: 1
  +canSeeTrash: false
  +dateAsUrl: true
  -requestStack: Symfony\Component\HttpFoundation\RequestStack {#1328 …}
  -authorizationChecker: Symfony\Component\Security\Core\Authorization\AuthorizationChecker {#931 …}
}
user_inline App\Twig\Components\UserInlineComponent 12.0 MiB 0.17 ms
Input props
[
  "user" => App\Entity\User {#265
    +avatar: null
    +cover: null
    +email: "Yonrak@feddit.uk"
    +username: "@Yonrak@feddit.uk"
    +roles: []
    +followersCount: 0
    +homepage: "front"
    +about: null
    +lastActive: DateTime @1692955883 {#275
      date: 2023-08-25 11:31:23.0 +02:00
    }
    +markedForDeletionAt: null
    +fields: null
    +oauthGithubId: null
    +oauthGoogleId: null
    +oauthFacebookId: null
    +oauthKeycloakId: null
    +hideAdult: true
    +showSubscribedUsers: true
    +showSubscribedMagazines: true
    +showSubscribedDomains: true
    +preferredLanguages: []
    +featuredMagazines: null
    +showProfileSubscriptions: false
    +showProfileFollowings: true
    +markNewComments: false
    +notifyOnNewEntry: false
    +notifyOnNewEntryReply: true
    +notifyOnNewEntryCommentReply: true
    +notifyOnNewPost: false
    +notifyOnNewPostReply: true
    +notifyOnNewPostCommentReply: true
    +addMentionsEntries: false
    +addMentionsPosts: true
    +isBanned: false
    +isVerified: false
    +isDeleted: false
    +isBot: false
    +spamProtection: true
    +customCss: null
    +ignoreMagazinesCustomCss: false
    +moderatorTokens: Doctrine\ORM\PersistentCollection {#253 …}
    +magazineOwnershipRequests: Doctrine\ORM\PersistentCollection {#249 …}
    +moderatorRequests: Doctrine\ORM\PersistentCollection {#238 …}
    +entries: Doctrine\ORM\PersistentCollection {#196 …}
    +entryVotes: Doctrine\ORM\PersistentCollection {#168 …}
    +entryComments: Doctrine\ORM\PersistentCollection {#141 …}
    +entryCommentVotes: Doctrine\ORM\PersistentCollection {#111 …}
    +posts: Doctrine\ORM\PersistentCollection {#84 …}
    +postVotes: Doctrine\ORM\PersistentCollection {#99 …}
    +postComments: Doctrine\ORM\PersistentCollection {#1863 …}
    +postCommentVotes: Doctrine\ORM\PersistentCollection {#1479 …}
    +subscriptions: Doctrine\ORM\PersistentCollection {#1658 …}
    +subscribedDomains: Doctrine\ORM\PersistentCollection {#1868 …}
    +follows: Doctrine\ORM\PersistentCollection {#1917 …}
    +followers: Doctrine\ORM\PersistentCollection {#1601 …}
    +blocks: Doctrine\ORM\PersistentCollection {#1805 …}
    +blockers: Doctrine\ORM\PersistentCollection {#1810 …}
    +blockedMagazines: Doctrine\ORM\PersistentCollection {#1857 …}
    +blockedDomains: Doctrine\ORM\PersistentCollection {#1860 …}
    +reports: Doctrine\ORM\PersistentCollection {#1791 …}
    +favourites: Doctrine\ORM\PersistentCollection {#2416 …}
    +violations: Doctrine\ORM\PersistentCollection {#1824 …}
    +notifications: Doctrine\ORM\PersistentCollection {#1914 …}
    +awards: Doctrine\ORM\PersistentCollection {#1929 …}
    +subscribedCategories: Doctrine\ORM\PersistentCollection {#1867 …}
    +categories: Doctrine\ORM\PersistentCollection {#1880 …}
    -id: 42482
    -password: "$2y$13$NhIMiF1JXctMkB.To0A1l.9Yf5tUWEmnsXRxLOIoPHjfEy4B2UkMe"
    -totpSecret: null
    -totpBackupCodes: []
    -oAuth2UserConsents: Doctrine\ORM\PersistentCollection {#1894 …}
    +apId: "Yonrak@feddit.uk"
    +apProfileId: "https://feddit.uk/u/Yonrak"
    +apPublicUrl: "https://feddit.uk/u/Yonrak"
    +apFollowersUrl: null
    +apInboxUrl: "https://feddit.uk/inbox"
    +apDomain: "feddit.uk"
    +apPreferredUsername: "Yonrak"
    +apDiscoverable: true
    +apManuallyApprovesFollowers: false
    +privateKey: null
    +publicKey: null
    +apFetchedAt: DateTime @1692955883 {#269
      date: 2023-08-25 11:31:23.0 +02:00
    }
    +apDeletedAt: null
    +apTimeoutAt: null
    +visibility: "visible             "
    +createdAt: DateTimeImmutable @1692950596 {#268
      date: 2023-08-25 10:03:16.0 +02:00
    }
  }
  "showAvatar" => false
]
Attributes
[]
Component
App\Twig\Components\UserInlineComponent {#3809
  +user: App\Entity\User {#265
    +avatar: null
    +cover: null
    +email: "Yonrak@feddit.uk"
    +username: "@Yonrak@feddit.uk"
    +roles: []
    +followersCount: 0
    +homepage: "front"
    +about: null
    +lastActive: DateTime @1692955883 {#275
      date: 2023-08-25 11:31:23.0 +02:00
    }
    +markedForDeletionAt: null
    +fields: null
    +oauthGithubId: null
    +oauthGoogleId: null
    +oauthFacebookId: null
    +oauthKeycloakId: null
    +hideAdult: true
    +showSubscribedUsers: true
    +showSubscribedMagazines: true
    +showSubscribedDomains: true
    +preferredLanguages: []
    +featuredMagazines: null
    +showProfileSubscriptions: false
    +showProfileFollowings: true
    +markNewComments: false
    +notifyOnNewEntry: false
    +notifyOnNewEntryReply: true
    +notifyOnNewEntryCommentReply: true
    +notifyOnNewPost: false
    +notifyOnNewPostReply: true
    +notifyOnNewPostCommentReply: true
    +addMentionsEntries: false
    +addMentionsPosts: true
    +isBanned: false
    +isVerified: false
    +isDeleted: false
    +isBot: false
    +spamProtection: true
    +customCss: null
    +ignoreMagazinesCustomCss: false
    +moderatorTokens: Doctrine\ORM\PersistentCollection {#253 …}
    +magazineOwnershipRequests: Doctrine\ORM\PersistentCollection {#249 …}
    +moderatorRequests: Doctrine\ORM\PersistentCollection {#238 …}
    +entries: Doctrine\ORM\PersistentCollection {#196 …}
    +entryVotes: Doctrine\ORM\PersistentCollection {#168 …}
    +entryComments: Doctrine\ORM\PersistentCollection {#141 …}
    +entryCommentVotes: Doctrine\ORM\PersistentCollection {#111 …}
    +posts: Doctrine\ORM\PersistentCollection {#84 …}
    +postVotes: Doctrine\ORM\PersistentCollection {#99 …}
    +postComments: Doctrine\ORM\PersistentCollection {#1863 …}
    +postCommentVotes: Doctrine\ORM\PersistentCollection {#1479 …}
    +subscriptions: Doctrine\ORM\PersistentCollection {#1658 …}
    +subscribedDomains: Doctrine\ORM\PersistentCollection {#1868 …}
    +follows: Doctrine\ORM\PersistentCollection {#1917 …}
    +followers: Doctrine\ORM\PersistentCollection {#1601 …}
    +blocks: Doctrine\ORM\PersistentCollection {#1805 …}
    +blockers: Doctrine\ORM\PersistentCollection {#1810 …}
    +blockedMagazines: Doctrine\ORM\PersistentCollection {#1857 …}
    +blockedDomains: Doctrine\ORM\PersistentCollection {#1860 …}
    +reports: Doctrine\ORM\PersistentCollection {#1791 …}
    +favourites: Doctrine\ORM\PersistentCollection {#2416 …}
    +violations: Doctrine\ORM\PersistentCollection {#1824 …}
    +notifications: Doctrine\ORM\PersistentCollection {#1914 …}
    +awards: Doctrine\ORM\PersistentCollection {#1929 …}
    +subscribedCategories: Doctrine\ORM\PersistentCollection {#1867 …}
    +categories: Doctrine\ORM\PersistentCollection {#1880 …}
    -id: 42482
    -password: "$2y$13$NhIMiF1JXctMkB.To0A1l.9Yf5tUWEmnsXRxLOIoPHjfEy4B2UkMe"
    -totpSecret: null
    -totpBackupCodes: []
    -oAuth2UserConsents: Doctrine\ORM\PersistentCollection {#1894 …}
    +apId: "Yonrak@feddit.uk"
    +apProfileId: "https://feddit.uk/u/Yonrak"
    +apPublicUrl: "https://feddit.uk/u/Yonrak"
    +apFollowersUrl: null
    +apInboxUrl: "https://feddit.uk/inbox"
    +apDomain: "feddit.uk"
    +apPreferredUsername: "Yonrak"
    +apDiscoverable: true
    +apManuallyApprovesFollowers: false
    +privateKey: null
    +publicKey: null
    +apFetchedAt: DateTime @1692955883 {#269
      date: 2023-08-25 11:31:23.0 +02:00
    }
    +apDeletedAt: null
    +apTimeoutAt: null
    +visibility: "visible             "
    +createdAt: DateTimeImmutable @1692950596 {#268
      date: 2023-08-25 10:03:16.0 +02:00
    }
  }
  +showAvatar: false
}
date App\Twig\Components\DateComponent 12.0 MiB 0.23 ms
Input props
[
  "date" => DateTimeImmutable @1692950595 {#1436
    date: 2023-08-25 10:03:15.0 +02:00
  }
]
Attributes
[]
Component
App\Twig\Components\DateComponent {#3867
  +date: DateTimeImmutable @1692950595 {#1436
    date: 2023-08-25 10:03:15.0 +02:00
  }
}
date_edited App\Twig\Components\DateEditedComponent 12.0 MiB 0.21 ms
Input props
[
  "createdAt" => DateTimeImmutable @1692950595 {#1436
    date: 2023-08-25 10:03:15.0 +02:00
  }
  "editedAt" => DateTimeImmutable @1692969047 {#1435
    date: 2023-08-25 15:10:47.0 +02:00
  }
]
Attributes
[]
Component
App\Twig\Components\DateEditedComponent {#3921
  +createdAt: DateTimeImmutable @1692950595 {#1436
    date: 2023-08-25 10:03:15.0 +02:00
  }
  +editedAt: DateTimeImmutable @1692969047 {#1435
    date: 2023-08-25 15:10:47.0 +02:00
  }
}
user_avatar App\Twig\Components\UserAvatarComponent 12.0 MiB 0.33 ms
Input props
[
  "user" => App\Entity\User {#265
    +avatar: null
    +cover: null
    +email: "Yonrak@feddit.uk"
    +username: "@Yonrak@feddit.uk"
    +roles: []
    +followersCount: 0
    +homepage: "front"
    +about: null
    +lastActive: DateTime @1692955883 {#275
      date: 2023-08-25 11:31:23.0 +02:00
    }
    +markedForDeletionAt: null
    +fields: null
    +oauthGithubId: null
    +oauthGoogleId: null
    +oauthFacebookId: null
    +oauthKeycloakId: null
    +hideAdult: true
    +showSubscribedUsers: true
    +showSubscribedMagazines: true
    +showSubscribedDomains: true
    +preferredLanguages: []
    +featuredMagazines: null
    +showProfileSubscriptions: false
    +showProfileFollowings: true
    +markNewComments: false
    +notifyOnNewEntry: false
    +notifyOnNewEntryReply: true
    +notifyOnNewEntryCommentReply: true
    +notifyOnNewPost: false
    +notifyOnNewPostReply: true
    +notifyOnNewPostCommentReply: true
    +addMentionsEntries: false
    +addMentionsPosts: true
    +isBanned: false
    +isVerified: false
    +isDeleted: false
    +isBot: false
    +spamProtection: true
    +customCss: null
    +ignoreMagazinesCustomCss: false
    +moderatorTokens: Doctrine\ORM\PersistentCollection {#253 …}
    +magazineOwnershipRequests: Doctrine\ORM\PersistentCollection {#249 …}
    +moderatorRequests: Doctrine\ORM\PersistentCollection {#238 …}
    +entries: Doctrine\ORM\PersistentCollection {#196 …}
    +entryVotes: Doctrine\ORM\PersistentCollection {#168 …}
    +entryComments: Doctrine\ORM\PersistentCollection {#141 …}
    +entryCommentVotes: Doctrine\ORM\PersistentCollection {#111 …}
    +posts: Doctrine\ORM\PersistentCollection {#84 …}
    +postVotes: Doctrine\ORM\PersistentCollection {#99 …}
    +postComments: Doctrine\ORM\PersistentCollection {#1863 …}
    +postCommentVotes: Doctrine\ORM\PersistentCollection {#1479 …}
    +subscriptions: Doctrine\ORM\PersistentCollection {#1658 …}
    +subscribedDomains: Doctrine\ORM\PersistentCollection {#1868 …}
    +follows: Doctrine\ORM\PersistentCollection {#1917 …}
    +followers: Doctrine\ORM\PersistentCollection {#1601 …}
    +blocks: Doctrine\ORM\PersistentCollection {#1805 …}
    +blockers: Doctrine\ORM\PersistentCollection {#1810 …}
    +blockedMagazines: Doctrine\ORM\PersistentCollection {#1857 …}
    +blockedDomains: Doctrine\ORM\PersistentCollection {#1860 …}
    +reports: Doctrine\ORM\PersistentCollection {#1791 …}
    +favourites: Doctrine\ORM\PersistentCollection {#2416 …}
    +violations: Doctrine\ORM\PersistentCollection {#1824 …}
    +notifications: Doctrine\ORM\PersistentCollection {#1914 …}
    +awards: Doctrine\ORM\PersistentCollection {#1929 …}
    +subscribedCategories: Doctrine\ORM\PersistentCollection {#1867 …}
    +categories: Doctrine\ORM\PersistentCollection {#1880 …}
    -id: 42482
    -password: "$2y$13$NhIMiF1JXctMkB.To0A1l.9Yf5tUWEmnsXRxLOIoPHjfEy4B2UkMe"
    -totpSecret: null
    -totpBackupCodes: []
    -oAuth2UserConsents: Doctrine\ORM\PersistentCollection {#1894 …}
    +apId: "Yonrak@feddit.uk"
    +apProfileId: "https://feddit.uk/u/Yonrak"
    +apPublicUrl: "https://feddit.uk/u/Yonrak"
    +apFollowersUrl: null
    +apInboxUrl: "https://feddit.uk/inbox"
    +apDomain: "feddit.uk"
    +apPreferredUsername: "Yonrak"
    +apDiscoverable: true
    +apManuallyApprovesFollowers: false
    +privateKey: null
    +publicKey: null
    +apFetchedAt: DateTime @1692955883 {#269
      date: 2023-08-25 11:31:23.0 +02:00
    }
    +apDeletedAt: null
    +apTimeoutAt: null
    +visibility: "visible             "
    +createdAt: DateTimeImmutable @1692950596 {#268
      date: 2023-08-25 10:03:16.0 +02:00
    }
  }
  "width" => 40
  "height" => 40
  "asLink" => true
]
Attributes
[]
Component
App\Twig\Components\UserAvatarComponent {#3977
  +width: 40
  +height: 40
  +user: App\Entity\User {#265
    +avatar: null
    +cover: null
    +email: "Yonrak@feddit.uk"
    +username: "@Yonrak@feddit.uk"
    +roles: []
    +followersCount: 0
    +homepage: "front"
    +about: null
    +lastActive: DateTime @1692955883 {#275
      date: 2023-08-25 11:31:23.0 +02:00
    }
    +markedForDeletionAt: null
    +fields: null
    +oauthGithubId: null
    +oauthGoogleId: null
    +oauthFacebookId: null
    +oauthKeycloakId: null
    +hideAdult: true
    +showSubscribedUsers: true
    +showSubscribedMagazines: true
    +showSubscribedDomains: true
    +preferredLanguages: []
    +featuredMagazines: null
    +showProfileSubscriptions: false
    +showProfileFollowings: true
    +markNewComments: false
    +notifyOnNewEntry: false
    +notifyOnNewEntryReply: true
    +notifyOnNewEntryCommentReply: true
    +notifyOnNewPost: false
    +notifyOnNewPostReply: true
    +notifyOnNewPostCommentReply: true
    +addMentionsEntries: false
    +addMentionsPosts: true
    +isBanned: false
    +isVerified: false
    +isDeleted: false
    +isBot: false
    +spamProtection: true
    +customCss: null
    +ignoreMagazinesCustomCss: false
    +moderatorTokens: Doctrine\ORM\PersistentCollection {#253 …}
    +magazineOwnershipRequests: Doctrine\ORM\PersistentCollection {#249 …}
    +moderatorRequests: Doctrine\ORM\PersistentCollection {#238 …}
    +entries: Doctrine\ORM\PersistentCollection {#196 …}
    +entryVotes: Doctrine\ORM\PersistentCollection {#168 …}
    +entryComments: Doctrine\ORM\PersistentCollection {#141 …}
    +entryCommentVotes: Doctrine\ORM\PersistentCollection {#111 …}
    +posts: Doctrine\ORM\PersistentCollection {#84 …}
    +postVotes: Doctrine\ORM\PersistentCollection {#99 …}
    +postComments: Doctrine\ORM\PersistentCollection {#1863 …}
    +postCommentVotes: Doctrine\ORM\PersistentCollection {#1479 …}
    +subscriptions: Doctrine\ORM\PersistentCollection {#1658 …}
    +subscribedDomains: Doctrine\ORM\PersistentCollection {#1868 …}
    +follows: Doctrine\ORM\PersistentCollection {#1917 …}
    +followers: Doctrine\ORM\PersistentCollection {#1601 …}
    +blocks: Doctrine\ORM\PersistentCollection {#1805 …}
    +blockers: Doctrine\ORM\PersistentCollection {#1810 …}
    +blockedMagazines: Doctrine\ORM\PersistentCollection {#1857 …}
    +blockedDomains: Doctrine\ORM\PersistentCollection {#1860 …}
    +reports: Doctrine\ORM\PersistentCollection {#1791 …}
    +favourites: Doctrine\ORM\PersistentCollection {#2416 …}
    +violations: Doctrine\ORM\PersistentCollection {#1824 …}
    +notifications: Doctrine\ORM\PersistentCollection {#1914 …}
    +awards: Doctrine\ORM\PersistentCollection {#1929 …}
    +subscribedCategories: Doctrine\ORM\PersistentCollection {#1867 …}
    +categories: Doctrine\ORM\PersistentCollection {#1880 …}
    -id: 42482
    -password: "$2y$13$NhIMiF1JXctMkB.To0A1l.9Yf5tUWEmnsXRxLOIoPHjfEy4B2UkMe"
    -totpSecret: null
    -totpBackupCodes: []
    -oAuth2UserConsents: Doctrine\ORM\PersistentCollection {#1894 …}
    +apId: "Yonrak@feddit.uk"
    +apProfileId: "https://feddit.uk/u/Yonrak"
    +apPublicUrl: "https://feddit.uk/u/Yonrak"
    +apFollowersUrl: null
    +apInboxUrl: "https://feddit.uk/inbox"
    +apDomain: "feddit.uk"
    +apPreferredUsername: "Yonrak"
    +apDiscoverable: true
    +apManuallyApprovesFollowers: false
    +privateKey: null
    +publicKey: null
    +apFetchedAt: DateTime @1692955883 {#269
      date: 2023-08-25 11:31:23.0 +02:00
    }
    +apDeletedAt: null
    +apTimeoutAt: null
    +visibility: "visible             "
    +createdAt: DateTimeImmutable @1692950596 {#268
      date: 2023-08-25 10:03:16.0 +02:00
    }
  }
  +asLink: true
}
vote App\Twig\Components\VoteComponent 12.0 MiB 0.59 ms
Input props
[
  "subject" => App\Entity\EntryComment {#1709
    +user: App\Entity\User {#265
      +avatar: null
      +cover: null
      +email: "Yonrak@feddit.uk"
      +username: "@Yonrak@feddit.uk"
      +roles: []
      +followersCount: 0
      +homepage: "front"
      +about: null
      +lastActive: DateTime @1692955883 {#275
        date: 2023-08-25 11:31:23.0 +02:00
      }
      +markedForDeletionAt: null
      +fields: null
      +oauthGithubId: null
      +oauthGoogleId: null
      +oauthFacebookId: null
      +oauthKeycloakId: null
      +hideAdult: true
      +showSubscribedUsers: true
      +showSubscribedMagazines: true
      +showSubscribedDomains: true
      +preferredLanguages: []
      +featuredMagazines: null
      +showProfileSubscriptions: false
      +showProfileFollowings: true
      +markNewComments: false
      +notifyOnNewEntry: false
      +notifyOnNewEntryReply: true
      +notifyOnNewEntryCommentReply: true
      +notifyOnNewPost: false
      +notifyOnNewPostReply: true
      +notifyOnNewPostCommentReply: true
      +addMentionsEntries: false
      +addMentionsPosts: true
      +isBanned: false
      +isVerified: false
      +isDeleted: false
      +isBot: false
      +spamProtection: true
      +customCss: null
      +ignoreMagazinesCustomCss: false
      +moderatorTokens: Doctrine\ORM\PersistentCollection {#253 …}
      +magazineOwnershipRequests: Doctrine\ORM\PersistentCollection {#249 …}
      +moderatorRequests: Doctrine\ORM\PersistentCollection {#238 …}
      +entries: Doctrine\ORM\PersistentCollection {#196 …}
      +entryVotes: Doctrine\ORM\PersistentCollection {#168 …}
      +entryComments: Doctrine\ORM\PersistentCollection {#141 …}
      +entryCommentVotes: Doctrine\ORM\PersistentCollection {#111 …}
      +posts: Doctrine\ORM\PersistentCollection {#84 …}
      +postVotes: Doctrine\ORM\PersistentCollection {#99 …}
      +postComments: Doctrine\ORM\PersistentCollection {#1863 …}
      +postCommentVotes: Doctrine\ORM\PersistentCollection {#1479 …}
      +subscriptions: Doctrine\ORM\PersistentCollection {#1658 …}
      +subscribedDomains: Doctrine\ORM\PersistentCollection {#1868 …}
      +follows: Doctrine\ORM\PersistentCollection {#1917 …}
      +followers: Doctrine\ORM\PersistentCollection {#1601 …}
      +blocks: Doctrine\ORM\PersistentCollection {#1805 …}
      +blockers: Doctrine\ORM\PersistentCollection {#1810 …}
      +blockedMagazines: Doctrine\ORM\PersistentCollection {#1857 …}
      +blockedDomains: Doctrine\ORM\PersistentCollection {#1860 …}
      +reports: Doctrine\ORM\PersistentCollection {#1791 …}
      +favourites: Doctrine\ORM\PersistentCollection {#2416 …}
      +violations: Doctrine\ORM\PersistentCollection {#1824 …}
      +notifications: Doctrine\ORM\PersistentCollection {#1914 …}
      +awards: Doctrine\ORM\PersistentCollection {#1929 …}
      +subscribedCategories: Doctrine\ORM\PersistentCollection {#1867 …}
      +categories: Doctrine\ORM\PersistentCollection {#1880 …}
      -id: 42482
      -password: "$2y$13$NhIMiF1JXctMkB.To0A1l.9Yf5tUWEmnsXRxLOIoPHjfEy4B2UkMe"
      -totpSecret: null
      -totpBackupCodes: []
      -oAuth2UserConsents: Doctrine\ORM\PersistentCollection {#1894 …}
      +apId: "Yonrak@feddit.uk"
      +apProfileId: "https://feddit.uk/u/Yonrak"
      +apPublicUrl: "https://feddit.uk/u/Yonrak"
      +apFollowersUrl: null
      +apInboxUrl: "https://feddit.uk/inbox"
      +apDomain: "feddit.uk"
      +apPreferredUsername: "Yonrak"
      +apDiscoverable: true
      +apManuallyApprovesFollowers: false
      +privateKey: null
      +publicKey: null
      +apFetchedAt: DateTime @1692955883 {#269
        date: 2023-08-25 11:31:23.0 +02:00
      }
      +apDeletedAt: null
      +apTimeoutAt: null
      +visibility: "visible             "
      +createdAt: DateTimeImmutable @1692950596 {#268
        date: 2023-08-25 10:03:16.0 +02:00
      }
    }
    +entry: Proxies\__CG__\App\Entity\Entry {#1591
      +user: Proxies\__CG__\App\Entity\User {#2459
        +avatar: null
        +cover: null
        +email: "nilclass@discuss.tchncs.de"
        +username: "@nilclass@discuss.tchncs.de"
        +roles: []
        +followersCount: 0
        +homepage: "front"
        +about: null
        +lastActive: DateTime @1721268563 {#3096
          date: 2024-07-18 04:09:23.0 +02:00
        }
        +markedForDeletionAt: null
        +fields: null
        +oauthGithubId: null
        +oauthGoogleId: null
        +oauthFacebookId: null
        +oauthKeycloakId: null
        +hideAdult: true
        +showSubscribedUsers: true
        +showSubscribedMagazines: true
        +showSubscribedDomains: true
        +preferredLanguages: []
        +featuredMagazines: null
        +showProfileSubscriptions: true
        +showProfileFollowings: true
        +markNewComments: false
        +notifyOnNewEntry: false
        +notifyOnNewEntryReply: false
        +notifyOnNewEntryCommentReply: false
        +notifyOnNewPost: false
        +notifyOnNewPostReply: false
        +notifyOnNewPostCommentReply: false
        +addMentionsEntries: false
        +addMentionsPosts: true
        +isBanned: false
        +isVerified: false
        +isDeleted: false
        +isBot: false
        +spamProtection: true
        +customCss: null
        +ignoreMagazinesCustomCss: false
        +moderatorTokens: Doctrine\ORM\PersistentCollection {#3099 …}
        +magazineOwnershipRequests: Doctrine\ORM\PersistentCollection {#3101 …}
        +moderatorRequests: Doctrine\ORM\PersistentCollection {#3103 …}
        +entries: Doctrine\ORM\PersistentCollection {#3105 …}
        +entryVotes: Doctrine\ORM\PersistentCollection {#3107 …}
        +entryComments: Doctrine\ORM\PersistentCollection {#3109 …}
        +entryCommentVotes: Doctrine\ORM\PersistentCollection {#3111 …}
        +posts: Doctrine\ORM\PersistentCollection {#3113 …}
        +postVotes: Doctrine\ORM\PersistentCollection {#3115 …}
        +postComments: Doctrine\ORM\PersistentCollection {#3117 …}
        +postCommentVotes: Doctrine\ORM\PersistentCollection {#3119 …}
        +subscriptions: Doctrine\ORM\PersistentCollection {#3121 …}
        +subscribedDomains: Doctrine\ORM\PersistentCollection {#3123 …}
        +follows: Doctrine\ORM\PersistentCollection {#3125 …}
        +followers: Doctrine\ORM\PersistentCollection {#3127 …}
        +blocks: Doctrine\ORM\PersistentCollection {#3129 …}
        +blockers: Doctrine\ORM\PersistentCollection {#3131 …}
        +blockedMagazines: Doctrine\ORM\PersistentCollection {#3133 …}
        +blockedDomains: Doctrine\ORM\PersistentCollection {#3135 …}
        +reports: Doctrine\ORM\PersistentCollection {#3137 …}
        +favourites: Doctrine\ORM\PersistentCollection {#3139 …}
        +violations: Doctrine\ORM\PersistentCollection {#3141 …}
        +notifications: Doctrine\ORM\PersistentCollection {#3143 …}
        +awards: Doctrine\ORM\PersistentCollection {#3145 …}
        +subscribedCategories: Doctrine\ORM\PersistentCollection {#3147 …}
        +categories: Doctrine\ORM\PersistentCollection {#3149 …}
        -id: 6046
        -password: "$2y$13$FEroXtR95mjA6.omogLZRe7NJuWUL6hb.9a/FfXkqyIPnPgg4Apme"
        -totpSecret: null
        -totpBackupCodes: []
        -oAuth2UserConsents: Doctrine\ORM\PersistentCollection {#3151 …}
        +apId: "nilclass@discuss.tchncs.de"
        +apProfileId: "https://discuss.tchncs.de/u/nilclass"
        +apPublicUrl: "https://discuss.tchncs.de/u/nilclass"
        +apFollowersUrl: null
        +apInboxUrl: "https://discuss.tchncs.de/inbox"
        +apDomain: "discuss.tchncs.de"
        +apPreferredUsername: "nilclass"
        +apDiscoverable: true
        +apManuallyApprovesFollowers: false
        +privateKey: null
        +publicKey: null
        +apFetchedAt: DateTime @1720630912 {#3097
          date: 2024-07-10 19:01:52.0 +02:00
        }
        +apDeletedAt: null
        +apTimeoutAt: null
        +visibility: "visible             "
        +createdAt: DateTimeImmutable @1687291240 {#3098
          date: 2023-06-20 22:00:40.0 +02:00
        }
        +__isInitialized__: true
         …2
      }
      +magazine: Proxies\__CG__\App\Entity\Magazine {#1584
        +icon: Proxies\__CG__\App\Entity\Image {#2886 …}
        +name: "askelectronics@discuss.tchncs.de"
        +title: "askelectronics"
        +description: """
          **For questions about component-level electronic circuits, tools and equipment.**\n
          \n
          Rules\n
          -----\n
          \n
          1: Be nice.\n
          \n
          2: Be on-topic (eg: *Electronic*, not *electrical*).\n
          \n
          3: No commercial stuff, buying, selling or valuations.\n
          \n
          4: Be safe.\n
          \n
          ---
          """
        +rules: null
        +subscriptionsCount: 1
        +entryCount: 154
        +entryCommentCount: 1230
        +postCount: 1
        +postCommentCount: 4
        +isAdult: false
        +customCss: null
        +lastActive: DateTime @1729413608 {#2865
          date: 2024-10-20 10:40:08.0 +02:00
        }
        +markedForDeletionAt: null
        +tags: null
        +moderators: Doctrine\ORM\PersistentCollection {#2885 …}
        +ownershipRequests: Doctrine\ORM\PersistentCollection {#2883 …}
        +moderatorRequests: Doctrine\ORM\PersistentCollection {#2888 …}
        +entries: Doctrine\ORM\PersistentCollection {#2889 …}
        +posts: Doctrine\ORM\PersistentCollection {#2892 …}
        +subscriptions: Doctrine\ORM\PersistentCollection {#2894 …}
        +bans: Doctrine\ORM\PersistentCollection {#2900 …}
        +reports: Doctrine\ORM\PersistentCollection {#2908 …}
        +badges: Doctrine\ORM\PersistentCollection {#2921 …}
        +logs: Doctrine\ORM\PersistentCollection {#2931 …}
        +awards: Doctrine\ORM\PersistentCollection {#2913 …}
        +categories: Doctrine\ORM\PersistentCollection {#2937 …}
        -id: 11
        +apId: "askelectronics@discuss.tchncs.de"
        +apProfileId: "https://discuss.tchncs.de/c/askelectronics"
        +apPublicUrl: "https://discuss.tchncs.de/c/askelectronics"
        +apFollowersUrl: "https://discuss.tchncs.de/c/askelectronics/followers"
        +apInboxUrl: "https://discuss.tchncs.de/inbox"
        +apDomain: "discuss.tchncs.de"
        +apPreferredUsername: "askelectronics"
        +apDiscoverable: true
        +apManuallyApprovesFollowers: null
        +privateKey: null
        +publicKey: null
        +apFetchedAt: DateTime @1727247714 {#2866
          date: 2024-09-25 09:01:54.0 +02:00
        }
        +apDeletedAt: null
        +apTimeoutAt: null
        +visibility: "visible             "
        +createdAt: DateTimeImmutable @1687144409 {#2867
          date: 2023-06-19 05:13:29.0 +02:00
        }
        +__isInitialized__: true
         …2
      }
      +image: null
      +domain: Proxies\__CG__\App\Entity\Domain {#1630 …}
      +slug: "How-to-improve-my-battery-measurement-circuit"
      +title: "How to improve my battery measurement circuit?"
      +url: null
      +body: """
        I am powering a 5V microcontroller (arduino clone, atmega328p) using a 9V block and a buck converter. Now I want to let the microcontroller occasionally measure the battery voltage, so I can get an idea of how full it is.\n
        \n
        My first idea was to use a simple voltage divider:\n
        \n
        ![](https://discuss.tchncs.de/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)\n
        \n
        I’ve chosen the resistor values so that:\n
        \n
        - the voltage at the measure output is `< 1.1V`, to be able to use the 1.1V internal reference of the atmega’s ADC\n
        - `R1 || R2 < 10kΩ`, since the atmega datasheet says “The ADC is optimized for analog signals with an output impedance of approximately 10 kΩ or less”\n
        \n
        This is great and all, but what bothers me is that this circuit will constantly draw ~100µA from the battery.\n
        \n
        So, my next thought was to add a mosfet to the divider, to switch it on only while measuring:\n
        \n
        ![](https://discuss.tchncs.de/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)\n
        \n
        This is obviously bad, because now when the mosfet is off, the ADC input sees the whole battery voltage.\n
        \n
        To address that issue, I’ve added a second mosfet into the measure path:\n
        \n
        ![](https://discuss.tchncs.de/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)\n
        \n
        This works, and it does not draw any current, except while measuring.\n
        \n
        However, it’s quite a few parts. So I’m curious if anyone has an idea how to do this with just a single mosfet. It seems to me like it should be possible, but I haven’t figured out how.\n
        \n
        Oh, and if I’m doing something stupid here, please tell me :)
        """
      +type: "article"
      +lang: "en"
      +isOc: false
      +hasEmbed: false
      +commentCount: 11
      +favouriteCount: 17
      +score: 0
      +isAdult: false
      +sticky: false
      +lastActive: DateTime @1694781042 {#1715
        date: 2023-09-15 14:30:42.0 +02:00
      }
      +ip: null
      +adaAmount: 0
      +tags: null
      +mentions: null
      +comments: Doctrine\ORM\PersistentCollection {#1629 …}
      +votes: Doctrine\ORM\PersistentCollection {#1626 …}
      +reports: Doctrine\ORM\PersistentCollection {#1625 …}
      +favourites: Doctrine\ORM\PersistentCollection {#2370 …}
      +notifications: Doctrine\ORM\PersistentCollection {#2371 …}
      +badges: Doctrine\ORM\PersistentCollection {#1708 …}
      +children: [
        1 => App\Entity\EntryComment {#1709}
        0 => App\Entity\EntryComment {#1549
          +user: App\Entity\User {#265}
          +entry: Proxies\__CG__\App\Entity\Entry {#1591 …2}
          +magazine: Proxies\__CG__\App\Entity\Magazine {#1584 …2}
          +image: null
          +parent: Proxies\__CG__\App\Entity\EntryComment {#1692 …}
          +root: App\Entity\EntryComment {#1709}
          +body: """
            > Not sure I understand this point. Which resistor would you replace with a diode?\n
            \n
            Sorry, I think I was talking nonesense (doing this in my head and just woke up 😅).\n
            \n
            Not sure it’ll work with just a P-FET actually. You’ll likely need to control the PFET with a NFET, otherwise you still end up with too high a voltage on your control pin when the FET is off due to the gate pullup (unless you can use a fet with a very high Vgs Threshold and then drive it push/pull from the micro, but this isn’t really best practice).\n
            \n
            The above comment about diodes was to protect the microcontroller pin, but you end up not being able to control the FET doing it that way.\n
            \n
            I think either your existing Option 3 or PFET upstream of the divider, switched via an N-FET is the way to go.
            """
          +lang: "en"
          +isAdult: false
          +favouriteCount: 2
          +score: 0
          +lastActive: DateTime @1692955881 {#1673
            date: 2023-08-25 11:31:21.0 +02:00
          }
          +ip: null
          +tags: null
          +mentions: [
            "@nilclass@discuss.tchncs.de"
            "@Yonrak@feddit.uk"
          ]
          +children: Doctrine\ORM\PersistentCollection {#1691 …}
          +nested: Doctrine\ORM\PersistentCollection {#1680 …}
          +votes: Doctrine\ORM\PersistentCollection {#1683 …}
          +reports: Doctrine\ORM\PersistentCollection {#1702 …}
          +favourites: Doctrine\ORM\PersistentCollection {#1596 …}
          +notifications: Doctrine\ORM\PersistentCollection {#1613 …}
          -id: 26782
          -bodyTs: "'3':137 'abl':122 'actual':42 'best':103 'comment':107 'control':48,66,124 'diod':14,109 'divid':143 'drive':92 'due':73 'either':133 'end':57,118 'exist':135 'fet':41,70,83,126,149 'gate':76 'go':154 'head':26 'high':61,87 'isn':100 'like':45 'll':34,44 'micro':97 'microcontrol':114 'n':148 'n-fet':147 'need':46 'nfet':53 'nonesens':21 'option':136 'otherwis':54 'p':40 'p-fet':39 'pfet':50,139 'pin':67,115 'point':6 'practic':104 'protect':112 'pullup':77 'push/pull':94 'realli':102 'replac':11 'resistor':8 'sorri':15 'still':56 'sure':2,32 'switch':144 'talk':20 'think':17,132 'threshold':89 'understand':4 'unless':78 'upstream':140 'use':81 'vgs':88 'via':145 'voltag':63 'way':130,152 'woke':29 'work':35 'would':9"
          +ranking: 0
          +commentCount: 0
          +upVotes: 0
          +downVotes: 0
          +visibility: "visible             "
          +apId: "https://feddit.uk/comment/2186641"
          +editedAt: DateTimeImmutable @1692956099 {#1560
            date: 2023-08-25 11:34:59.0 +02:00
          }
          +createdAt: DateTimeImmutable @1692955881 {#1568
            date: 2023-08-25 11:31:21.0 +02:00
          }
          +"title": 26782
        }
      ]
      -id: 1944
      -titleTs: "'batteri':5 'circuit':7 'improv':3 'measur':6"
      -bodyTs: "'/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)':152 '/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)':188 '/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)':53 '1.1':69,77 '10':107 '100µa':127 '10kω':88 '5v':5 '9v':12 'abl':73 'ad':178 'adc':85,95,165 'add':137 'address':173 'analog':99 'anyon':213 'approxim':106 'arduino':7 'atmega':83,91 'atmega328p':9 'bad':156 'batteri':28,130,170 'block':13 'bother':118 'buck':16 'chosen':56 'circuit':123 'clone':8 'constant':125 'convert':17 'curious':211 'current':197 'datasheet':92 'discuss.tchncs.de':52,151,187 'discuss.tchncs.de/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)':150 'discuss.tchncs.de/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)':186 'discuss.tchncs.de/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)':51 'divid':50,142 'draw':126,195 'except':198 'figur':239 'first':42 'full':38 'get':33 'great':113 'haven':237 'howev':201 'idea':35,43,216 'imped':104 'input':166 'intern':79 'issu':175 'kω':108 'less':110 'let':22 'like':230 'm':210,246 'measur':26,66,149,184,200 'microcontrol':6,24 'mosfet':139,161,181,225 'next':133 'obvious':155 'occasion':25 'oh':242 'optim':97 'output':67,103 'part':207 'path':185 'pleas':251 'possibl':234 'power':3 'quit':204 'r1':86 'r2':87 'refer':80 'resistor':58 'say':93 'second':180 'see':167 'seem':227 'signal':100 'simpl':48 'sinc':89 'singl':224 'someth':248 'stupid':249 'switch':144 'tell':252 'thought':134 'use':10,46,75 'v':70,78 'valu':59 've':55,177 'voltag':29,49,63,171 'want':20 'whole':169 'work':190"
      +cross: false
      +upVotes: 0
      +downVotes: 0
      +ranking: 1693029637
      +visibility: "visible             "
      +apId: "https://discuss.tchncs.de/post/2309537"
      +editedAt: DateTimeImmutable @1692947232 {#1693
        date: 2023-08-25 09:07:12.0 +02:00
      }
      +createdAt: DateTimeImmutable @1692947137 {#1740
        date: 2023-08-25 09:05:37.0 +02:00
      }
      +__isInitialized__: true
       …2
    }
    +magazine: Proxies\__CG__\App\Entity\Magazine {#1584 …2}
    +image: null
    +parent: null
    +root: null
    +body: """
      Could you do similar to diagram 2, but instead of an N-FET use a P-FET between the battery and first resistor in the potential divider?\n
      \n
      Add a gate pull up resistor to source to ensure the FET is off by default, have the micro pull the gate down to take a measurement. You’ll probably need to add another resistor on the control pin to 0V to limit the voltage there also, but those two can be much much higher values to really limit current. Or use a zener/TVS diode instead of second resistor to clamp the voltage instead of dividing (more robust).\n
      \n
      Switch it with an NFET\n
      \n
      The micro will see 0V or divided/clamped battery voltage on the measurement pin.
      """
    +lang: "en"
    +isAdult: false
    +favouriteCount: 3
    +score: 0
    +lastActive: DateTime @1692955883 {#1439
      date: 2023-08-25 11:31:23.0 +02:00
    }
    +ip: null
    +tags: null
    +mentions: [
      "@nilclass@discuss.tchncs.de"
    ]
    +children: Doctrine\ORM\PersistentCollection {#1579 …}
    +nested: Doctrine\ORM\PersistentCollection {#1577 …}
    +votes: Doctrine\ORM\PersistentCollection {#1578 …}
    +reports: Doctrine\ORM\PersistentCollection {#1571 …}
    +favourites: Doctrine\ORM\PersistentCollection {#1574 …}
    +notifications: Doctrine\ORM\PersistentCollection {#1667 …}
    -id: 26779
    -bodyTs: "'0v':70,117 '2':7 'add':30,62 'also':76 'anoth':63 'batteri':22,120 'clamp':100 'control':67 'could':1 'current':89 'default':45 'diagram':6 'diod':94 'divid':29,105 'divided/clamped':119 'ensur':39 'fet':14,19,41 'first':24 'gate':32,51 'higher':84 'instead':9,95,103 'limit':72,88 'll':58 'measur':56,124 'micro':48,114 'much':82,83 'n':13 'n-fet':12 'need':60 'nfet':112 'p':18 'p-fet':17 'pin':68,125 'potenti':28 'probabl':59 'pull':33,49 'realli':87 'resistor':25,35,64,98 'robust':107 'second':97 'see':116 'similar':4 'sourc':37 'switch':108 'take':54 'two':79 'use':15,91 'valu':85 'voltag':74,102,121 'zener/tvs':93"
    +ranking: 0
    +commentCount: 0
    +upVotes: 0
    +downVotes: 0
    +visibility: "visible             "
    +apId: "https://feddit.uk/comment/2185380"
    +editedAt: DateTimeImmutable @1692969047 {#1435
      date: 2023-08-25 15:10:47.0 +02:00
    }
    +createdAt: DateTimeImmutable @1692950595 {#1436
      date: 2023-08-25 10:03:15.0 +02:00
    }
    +"title": 26779
  }
]
Attributes
[]
Component
App\Twig\Components\VoteComponent {#4072
  +subject: App\Entity\EntryComment {#1709
    +user: App\Entity\User {#265
      +avatar: null
      +cover: null
      +email: "Yonrak@feddit.uk"
      +username: "@Yonrak@feddit.uk"
      +roles: []
      +followersCount: 0
      +homepage: "front"
      +about: null
      +lastActive: DateTime @1692955883 {#275
        date: 2023-08-25 11:31:23.0 +02:00
      }
      +markedForDeletionAt: null
      +fields: null
      +oauthGithubId: null
      +oauthGoogleId: null
      +oauthFacebookId: null
      +oauthKeycloakId: null
      +hideAdult: true
      +showSubscribedUsers: true
      +showSubscribedMagazines: true
      +showSubscribedDomains: true
      +preferredLanguages: []
      +featuredMagazines: null
      +showProfileSubscriptions: false
      +showProfileFollowings: true
      +markNewComments: false
      +notifyOnNewEntry: false
      +notifyOnNewEntryReply: true
      +notifyOnNewEntryCommentReply: true
      +notifyOnNewPost: false
      +notifyOnNewPostReply: true
      +notifyOnNewPostCommentReply: true
      +addMentionsEntries: false
      +addMentionsPosts: true
      +isBanned: false
      +isVerified: false
      +isDeleted: false
      +isBot: false
      +spamProtection: true
      +customCss: null
      +ignoreMagazinesCustomCss: false
      +moderatorTokens: Doctrine\ORM\PersistentCollection {#253 …}
      +magazineOwnershipRequests: Doctrine\ORM\PersistentCollection {#249 …}
      +moderatorRequests: Doctrine\ORM\PersistentCollection {#238 …}
      +entries: Doctrine\ORM\PersistentCollection {#196 …}
      +entryVotes: Doctrine\ORM\PersistentCollection {#168 …}
      +entryComments: Doctrine\ORM\PersistentCollection {#141 …}
      +entryCommentVotes: Doctrine\ORM\PersistentCollection {#111 …}
      +posts: Doctrine\ORM\PersistentCollection {#84 …}
      +postVotes: Doctrine\ORM\PersistentCollection {#99 …}
      +postComments: Doctrine\ORM\PersistentCollection {#1863 …}
      +postCommentVotes: Doctrine\ORM\PersistentCollection {#1479 …}
      +subscriptions: Doctrine\ORM\PersistentCollection {#1658 …}
      +subscribedDomains: Doctrine\ORM\PersistentCollection {#1868 …}
      +follows: Doctrine\ORM\PersistentCollection {#1917 …}
      +followers: Doctrine\ORM\PersistentCollection {#1601 …}
      +blocks: Doctrine\ORM\PersistentCollection {#1805 …}
      +blockers: Doctrine\ORM\PersistentCollection {#1810 …}
      +blockedMagazines: Doctrine\ORM\PersistentCollection {#1857 …}
      +blockedDomains: Doctrine\ORM\PersistentCollection {#1860 …}
      +reports: Doctrine\ORM\PersistentCollection {#1791 …}
      +favourites: Doctrine\ORM\PersistentCollection {#2416 …}
      +violations: Doctrine\ORM\PersistentCollection {#1824 …}
      +notifications: Doctrine\ORM\PersistentCollection {#1914 …}
      +awards: Doctrine\ORM\PersistentCollection {#1929 …}
      +subscribedCategories: Doctrine\ORM\PersistentCollection {#1867 …}
      +categories: Doctrine\ORM\PersistentCollection {#1880 …}
      -id: 42482
      -password: "$2y$13$NhIMiF1JXctMkB.To0A1l.9Yf5tUWEmnsXRxLOIoPHjfEy4B2UkMe"
      -totpSecret: null
      -totpBackupCodes: []
      -oAuth2UserConsents: Doctrine\ORM\PersistentCollection {#1894 …}
      +apId: "Yonrak@feddit.uk"
      +apProfileId: "https://feddit.uk/u/Yonrak"
      +apPublicUrl: "https://feddit.uk/u/Yonrak"
      +apFollowersUrl: null
      +apInboxUrl: "https://feddit.uk/inbox"
      +apDomain: "feddit.uk"
      +apPreferredUsername: "Yonrak"
      +apDiscoverable: true
      +apManuallyApprovesFollowers: false
      +privateKey: null
      +publicKey: null
      +apFetchedAt: DateTime @1692955883 {#269
        date: 2023-08-25 11:31:23.0 +02:00
      }
      +apDeletedAt: null
      +apTimeoutAt: null
      +visibility: "visible             "
      +createdAt: DateTimeImmutable @1692950596 {#268
        date: 2023-08-25 10:03:16.0 +02:00
      }
    }
    +entry: Proxies\__CG__\App\Entity\Entry {#1591
      +user: Proxies\__CG__\App\Entity\User {#2459
        +avatar: null
        +cover: null
        +email: "nilclass@discuss.tchncs.de"
        +username: "@nilclass@discuss.tchncs.de"
        +roles: []
        +followersCount: 0
        +homepage: "front"
        +about: null
        +lastActive: DateTime @1721268563 {#3096
          date: 2024-07-18 04:09:23.0 +02:00
        }
        +markedForDeletionAt: null
        +fields: null
        +oauthGithubId: null
        +oauthGoogleId: null
        +oauthFacebookId: null
        +oauthKeycloakId: null
        +hideAdult: true
        +showSubscribedUsers: true
        +showSubscribedMagazines: true
        +showSubscribedDomains: true
        +preferredLanguages: []
        +featuredMagazines: null
        +showProfileSubscriptions: true
        +showProfileFollowings: true
        +markNewComments: false
        +notifyOnNewEntry: false
        +notifyOnNewEntryReply: false
        +notifyOnNewEntryCommentReply: false
        +notifyOnNewPost: false
        +notifyOnNewPostReply: false
        +notifyOnNewPostCommentReply: false
        +addMentionsEntries: false
        +addMentionsPosts: true
        +isBanned: false
        +isVerified: false
        +isDeleted: false
        +isBot: false
        +spamProtection: true
        +customCss: null
        +ignoreMagazinesCustomCss: false
        +moderatorTokens: Doctrine\ORM\PersistentCollection {#3099 …}
        +magazineOwnershipRequests: Doctrine\ORM\PersistentCollection {#3101 …}
        +moderatorRequests: Doctrine\ORM\PersistentCollection {#3103 …}
        +entries: Doctrine\ORM\PersistentCollection {#3105 …}
        +entryVotes: Doctrine\ORM\PersistentCollection {#3107 …}
        +entryComments: Doctrine\ORM\PersistentCollection {#3109 …}
        +entryCommentVotes: Doctrine\ORM\PersistentCollection {#3111 …}
        +posts: Doctrine\ORM\PersistentCollection {#3113 …}
        +postVotes: Doctrine\ORM\PersistentCollection {#3115 …}
        +postComments: Doctrine\ORM\PersistentCollection {#3117 …}
        +postCommentVotes: Doctrine\ORM\PersistentCollection {#3119 …}
        +subscriptions: Doctrine\ORM\PersistentCollection {#3121 …}
        +subscribedDomains: Doctrine\ORM\PersistentCollection {#3123 …}
        +follows: Doctrine\ORM\PersistentCollection {#3125 …}
        +followers: Doctrine\ORM\PersistentCollection {#3127 …}
        +blocks: Doctrine\ORM\PersistentCollection {#3129 …}
        +blockers: Doctrine\ORM\PersistentCollection {#3131 …}
        +blockedMagazines: Doctrine\ORM\PersistentCollection {#3133 …}
        +blockedDomains: Doctrine\ORM\PersistentCollection {#3135 …}
        +reports: Doctrine\ORM\PersistentCollection {#3137 …}
        +favourites: Doctrine\ORM\PersistentCollection {#3139 …}
        +violations: Doctrine\ORM\PersistentCollection {#3141 …}
        +notifications: Doctrine\ORM\PersistentCollection {#3143 …}
        +awards: Doctrine\ORM\PersistentCollection {#3145 …}
        +subscribedCategories: Doctrine\ORM\PersistentCollection {#3147 …}
        +categories: Doctrine\ORM\PersistentCollection {#3149 …}
        -id: 6046
        -password: "$2y$13$FEroXtR95mjA6.omogLZRe7NJuWUL6hb.9a/FfXkqyIPnPgg4Apme"
        -totpSecret: null
        -totpBackupCodes: []
        -oAuth2UserConsents: Doctrine\ORM\PersistentCollection {#3151 …}
        +apId: "nilclass@discuss.tchncs.de"
        +apProfileId: "https://discuss.tchncs.de/u/nilclass"
        +apPublicUrl: "https://discuss.tchncs.de/u/nilclass"
        +apFollowersUrl: null
        +apInboxUrl: "https://discuss.tchncs.de/inbox"
        +apDomain: "discuss.tchncs.de"
        +apPreferredUsername: "nilclass"
        +apDiscoverable: true
        +apManuallyApprovesFollowers: false
        +privateKey: null
        +publicKey: null
        +apFetchedAt: DateTime @1720630912 {#3097
          date: 2024-07-10 19:01:52.0 +02:00
        }
        +apDeletedAt: null
        +apTimeoutAt: null
        +visibility: "visible             "
        +createdAt: DateTimeImmutable @1687291240 {#3098
          date: 2023-06-20 22:00:40.0 +02:00
        }
        +__isInitialized__: true
         …2
      }
      +magazine: Proxies\__CG__\App\Entity\Magazine {#1584
        +icon: Proxies\__CG__\App\Entity\Image {#2886 …}
        +name: "askelectronics@discuss.tchncs.de"
        +title: "askelectronics"
        +description: """
          **For questions about component-level electronic circuits, tools and equipment.**\n
          \n
          Rules\n
          -----\n
          \n
          1: Be nice.\n
          \n
          2: Be on-topic (eg: *Electronic*, not *electrical*).\n
          \n
          3: No commercial stuff, buying, selling or valuations.\n
          \n
          4: Be safe.\n
          \n
          ---
          """
        +rules: null
        +subscriptionsCount: 1
        +entryCount: 154
        +entryCommentCount: 1230
        +postCount: 1
        +postCommentCount: 4
        +isAdult: false
        +customCss: null
        +lastActive: DateTime @1729413608 {#2865
          date: 2024-10-20 10:40:08.0 +02:00
        }
        +markedForDeletionAt: null
        +tags: null
        +moderators: Doctrine\ORM\PersistentCollection {#2885 …}
        +ownershipRequests: Doctrine\ORM\PersistentCollection {#2883 …}
        +moderatorRequests: Doctrine\ORM\PersistentCollection {#2888 …}
        +entries: Doctrine\ORM\PersistentCollection {#2889 …}
        +posts: Doctrine\ORM\PersistentCollection {#2892 …}
        +subscriptions: Doctrine\ORM\PersistentCollection {#2894 …}
        +bans: Doctrine\ORM\PersistentCollection {#2900 …}
        +reports: Doctrine\ORM\PersistentCollection {#2908 …}
        +badges: Doctrine\ORM\PersistentCollection {#2921 …}
        +logs: Doctrine\ORM\PersistentCollection {#2931 …}
        +awards: Doctrine\ORM\PersistentCollection {#2913 …}
        +categories: Doctrine\ORM\PersistentCollection {#2937 …}
        -id: 11
        +apId: "askelectronics@discuss.tchncs.de"
        +apProfileId: "https://discuss.tchncs.de/c/askelectronics"
        +apPublicUrl: "https://discuss.tchncs.de/c/askelectronics"
        +apFollowersUrl: "https://discuss.tchncs.de/c/askelectronics/followers"
        +apInboxUrl: "https://discuss.tchncs.de/inbox"
        +apDomain: "discuss.tchncs.de"
        +apPreferredUsername: "askelectronics"
        +apDiscoverable: true
        +apManuallyApprovesFollowers: null
        +privateKey: null
        +publicKey: null
        +apFetchedAt: DateTime @1727247714 {#2866
          date: 2024-09-25 09:01:54.0 +02:00
        }
        +apDeletedAt: null
        +apTimeoutAt: null
        +visibility: "visible             "
        +createdAt: DateTimeImmutable @1687144409 {#2867
          date: 2023-06-19 05:13:29.0 +02:00
        }
        +__isInitialized__: true
         …2
      }
      +image: null
      +domain: Proxies\__CG__\App\Entity\Domain {#1630 …}
      +slug: "How-to-improve-my-battery-measurement-circuit"
      +title: "How to improve my battery measurement circuit?"
      +url: null
      +body: """
        I am powering a 5V microcontroller (arduino clone, atmega328p) using a 9V block and a buck converter. Now I want to let the microcontroller occasionally measure the battery voltage, so I can get an idea of how full it is.\n
        \n
        My first idea was to use a simple voltage divider:\n
        \n
        ![](https://discuss.tchncs.de/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)\n
        \n
        I’ve chosen the resistor values so that:\n
        \n
        - the voltage at the measure output is `< 1.1V`, to be able to use the 1.1V internal reference of the atmega’s ADC\n
        - `R1 || R2 < 10kΩ`, since the atmega datasheet says “The ADC is optimized for analog signals with an output impedance of approximately 10 kΩ or less”\n
        \n
        This is great and all, but what bothers me is that this circuit will constantly draw ~100µA from the battery.\n
        \n
        So, my next thought was to add a mosfet to the divider, to switch it on only while measuring:\n
        \n
        ![](https://discuss.tchncs.de/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)\n
        \n
        This is obviously bad, because now when the mosfet is off, the ADC input sees the whole battery voltage.\n
        \n
        To address that issue, I’ve added a second mosfet into the measure path:\n
        \n
        ![](https://discuss.tchncs.de/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)\n
        \n
        This works, and it does not draw any current, except while measuring.\n
        \n
        However, it’s quite a few parts. So I’m curious if anyone has an idea how to do this with just a single mosfet. It seems to me like it should be possible, but I haven’t figured out how.\n
        \n
        Oh, and if I’m doing something stupid here, please tell me :)
        """
      +type: "article"
      +lang: "en"
      +isOc: false
      +hasEmbed: false
      +commentCount: 11
      +favouriteCount: 17
      +score: 0
      +isAdult: false
      +sticky: false
      +lastActive: DateTime @1694781042 {#1715
        date: 2023-09-15 14:30:42.0 +02:00
      }
      +ip: null
      +adaAmount: 0
      +tags: null
      +mentions: null
      +comments: Doctrine\ORM\PersistentCollection {#1629 …}
      +votes: Doctrine\ORM\PersistentCollection {#1626 …}
      +reports: Doctrine\ORM\PersistentCollection {#1625 …}
      +favourites: Doctrine\ORM\PersistentCollection {#2370 …}
      +notifications: Doctrine\ORM\PersistentCollection {#2371 …}
      +badges: Doctrine\ORM\PersistentCollection {#1708 …}
      +children: [
        1 => App\Entity\EntryComment {#1709}
        0 => App\Entity\EntryComment {#1549
          +user: App\Entity\User {#265}
          +entry: Proxies\__CG__\App\Entity\Entry {#1591 …2}
          +magazine: Proxies\__CG__\App\Entity\Magazine {#1584 …2}
          +image: null
          +parent: Proxies\__CG__\App\Entity\EntryComment {#1692 …}
          +root: App\Entity\EntryComment {#1709}
          +body: """
            > Not sure I understand this point. Which resistor would you replace with a diode?\n
            \n
            Sorry, I think I was talking nonesense (doing this in my head and just woke up 😅).\n
            \n
            Not sure it’ll work with just a P-FET actually. You’ll likely need to control the PFET with a NFET, otherwise you still end up with too high a voltage on your control pin when the FET is off due to the gate pullup (unless you can use a fet with a very high Vgs Threshold and then drive it push/pull from the micro, but this isn’t really best practice).\n
            \n
            The above comment about diodes was to protect the microcontroller pin, but you end up not being able to control the FET doing it that way.\n
            \n
            I think either your existing Option 3 or PFET upstream of the divider, switched via an N-FET is the way to go.
            """
          +lang: "en"
          +isAdult: false
          +favouriteCount: 2
          +score: 0
          +lastActive: DateTime @1692955881 {#1673
            date: 2023-08-25 11:31:21.0 +02:00
          }
          +ip: null
          +tags: null
          +mentions: [
            "@nilclass@discuss.tchncs.de"
            "@Yonrak@feddit.uk"
          ]
          +children: Doctrine\ORM\PersistentCollection {#1691 …}
          +nested: Doctrine\ORM\PersistentCollection {#1680 …}
          +votes: Doctrine\ORM\PersistentCollection {#1683 …}
          +reports: Doctrine\ORM\PersistentCollection {#1702 …}
          +favourites: Doctrine\ORM\PersistentCollection {#1596 …}
          +notifications: Doctrine\ORM\PersistentCollection {#1613 …}
          -id: 26782
          -bodyTs: "'3':137 'abl':122 'actual':42 'best':103 'comment':107 'control':48,66,124 'diod':14,109 'divid':143 'drive':92 'due':73 'either':133 'end':57,118 'exist':135 'fet':41,70,83,126,149 'gate':76 'go':154 'head':26 'high':61,87 'isn':100 'like':45 'll':34,44 'micro':97 'microcontrol':114 'n':148 'n-fet':147 'need':46 'nfet':53 'nonesens':21 'option':136 'otherwis':54 'p':40 'p-fet':39 'pfet':50,139 'pin':67,115 'point':6 'practic':104 'protect':112 'pullup':77 'push/pull':94 'realli':102 'replac':11 'resistor':8 'sorri':15 'still':56 'sure':2,32 'switch':144 'talk':20 'think':17,132 'threshold':89 'understand':4 'unless':78 'upstream':140 'use':81 'vgs':88 'via':145 'voltag':63 'way':130,152 'woke':29 'work':35 'would':9"
          +ranking: 0
          +commentCount: 0
          +upVotes: 0
          +downVotes: 0
          +visibility: "visible             "
          +apId: "https://feddit.uk/comment/2186641"
          +editedAt: DateTimeImmutable @1692956099 {#1560
            date: 2023-08-25 11:34:59.0 +02:00
          }
          +createdAt: DateTimeImmutable @1692955881 {#1568
            date: 2023-08-25 11:31:21.0 +02:00
          }
          +"title": 26782
        }
      ]
      -id: 1944
      -titleTs: "'batteri':5 'circuit':7 'improv':3 'measur':6"
      -bodyTs: "'/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)':152 '/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)':188 '/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)':53 '1.1':69,77 '10':107 '100µa':127 '10kω':88 '5v':5 '9v':12 'abl':73 'ad':178 'adc':85,95,165 'add':137 'address':173 'analog':99 'anyon':213 'approxim':106 'arduino':7 'atmega':83,91 'atmega328p':9 'bad':156 'batteri':28,130,170 'block':13 'bother':118 'buck':16 'chosen':56 'circuit':123 'clone':8 'constant':125 'convert':17 'curious':211 'current':197 'datasheet':92 'discuss.tchncs.de':52,151,187 'discuss.tchncs.de/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)':150 'discuss.tchncs.de/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)':186 'discuss.tchncs.de/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)':51 'divid':50,142 'draw':126,195 'except':198 'figur':239 'first':42 'full':38 'get':33 'great':113 'haven':237 'howev':201 'idea':35,43,216 'imped':104 'input':166 'intern':79 'issu':175 'kω':108 'less':110 'let':22 'like':230 'm':210,246 'measur':26,66,149,184,200 'microcontrol':6,24 'mosfet':139,161,181,225 'next':133 'obvious':155 'occasion':25 'oh':242 'optim':97 'output':67,103 'part':207 'path':185 'pleas':251 'possibl':234 'power':3 'quit':204 'r1':86 'r2':87 'refer':80 'resistor':58 'say':93 'second':180 'see':167 'seem':227 'signal':100 'simpl':48 'sinc':89 'singl':224 'someth':248 'stupid':249 'switch':144 'tell':252 'thought':134 'use':10,46,75 'v':70,78 'valu':59 've':55,177 'voltag':29,49,63,171 'want':20 'whole':169 'work':190"
      +cross: false
      +upVotes: 0
      +downVotes: 0
      +ranking: 1693029637
      +visibility: "visible             "
      +apId: "https://discuss.tchncs.de/post/2309537"
      +editedAt: DateTimeImmutable @1692947232 {#1693
        date: 2023-08-25 09:07:12.0 +02:00
      }
      +createdAt: DateTimeImmutable @1692947137 {#1740
        date: 2023-08-25 09:05:37.0 +02:00
      }
      +__isInitialized__: true
       …2
    }
    +magazine: Proxies\__CG__\App\Entity\Magazine {#1584 …2}
    +image: null
    +parent: null
    +root: null
    +body: """
      Could you do similar to diagram 2, but instead of an N-FET use a P-FET between the battery and first resistor in the potential divider?\n
      \n
      Add a gate pull up resistor to source to ensure the FET is off by default, have the micro pull the gate down to take a measurement. You’ll probably need to add another resistor on the control pin to 0V to limit the voltage there also, but those two can be much much higher values to really limit current. Or use a zener/TVS diode instead of second resistor to clamp the voltage instead of dividing (more robust).\n
      \n
      Switch it with an NFET\n
      \n
      The micro will see 0V or divided/clamped battery voltage on the measurement pin.
      """
    +lang: "en"
    +isAdult: false
    +favouriteCount: 3
    +score: 0
    +lastActive: DateTime @1692955883 {#1439
      date: 2023-08-25 11:31:23.0 +02:00
    }
    +ip: null
    +tags: null
    +mentions: [
      "@nilclass@discuss.tchncs.de"
    ]
    +children: Doctrine\ORM\PersistentCollection {#1579 …}
    +nested: Doctrine\ORM\PersistentCollection {#1577 …}
    +votes: Doctrine\ORM\PersistentCollection {#1578 …}
    +reports: Doctrine\ORM\PersistentCollection {#1571 …}
    +favourites: Doctrine\ORM\PersistentCollection {#1574 …}
    +notifications: Doctrine\ORM\PersistentCollection {#1667 …}
    -id: 26779
    -bodyTs: "'0v':70,117 '2':7 'add':30,62 'also':76 'anoth':63 'batteri':22,120 'clamp':100 'control':67 'could':1 'current':89 'default':45 'diagram':6 'diod':94 'divid':29,105 'divided/clamped':119 'ensur':39 'fet':14,19,41 'first':24 'gate':32,51 'higher':84 'instead':9,95,103 'limit':72,88 'll':58 'measur':56,124 'micro':48,114 'much':82,83 'n':13 'n-fet':12 'need':60 'nfet':112 'p':18 'p-fet':17 'pin':68,125 'potenti':28 'probabl':59 'pull':33,49 'realli':87 'resistor':25,35,64,98 'robust':107 'second':97 'see':116 'similar':4 'sourc':37 'switch':108 'take':54 'two':79 'use':15,91 'valu':85 'voltag':74,102,121 'zener/tvs':93"
    +ranking: 0
    +commentCount: 0
    +upVotes: 0
    +downVotes: 0
    +visibility: "visible             "
    +apId: "https://feddit.uk/comment/2185380"
    +editedAt: DateTimeImmutable @1692969047 {#1435
      date: 2023-08-25 15:10:47.0 +02:00
    }
    +createdAt: DateTimeImmutable @1692950595 {#1436
      date: 2023-08-25 10:03:15.0 +02:00
    }
    +"title": 26779
  }
  +formDest: "entry_comment"
  +showDownvote: true
  -cache: Symfony\Component\Cache\Adapter\TraceableTagAwareAdapter {#600 …}
}
boost App\Twig\Components\BoostComponent 12.0 MiB 0.65 ms
Input props
[
  "subject" => App\Entity\EntryComment {#1709
    +user: App\Entity\User {#265
      +avatar: null
      +cover: null
      +email: "Yonrak@feddit.uk"
      +username: "@Yonrak@feddit.uk"
      +roles: []
      +followersCount: 0
      +homepage: "front"
      +about: null
      +lastActive: DateTime @1692955883 {#275
        date: 2023-08-25 11:31:23.0 +02:00
      }
      +markedForDeletionAt: null
      +fields: null
      +oauthGithubId: null
      +oauthGoogleId: null
      +oauthFacebookId: null
      +oauthKeycloakId: null
      +hideAdult: true
      +showSubscribedUsers: true
      +showSubscribedMagazines: true
      +showSubscribedDomains: true
      +preferredLanguages: []
      +featuredMagazines: null
      +showProfileSubscriptions: false
      +showProfileFollowings: true
      +markNewComments: false
      +notifyOnNewEntry: false
      +notifyOnNewEntryReply: true
      +notifyOnNewEntryCommentReply: true
      +notifyOnNewPost: false
      +notifyOnNewPostReply: true
      +notifyOnNewPostCommentReply: true
      +addMentionsEntries: false
      +addMentionsPosts: true
      +isBanned: false
      +isVerified: false
      +isDeleted: false
      +isBot: false
      +spamProtection: true
      +customCss: null
      +ignoreMagazinesCustomCss: false
      +moderatorTokens: Doctrine\ORM\PersistentCollection {#253 …}
      +magazineOwnershipRequests: Doctrine\ORM\PersistentCollection {#249 …}
      +moderatorRequests: Doctrine\ORM\PersistentCollection {#238 …}
      +entries: Doctrine\ORM\PersistentCollection {#196 …}
      +entryVotes: Doctrine\ORM\PersistentCollection {#168 …}
      +entryComments: Doctrine\ORM\PersistentCollection {#141 …}
      +entryCommentVotes: Doctrine\ORM\PersistentCollection {#111 …}
      +posts: Doctrine\ORM\PersistentCollection {#84 …}
      +postVotes: Doctrine\ORM\PersistentCollection {#99 …}
      +postComments: Doctrine\ORM\PersistentCollection {#1863 …}
      +postCommentVotes: Doctrine\ORM\PersistentCollection {#1479 …}
      +subscriptions: Doctrine\ORM\PersistentCollection {#1658 …}
      +subscribedDomains: Doctrine\ORM\PersistentCollection {#1868 …}
      +follows: Doctrine\ORM\PersistentCollection {#1917 …}
      +followers: Doctrine\ORM\PersistentCollection {#1601 …}
      +blocks: Doctrine\ORM\PersistentCollection {#1805 …}
      +blockers: Doctrine\ORM\PersistentCollection {#1810 …}
      +blockedMagazines: Doctrine\ORM\PersistentCollection {#1857 …}
      +blockedDomains: Doctrine\ORM\PersistentCollection {#1860 …}
      +reports: Doctrine\ORM\PersistentCollection {#1791 …}
      +favourites: Doctrine\ORM\PersistentCollection {#2416 …}
      +violations: Doctrine\ORM\PersistentCollection {#1824 …}
      +notifications: Doctrine\ORM\PersistentCollection {#1914 …}
      +awards: Doctrine\ORM\PersistentCollection {#1929 …}
      +subscribedCategories: Doctrine\ORM\PersistentCollection {#1867 …}
      +categories: Doctrine\ORM\PersistentCollection {#1880 …}
      -id: 42482
      -password: "$2y$13$NhIMiF1JXctMkB.To0A1l.9Yf5tUWEmnsXRxLOIoPHjfEy4B2UkMe"
      -totpSecret: null
      -totpBackupCodes: []
      -oAuth2UserConsents: Doctrine\ORM\PersistentCollection {#1894 …}
      +apId: "Yonrak@feddit.uk"
      +apProfileId: "https://feddit.uk/u/Yonrak"
      +apPublicUrl: "https://feddit.uk/u/Yonrak"
      +apFollowersUrl: null
      +apInboxUrl: "https://feddit.uk/inbox"
      +apDomain: "feddit.uk"
      +apPreferredUsername: "Yonrak"
      +apDiscoverable: true
      +apManuallyApprovesFollowers: false
      +privateKey: null
      +publicKey: null
      +apFetchedAt: DateTime @1692955883 {#269
        date: 2023-08-25 11:31:23.0 +02:00
      }
      +apDeletedAt: null
      +apTimeoutAt: null
      +visibility: "visible             "
      +createdAt: DateTimeImmutable @1692950596 {#268
        date: 2023-08-25 10:03:16.0 +02:00
      }
    }
    +entry: Proxies\__CG__\App\Entity\Entry {#1591
      +user: Proxies\__CG__\App\Entity\User {#2459
        +avatar: null
        +cover: null
        +email: "nilclass@discuss.tchncs.de"
        +username: "@nilclass@discuss.tchncs.de"
        +roles: []
        +followersCount: 0
        +homepage: "front"
        +about: null
        +lastActive: DateTime @1721268563 {#3096
          date: 2024-07-18 04:09:23.0 +02:00
        }
        +markedForDeletionAt: null
        +fields: null
        +oauthGithubId: null
        +oauthGoogleId: null
        +oauthFacebookId: null
        +oauthKeycloakId: null
        +hideAdult: true
        +showSubscribedUsers: true
        +showSubscribedMagazines: true
        +showSubscribedDomains: true
        +preferredLanguages: []
        +featuredMagazines: null
        +showProfileSubscriptions: true
        +showProfileFollowings: true
        +markNewComments: false
        +notifyOnNewEntry: false
        +notifyOnNewEntryReply: false
        +notifyOnNewEntryCommentReply: false
        +notifyOnNewPost: false
        +notifyOnNewPostReply: false
        +notifyOnNewPostCommentReply: false
        +addMentionsEntries: false
        +addMentionsPosts: true
        +isBanned: false
        +isVerified: false
        +isDeleted: false
        +isBot: false
        +spamProtection: true
        +customCss: null
        +ignoreMagazinesCustomCss: false
        +moderatorTokens: Doctrine\ORM\PersistentCollection {#3099 …}
        +magazineOwnershipRequests: Doctrine\ORM\PersistentCollection {#3101 …}
        +moderatorRequests: Doctrine\ORM\PersistentCollection {#3103 …}
        +entries: Doctrine\ORM\PersistentCollection {#3105 …}
        +entryVotes: Doctrine\ORM\PersistentCollection {#3107 …}
        +entryComments: Doctrine\ORM\PersistentCollection {#3109 …}
        +entryCommentVotes: Doctrine\ORM\PersistentCollection {#3111 …}
        +posts: Doctrine\ORM\PersistentCollection {#3113 …}
        +postVotes: Doctrine\ORM\PersistentCollection {#3115 …}
        +postComments: Doctrine\ORM\PersistentCollection {#3117 …}
        +postCommentVotes: Doctrine\ORM\PersistentCollection {#3119 …}
        +subscriptions: Doctrine\ORM\PersistentCollection {#3121 …}
        +subscribedDomains: Doctrine\ORM\PersistentCollection {#3123 …}
        +follows: Doctrine\ORM\PersistentCollection {#3125 …}
        +followers: Doctrine\ORM\PersistentCollection {#3127 …}
        +blocks: Doctrine\ORM\PersistentCollection {#3129 …}
        +blockers: Doctrine\ORM\PersistentCollection {#3131 …}
        +blockedMagazines: Doctrine\ORM\PersistentCollection {#3133 …}
        +blockedDomains: Doctrine\ORM\PersistentCollection {#3135 …}
        +reports: Doctrine\ORM\PersistentCollection {#3137 …}
        +favourites: Doctrine\ORM\PersistentCollection {#3139 …}
        +violations: Doctrine\ORM\PersistentCollection {#3141 …}
        +notifications: Doctrine\ORM\PersistentCollection {#3143 …}
        +awards: Doctrine\ORM\PersistentCollection {#3145 …}
        +subscribedCategories: Doctrine\ORM\PersistentCollection {#3147 …}
        +categories: Doctrine\ORM\PersistentCollection {#3149 …}
        -id: 6046
        -password: "$2y$13$FEroXtR95mjA6.omogLZRe7NJuWUL6hb.9a/FfXkqyIPnPgg4Apme"
        -totpSecret: null
        -totpBackupCodes: []
        -oAuth2UserConsents: Doctrine\ORM\PersistentCollection {#3151 …}
        +apId: "nilclass@discuss.tchncs.de"
        +apProfileId: "https://discuss.tchncs.de/u/nilclass"
        +apPublicUrl: "https://discuss.tchncs.de/u/nilclass"
        +apFollowersUrl: null
        +apInboxUrl: "https://discuss.tchncs.de/inbox"
        +apDomain: "discuss.tchncs.de"
        +apPreferredUsername: "nilclass"
        +apDiscoverable: true
        +apManuallyApprovesFollowers: false
        +privateKey: null
        +publicKey: null
        +apFetchedAt: DateTime @1720630912 {#3097
          date: 2024-07-10 19:01:52.0 +02:00
        }
        +apDeletedAt: null
        +apTimeoutAt: null
        +visibility: "visible             "
        +createdAt: DateTimeImmutable @1687291240 {#3098
          date: 2023-06-20 22:00:40.0 +02:00
        }
        +__isInitialized__: true
         …2
      }
      +magazine: Proxies\__CG__\App\Entity\Magazine {#1584
        +icon: Proxies\__CG__\App\Entity\Image {#2886 …}
        +name: "askelectronics@discuss.tchncs.de"
        +title: "askelectronics"
        +description: """
          **For questions about component-level electronic circuits, tools and equipment.**\n
          \n
          Rules\n
          -----\n
          \n
          1: Be nice.\n
          \n
          2: Be on-topic (eg: *Electronic*, not *electrical*).\n
          \n
          3: No commercial stuff, buying, selling or valuations.\n
          \n
          4: Be safe.\n
          \n
          ---
          """
        +rules: null
        +subscriptionsCount: 1
        +entryCount: 154
        +entryCommentCount: 1230
        +postCount: 1
        +postCommentCount: 4
        +isAdult: false
        +customCss: null
        +lastActive: DateTime @1729413608 {#2865
          date: 2024-10-20 10:40:08.0 +02:00
        }
        +markedForDeletionAt: null
        +tags: null
        +moderators: Doctrine\ORM\PersistentCollection {#2885 …}
        +ownershipRequests: Doctrine\ORM\PersistentCollection {#2883 …}
        +moderatorRequests: Doctrine\ORM\PersistentCollection {#2888 …}
        +entries: Doctrine\ORM\PersistentCollection {#2889 …}
        +posts: Doctrine\ORM\PersistentCollection {#2892 …}
        +subscriptions: Doctrine\ORM\PersistentCollection {#2894 …}
        +bans: Doctrine\ORM\PersistentCollection {#2900 …}
        +reports: Doctrine\ORM\PersistentCollection {#2908 …}
        +badges: Doctrine\ORM\PersistentCollection {#2921 …}
        +logs: Doctrine\ORM\PersistentCollection {#2931 …}
        +awards: Doctrine\ORM\PersistentCollection {#2913 …}
        +categories: Doctrine\ORM\PersistentCollection {#2937 …}
        -id: 11
        +apId: "askelectronics@discuss.tchncs.de"
        +apProfileId: "https://discuss.tchncs.de/c/askelectronics"
        +apPublicUrl: "https://discuss.tchncs.de/c/askelectronics"
        +apFollowersUrl: "https://discuss.tchncs.de/c/askelectronics/followers"
        +apInboxUrl: "https://discuss.tchncs.de/inbox"
        +apDomain: "discuss.tchncs.de"
        +apPreferredUsername: "askelectronics"
        +apDiscoverable: true
        +apManuallyApprovesFollowers: null
        +privateKey: null
        +publicKey: null
        +apFetchedAt: DateTime @1727247714 {#2866
          date: 2024-09-25 09:01:54.0 +02:00
        }
        +apDeletedAt: null
        +apTimeoutAt: null
        +visibility: "visible             "
        +createdAt: DateTimeImmutable @1687144409 {#2867
          date: 2023-06-19 05:13:29.0 +02:00
        }
        +__isInitialized__: true
         …2
      }
      +image: null
      +domain: Proxies\__CG__\App\Entity\Domain {#1630 …}
      +slug: "How-to-improve-my-battery-measurement-circuit"
      +title: "How to improve my battery measurement circuit?"
      +url: null
      +body: """
        I am powering a 5V microcontroller (arduino clone, atmega328p) using a 9V block and a buck converter. Now I want to let the microcontroller occasionally measure the battery voltage, so I can get an idea of how full it is.\n
        \n
        My first idea was to use a simple voltage divider:\n
        \n
        ![](https://discuss.tchncs.de/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)\n
        \n
        I’ve chosen the resistor values so that:\n
        \n
        - the voltage at the measure output is `< 1.1V`, to be able to use the 1.1V internal reference of the atmega’s ADC\n
        - `R1 || R2 < 10kΩ`, since the atmega datasheet says “The ADC is optimized for analog signals with an output impedance of approximately 10 kΩ or less”\n
        \n
        This is great and all, but what bothers me is that this circuit will constantly draw ~100µA from the battery.\n
        \n
        So, my next thought was to add a mosfet to the divider, to switch it on only while measuring:\n
        \n
        ![](https://discuss.tchncs.de/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)\n
        \n
        This is obviously bad, because now when the mosfet is off, the ADC input sees the whole battery voltage.\n
        \n
        To address that issue, I’ve added a second mosfet into the measure path:\n
        \n
        ![](https://discuss.tchncs.de/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)\n
        \n
        This works, and it does not draw any current, except while measuring.\n
        \n
        However, it’s quite a few parts. So I’m curious if anyone has an idea how to do this with just a single mosfet. It seems to me like it should be possible, but I haven’t figured out how.\n
        \n
        Oh, and if I’m doing something stupid here, please tell me :)
        """
      +type: "article"
      +lang: "en"
      +isOc: false
      +hasEmbed: false
      +commentCount: 11
      +favouriteCount: 17
      +score: 0
      +isAdult: false
      +sticky: false
      +lastActive: DateTime @1694781042 {#1715
        date: 2023-09-15 14:30:42.0 +02:00
      }
      +ip: null
      +adaAmount: 0
      +tags: null
      +mentions: null
      +comments: Doctrine\ORM\PersistentCollection {#1629 …}
      +votes: Doctrine\ORM\PersistentCollection {#1626 …}
      +reports: Doctrine\ORM\PersistentCollection {#1625 …}
      +favourites: Doctrine\ORM\PersistentCollection {#2370 …}
      +notifications: Doctrine\ORM\PersistentCollection {#2371 …}
      +badges: Doctrine\ORM\PersistentCollection {#1708 …}
      +children: [
        1 => App\Entity\EntryComment {#1709}
        0 => App\Entity\EntryComment {#1549
          +user: App\Entity\User {#265}
          +entry: Proxies\__CG__\App\Entity\Entry {#1591 …2}
          +magazine: Proxies\__CG__\App\Entity\Magazine {#1584 …2}
          +image: null
          +parent: Proxies\__CG__\App\Entity\EntryComment {#1692 …}
          +root: App\Entity\EntryComment {#1709}
          +body: """
            > Not sure I understand this point. Which resistor would you replace with a diode?\n
            \n
            Sorry, I think I was talking nonesense (doing this in my head and just woke up 😅).\n
            \n
            Not sure it’ll work with just a P-FET actually. You’ll likely need to control the PFET with a NFET, otherwise you still end up with too high a voltage on your control pin when the FET is off due to the gate pullup (unless you can use a fet with a very high Vgs Threshold and then drive it push/pull from the micro, but this isn’t really best practice).\n
            \n
            The above comment about diodes was to protect the microcontroller pin, but you end up not being able to control the FET doing it that way.\n
            \n
            I think either your existing Option 3 or PFET upstream of the divider, switched via an N-FET is the way to go.
            """
          +lang: "en"
          +isAdult: false
          +favouriteCount: 2
          +score: 0
          +lastActive: DateTime @1692955881 {#1673
            date: 2023-08-25 11:31:21.0 +02:00
          }
          +ip: null
          +tags: null
          +mentions: [
            "@nilclass@discuss.tchncs.de"
            "@Yonrak@feddit.uk"
          ]
          +children: Doctrine\ORM\PersistentCollection {#1691 …}
          +nested: Doctrine\ORM\PersistentCollection {#1680 …}
          +votes: Doctrine\ORM\PersistentCollection {#1683 …}
          +reports: Doctrine\ORM\PersistentCollection {#1702 …}
          +favourites: Doctrine\ORM\PersistentCollection {#1596 …}
          +notifications: Doctrine\ORM\PersistentCollection {#1613 …}
          -id: 26782
          -bodyTs: "'3':137 'abl':122 'actual':42 'best':103 'comment':107 'control':48,66,124 'diod':14,109 'divid':143 'drive':92 'due':73 'either':133 'end':57,118 'exist':135 'fet':41,70,83,126,149 'gate':76 'go':154 'head':26 'high':61,87 'isn':100 'like':45 'll':34,44 'micro':97 'microcontrol':114 'n':148 'n-fet':147 'need':46 'nfet':53 'nonesens':21 'option':136 'otherwis':54 'p':40 'p-fet':39 'pfet':50,139 'pin':67,115 'point':6 'practic':104 'protect':112 'pullup':77 'push/pull':94 'realli':102 'replac':11 'resistor':8 'sorri':15 'still':56 'sure':2,32 'switch':144 'talk':20 'think':17,132 'threshold':89 'understand':4 'unless':78 'upstream':140 'use':81 'vgs':88 'via':145 'voltag':63 'way':130,152 'woke':29 'work':35 'would':9"
          +ranking: 0
          +commentCount: 0
          +upVotes: 0
          +downVotes: 0
          +visibility: "visible             "
          +apId: "https://feddit.uk/comment/2186641"
          +editedAt: DateTimeImmutable @1692956099 {#1560
            date: 2023-08-25 11:34:59.0 +02:00
          }
          +createdAt: DateTimeImmutable @1692955881 {#1568
            date: 2023-08-25 11:31:21.0 +02:00
          }
          +"title": 26782
        }
      ]
      -id: 1944
      -titleTs: "'batteri':5 'circuit':7 'improv':3 'measur':6"
      -bodyTs: "'/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)':152 '/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)':188 '/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)':53 '1.1':69,77 '10':107 '100µa':127 '10kω':88 '5v':5 '9v':12 'abl':73 'ad':178 'adc':85,95,165 'add':137 'address':173 'analog':99 'anyon':213 'approxim':106 'arduino':7 'atmega':83,91 'atmega328p':9 'bad':156 'batteri':28,130,170 'block':13 'bother':118 'buck':16 'chosen':56 'circuit':123 'clone':8 'constant':125 'convert':17 'curious':211 'current':197 'datasheet':92 'discuss.tchncs.de':52,151,187 'discuss.tchncs.de/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)':150 'discuss.tchncs.de/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)':186 'discuss.tchncs.de/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)':51 'divid':50,142 'draw':126,195 'except':198 'figur':239 'first':42 'full':38 'get':33 'great':113 'haven':237 'howev':201 'idea':35,43,216 'imped':104 'input':166 'intern':79 'issu':175 'kω':108 'less':110 'let':22 'like':230 'm':210,246 'measur':26,66,149,184,200 'microcontrol':6,24 'mosfet':139,161,181,225 'next':133 'obvious':155 'occasion':25 'oh':242 'optim':97 'output':67,103 'part':207 'path':185 'pleas':251 'possibl':234 'power':3 'quit':204 'r1':86 'r2':87 'refer':80 'resistor':58 'say':93 'second':180 'see':167 'seem':227 'signal':100 'simpl':48 'sinc':89 'singl':224 'someth':248 'stupid':249 'switch':144 'tell':252 'thought':134 'use':10,46,75 'v':70,78 'valu':59 've':55,177 'voltag':29,49,63,171 'want':20 'whole':169 'work':190"
      +cross: false
      +upVotes: 0
      +downVotes: 0
      +ranking: 1693029637
      +visibility: "visible             "
      +apId: "https://discuss.tchncs.de/post/2309537"
      +editedAt: DateTimeImmutable @1692947232 {#1693
        date: 2023-08-25 09:07:12.0 +02:00
      }
      +createdAt: DateTimeImmutable @1692947137 {#1740
        date: 2023-08-25 09:05:37.0 +02:00
      }
      +__isInitialized__: true
       …2
    }
    +magazine: Proxies\__CG__\App\Entity\Magazine {#1584 …2}
    +image: null
    +parent: null
    +root: null
    +body: """
      Could you do similar to diagram 2, but instead of an N-FET use a P-FET between the battery and first resistor in the potential divider?\n
      \n
      Add a gate pull up resistor to source to ensure the FET is off by default, have the micro pull the gate down to take a measurement. You’ll probably need to add another resistor on the control pin to 0V to limit the voltage there also, but those two can be much much higher values to really limit current. Or use a zener/TVS diode instead of second resistor to clamp the voltage instead of dividing (more robust).\n
      \n
      Switch it with an NFET\n
      \n
      The micro will see 0V or divided/clamped battery voltage on the measurement pin.
      """
    +lang: "en"
    +isAdult: false
    +favouriteCount: 3
    +score: 0
    +lastActive: DateTime @1692955883 {#1439
      date: 2023-08-25 11:31:23.0 +02:00
    }
    +ip: null
    +tags: null
    +mentions: [
      "@nilclass@discuss.tchncs.de"
    ]
    +children: Doctrine\ORM\PersistentCollection {#1579 …}
    +nested: Doctrine\ORM\PersistentCollection {#1577 …}
    +votes: Doctrine\ORM\PersistentCollection {#1578 …}
    +reports: Doctrine\ORM\PersistentCollection {#1571 …}
    +favourites: Doctrine\ORM\PersistentCollection {#1574 …}
    +notifications: Doctrine\ORM\PersistentCollection {#1667 …}
    -id: 26779
    -bodyTs: "'0v':70,117 '2':7 'add':30,62 'also':76 'anoth':63 'batteri':22,120 'clamp':100 'control':67 'could':1 'current':89 'default':45 'diagram':6 'diod':94 'divid':29,105 'divided/clamped':119 'ensur':39 'fet':14,19,41 'first':24 'gate':32,51 'higher':84 'instead':9,95,103 'limit':72,88 'll':58 'measur':56,124 'micro':48,114 'much':82,83 'n':13 'n-fet':12 'need':60 'nfet':112 'p':18 'p-fet':17 'pin':68,125 'potenti':28 'probabl':59 'pull':33,49 'realli':87 'resistor':25,35,64,98 'robust':107 'second':97 'see':116 'similar':4 'sourc':37 'switch':108 'take':54 'two':79 'use':15,91 'valu':85 'voltag':74,102,121 'zener/tvs':93"
    +ranking: 0
    +commentCount: 0
    +upVotes: 0
    +downVotes: 0
    +visibility: "visible             "
    +apId: "https://feddit.uk/comment/2185380"
    +editedAt: DateTimeImmutable @1692969047 {#1435
      date: 2023-08-25 15:10:47.0 +02:00
    }
    +createdAt: DateTimeImmutable @1692950595 {#1436
      date: 2023-08-25 10:03:15.0 +02:00
    }
    +"title": 26779
  }
]
Attributes
[]
Component
App\Twig\Components\BoostComponent {#4129
  +formDest: "entry_comment"
  +subject: App\Entity\EntryComment {#1709
    +user: App\Entity\User {#265
      +avatar: null
      +cover: null
      +email: "Yonrak@feddit.uk"
      +username: "@Yonrak@feddit.uk"
      +roles: []
      +followersCount: 0
      +homepage: "front"
      +about: null
      +lastActive: DateTime @1692955883 {#275
        date: 2023-08-25 11:31:23.0 +02:00
      }
      +markedForDeletionAt: null
      +fields: null
      +oauthGithubId: null
      +oauthGoogleId: null
      +oauthFacebookId: null
      +oauthKeycloakId: null
      +hideAdult: true
      +showSubscribedUsers: true
      +showSubscribedMagazines: true
      +showSubscribedDomains: true
      +preferredLanguages: []
      +featuredMagazines: null
      +showProfileSubscriptions: false
      +showProfileFollowings: true
      +markNewComments: false
      +notifyOnNewEntry: false
      +notifyOnNewEntryReply: true
      +notifyOnNewEntryCommentReply: true
      +notifyOnNewPost: false
      +notifyOnNewPostReply: true
      +notifyOnNewPostCommentReply: true
      +addMentionsEntries: false
      +addMentionsPosts: true
      +isBanned: false
      +isVerified: false
      +isDeleted: false
      +isBot: false
      +spamProtection: true
      +customCss: null
      +ignoreMagazinesCustomCss: false
      +moderatorTokens: Doctrine\ORM\PersistentCollection {#253 …}
      +magazineOwnershipRequests: Doctrine\ORM\PersistentCollection {#249 …}
      +moderatorRequests: Doctrine\ORM\PersistentCollection {#238 …}
      +entries: Doctrine\ORM\PersistentCollection {#196 …}
      +entryVotes: Doctrine\ORM\PersistentCollection {#168 …}
      +entryComments: Doctrine\ORM\PersistentCollection {#141 …}
      +entryCommentVotes: Doctrine\ORM\PersistentCollection {#111 …}
      +posts: Doctrine\ORM\PersistentCollection {#84 …}
      +postVotes: Doctrine\ORM\PersistentCollection {#99 …}
      +postComments: Doctrine\ORM\PersistentCollection {#1863 …}
      +postCommentVotes: Doctrine\ORM\PersistentCollection {#1479 …}
      +subscriptions: Doctrine\ORM\PersistentCollection {#1658 …}
      +subscribedDomains: Doctrine\ORM\PersistentCollection {#1868 …}
      +follows: Doctrine\ORM\PersistentCollection {#1917 …}
      +followers: Doctrine\ORM\PersistentCollection {#1601 …}
      +blocks: Doctrine\ORM\PersistentCollection {#1805 …}
      +blockers: Doctrine\ORM\PersistentCollection {#1810 …}
      +blockedMagazines: Doctrine\ORM\PersistentCollection {#1857 …}
      +blockedDomains: Doctrine\ORM\PersistentCollection {#1860 …}
      +reports: Doctrine\ORM\PersistentCollection {#1791 …}
      +favourites: Doctrine\ORM\PersistentCollection {#2416 …}
      +violations: Doctrine\ORM\PersistentCollection {#1824 …}
      +notifications: Doctrine\ORM\PersistentCollection {#1914 …}
      +awards: Doctrine\ORM\PersistentCollection {#1929 …}
      +subscribedCategories: Doctrine\ORM\PersistentCollection {#1867 …}
      +categories: Doctrine\ORM\PersistentCollection {#1880 …}
      -id: 42482
      -password: "$2y$13$NhIMiF1JXctMkB.To0A1l.9Yf5tUWEmnsXRxLOIoPHjfEy4B2UkMe"
      -totpSecret: null
      -totpBackupCodes: []
      -oAuth2UserConsents: Doctrine\ORM\PersistentCollection {#1894 …}
      +apId: "Yonrak@feddit.uk"
      +apProfileId: "https://feddit.uk/u/Yonrak"
      +apPublicUrl: "https://feddit.uk/u/Yonrak"
      +apFollowersUrl: null
      +apInboxUrl: "https://feddit.uk/inbox"
      +apDomain: "feddit.uk"
      +apPreferredUsername: "Yonrak"
      +apDiscoverable: true
      +apManuallyApprovesFollowers: false
      +privateKey: null
      +publicKey: null
      +apFetchedAt: DateTime @1692955883 {#269
        date: 2023-08-25 11:31:23.0 +02:00
      }
      +apDeletedAt: null
      +apTimeoutAt: null
      +visibility: "visible             "
      +createdAt: DateTimeImmutable @1692950596 {#268
        date: 2023-08-25 10:03:16.0 +02:00
      }
    }
    +entry: Proxies\__CG__\App\Entity\Entry {#1591
      +user: Proxies\__CG__\App\Entity\User {#2459
        +avatar: null
        +cover: null
        +email: "nilclass@discuss.tchncs.de"
        +username: "@nilclass@discuss.tchncs.de"
        +roles: []
        +followersCount: 0
        +homepage: "front"
        +about: null
        +lastActive: DateTime @1721268563 {#3096
          date: 2024-07-18 04:09:23.0 +02:00
        }
        +markedForDeletionAt: null
        +fields: null
        +oauthGithubId: null
        +oauthGoogleId: null
        +oauthFacebookId: null
        +oauthKeycloakId: null
        +hideAdult: true
        +showSubscribedUsers: true
        +showSubscribedMagazines: true
        +showSubscribedDomains: true
        +preferredLanguages: []
        +featuredMagazines: null
        +showProfileSubscriptions: true
        +showProfileFollowings: true
        +markNewComments: false
        +notifyOnNewEntry: false
        +notifyOnNewEntryReply: false
        +notifyOnNewEntryCommentReply: false
        +notifyOnNewPost: false
        +notifyOnNewPostReply: false
        +notifyOnNewPostCommentReply: false
        +addMentionsEntries: false
        +addMentionsPosts: true
        +isBanned: false
        +isVerified: false
        +isDeleted: false
        +isBot: false
        +spamProtection: true
        +customCss: null
        +ignoreMagazinesCustomCss: false
        +moderatorTokens: Doctrine\ORM\PersistentCollection {#3099 …}
        +magazineOwnershipRequests: Doctrine\ORM\PersistentCollection {#3101 …}
        +moderatorRequests: Doctrine\ORM\PersistentCollection {#3103 …}
        +entries: Doctrine\ORM\PersistentCollection {#3105 …}
        +entryVotes: Doctrine\ORM\PersistentCollection {#3107 …}
        +entryComments: Doctrine\ORM\PersistentCollection {#3109 …}
        +entryCommentVotes: Doctrine\ORM\PersistentCollection {#3111 …}
        +posts: Doctrine\ORM\PersistentCollection {#3113 …}
        +postVotes: Doctrine\ORM\PersistentCollection {#3115 …}
        +postComments: Doctrine\ORM\PersistentCollection {#3117 …}
        +postCommentVotes: Doctrine\ORM\PersistentCollection {#3119 …}
        +subscriptions: Doctrine\ORM\PersistentCollection {#3121 …}
        +subscribedDomains: Doctrine\ORM\PersistentCollection {#3123 …}
        +follows: Doctrine\ORM\PersistentCollection {#3125 …}
        +followers: Doctrine\ORM\PersistentCollection {#3127 …}
        +blocks: Doctrine\ORM\PersistentCollection {#3129 …}
        +blockers: Doctrine\ORM\PersistentCollection {#3131 …}
        +blockedMagazines: Doctrine\ORM\PersistentCollection {#3133 …}
        +blockedDomains: Doctrine\ORM\PersistentCollection {#3135 …}
        +reports: Doctrine\ORM\PersistentCollection {#3137 …}
        +favourites: Doctrine\ORM\PersistentCollection {#3139 …}
        +violations: Doctrine\ORM\PersistentCollection {#3141 …}
        +notifications: Doctrine\ORM\PersistentCollection {#3143 …}
        +awards: Doctrine\ORM\PersistentCollection {#3145 …}
        +subscribedCategories: Doctrine\ORM\PersistentCollection {#3147 …}
        +categories: Doctrine\ORM\PersistentCollection {#3149 …}
        -id: 6046
        -password: "$2y$13$FEroXtR95mjA6.omogLZRe7NJuWUL6hb.9a/FfXkqyIPnPgg4Apme"
        -totpSecret: null
        -totpBackupCodes: []
        -oAuth2UserConsents: Doctrine\ORM\PersistentCollection {#3151 …}
        +apId: "nilclass@discuss.tchncs.de"
        +apProfileId: "https://discuss.tchncs.de/u/nilclass"
        +apPublicUrl: "https://discuss.tchncs.de/u/nilclass"
        +apFollowersUrl: null
        +apInboxUrl: "https://discuss.tchncs.de/inbox"
        +apDomain: "discuss.tchncs.de"
        +apPreferredUsername: "nilclass"
        +apDiscoverable: true
        +apManuallyApprovesFollowers: false
        +privateKey: null
        +publicKey: null
        +apFetchedAt: DateTime @1720630912 {#3097
          date: 2024-07-10 19:01:52.0 +02:00
        }
        +apDeletedAt: null
        +apTimeoutAt: null
        +visibility: "visible             "
        +createdAt: DateTimeImmutable @1687291240 {#3098
          date: 2023-06-20 22:00:40.0 +02:00
        }
        +__isInitialized__: true
         …2
      }
      +magazine: Proxies\__CG__\App\Entity\Magazine {#1584
        +icon: Proxies\__CG__\App\Entity\Image {#2886 …}
        +name: "askelectronics@discuss.tchncs.de"
        +title: "askelectronics"
        +description: """
          **For questions about component-level electronic circuits, tools and equipment.**\n
          \n
          Rules\n
          -----\n
          \n
          1: Be nice.\n
          \n
          2: Be on-topic (eg: *Electronic*, not *electrical*).\n
          \n
          3: No commercial stuff, buying, selling or valuations.\n
          \n
          4: Be safe.\n
          \n
          ---
          """
        +rules: null
        +subscriptionsCount: 1
        +entryCount: 154
        +entryCommentCount: 1230
        +postCount: 1
        +postCommentCount: 4
        +isAdult: false
        +customCss: null
        +lastActive: DateTime @1729413608 {#2865
          date: 2024-10-20 10:40:08.0 +02:00
        }
        +markedForDeletionAt: null
        +tags: null
        +moderators: Doctrine\ORM\PersistentCollection {#2885 …}
        +ownershipRequests: Doctrine\ORM\PersistentCollection {#2883 …}
        +moderatorRequests: Doctrine\ORM\PersistentCollection {#2888 …}
        +entries: Doctrine\ORM\PersistentCollection {#2889 …}
        +posts: Doctrine\ORM\PersistentCollection {#2892 …}
        +subscriptions: Doctrine\ORM\PersistentCollection {#2894 …}
        +bans: Doctrine\ORM\PersistentCollection {#2900 …}
        +reports: Doctrine\ORM\PersistentCollection {#2908 …}
        +badges: Doctrine\ORM\PersistentCollection {#2921 …}
        +logs: Doctrine\ORM\PersistentCollection {#2931 …}
        +awards: Doctrine\ORM\PersistentCollection {#2913 …}
        +categories: Doctrine\ORM\PersistentCollection {#2937 …}
        -id: 11
        +apId: "askelectronics@discuss.tchncs.de"
        +apProfileId: "https://discuss.tchncs.de/c/askelectronics"
        +apPublicUrl: "https://discuss.tchncs.de/c/askelectronics"
        +apFollowersUrl: "https://discuss.tchncs.de/c/askelectronics/followers"
        +apInboxUrl: "https://discuss.tchncs.de/inbox"
        +apDomain: "discuss.tchncs.de"
        +apPreferredUsername: "askelectronics"
        +apDiscoverable: true
        +apManuallyApprovesFollowers: null
        +privateKey: null
        +publicKey: null
        +apFetchedAt: DateTime @1727247714 {#2866
          date: 2024-09-25 09:01:54.0 +02:00
        }
        +apDeletedAt: null
        +apTimeoutAt: null
        +visibility: "visible             "
        +createdAt: DateTimeImmutable @1687144409 {#2867
          date: 2023-06-19 05:13:29.0 +02:00
        }
        +__isInitialized__: true
         …2
      }
      +image: null
      +domain: Proxies\__CG__\App\Entity\Domain {#1630 …}
      +slug: "How-to-improve-my-battery-measurement-circuit"
      +title: "How to improve my battery measurement circuit?"
      +url: null
      +body: """
        I am powering a 5V microcontroller (arduino clone, atmega328p) using a 9V block and a buck converter. Now I want to let the microcontroller occasionally measure the battery voltage, so I can get an idea of how full it is.\n
        \n
        My first idea was to use a simple voltage divider:\n
        \n
        ![](https://discuss.tchncs.de/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)\n
        \n
        I’ve chosen the resistor values so that:\n
        \n
        - the voltage at the measure output is `< 1.1V`, to be able to use the 1.1V internal reference of the atmega’s ADC\n
        - `R1 || R2 < 10kΩ`, since the atmega datasheet says “The ADC is optimized for analog signals with an output impedance of approximately 10 kΩ or less”\n
        \n
        This is great and all, but what bothers me is that this circuit will constantly draw ~100µA from the battery.\n
        \n
        So, my next thought was to add a mosfet to the divider, to switch it on only while measuring:\n
        \n
        ![](https://discuss.tchncs.de/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)\n
        \n
        This is obviously bad, because now when the mosfet is off, the ADC input sees the whole battery voltage.\n
        \n
        To address that issue, I’ve added a second mosfet into the measure path:\n
        \n
        ![](https://discuss.tchncs.de/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)\n
        \n
        This works, and it does not draw any current, except while measuring.\n
        \n
        However, it’s quite a few parts. So I’m curious if anyone has an idea how to do this with just a single mosfet. It seems to me like it should be possible, but I haven’t figured out how.\n
        \n
        Oh, and if I’m doing something stupid here, please tell me :)
        """
      +type: "article"
      +lang: "en"
      +isOc: false
      +hasEmbed: false
      +commentCount: 11
      +favouriteCount: 17
      +score: 0
      +isAdult: false
      +sticky: false
      +lastActive: DateTime @1694781042 {#1715
        date: 2023-09-15 14:30:42.0 +02:00
      }
      +ip: null
      +adaAmount: 0
      +tags: null
      +mentions: null
      +comments: Doctrine\ORM\PersistentCollection {#1629 …}
      +votes: Doctrine\ORM\PersistentCollection {#1626 …}
      +reports: Doctrine\ORM\PersistentCollection {#1625 …}
      +favourites: Doctrine\ORM\PersistentCollection {#2370 …}
      +notifications: Doctrine\ORM\PersistentCollection {#2371 …}
      +badges: Doctrine\ORM\PersistentCollection {#1708 …}
      +children: [
        1 => App\Entity\EntryComment {#1709}
        0 => App\Entity\EntryComment {#1549
          +user: App\Entity\User {#265}
          +entry: Proxies\__CG__\App\Entity\Entry {#1591 …2}
          +magazine: Proxies\__CG__\App\Entity\Magazine {#1584 …2}
          +image: null
          +parent: Proxies\__CG__\App\Entity\EntryComment {#1692 …}
          +root: App\Entity\EntryComment {#1709}
          +body: """
            > Not sure I understand this point. Which resistor would you replace with a diode?\n
            \n
            Sorry, I think I was talking nonesense (doing this in my head and just woke up 😅).\n
            \n
            Not sure it’ll work with just a P-FET actually. You’ll likely need to control the PFET with a NFET, otherwise you still end up with too high a voltage on your control pin when the FET is off due to the gate pullup (unless you can use a fet with a very high Vgs Threshold and then drive it push/pull from the micro, but this isn’t really best practice).\n
            \n
            The above comment about diodes was to protect the microcontroller pin, but you end up not being able to control the FET doing it that way.\n
            \n
            I think either your existing Option 3 or PFET upstream of the divider, switched via an N-FET is the way to go.
            """
          +lang: "en"
          +isAdult: false
          +favouriteCount: 2
          +score: 0
          +lastActive: DateTime @1692955881 {#1673
            date: 2023-08-25 11:31:21.0 +02:00
          }
          +ip: null
          +tags: null
          +mentions: [
            "@nilclass@discuss.tchncs.de"
            "@Yonrak@feddit.uk"
          ]
          +children: Doctrine\ORM\PersistentCollection {#1691 …}
          +nested: Doctrine\ORM\PersistentCollection {#1680 …}
          +votes: Doctrine\ORM\PersistentCollection {#1683 …}
          +reports: Doctrine\ORM\PersistentCollection {#1702 …}
          +favourites: Doctrine\ORM\PersistentCollection {#1596 …}
          +notifications: Doctrine\ORM\PersistentCollection {#1613 …}
          -id: 26782
          -bodyTs: "'3':137 'abl':122 'actual':42 'best':103 'comment':107 'control':48,66,124 'diod':14,109 'divid':143 'drive':92 'due':73 'either':133 'end':57,118 'exist':135 'fet':41,70,83,126,149 'gate':76 'go':154 'head':26 'high':61,87 'isn':100 'like':45 'll':34,44 'micro':97 'microcontrol':114 'n':148 'n-fet':147 'need':46 'nfet':53 'nonesens':21 'option':136 'otherwis':54 'p':40 'p-fet':39 'pfet':50,139 'pin':67,115 'point':6 'practic':104 'protect':112 'pullup':77 'push/pull':94 'realli':102 'replac':11 'resistor':8 'sorri':15 'still':56 'sure':2,32 'switch':144 'talk':20 'think':17,132 'threshold':89 'understand':4 'unless':78 'upstream':140 'use':81 'vgs':88 'via':145 'voltag':63 'way':130,152 'woke':29 'work':35 'would':9"
          +ranking: 0
          +commentCount: 0
          +upVotes: 0
          +downVotes: 0
          +visibility: "visible             "
          +apId: "https://feddit.uk/comment/2186641"
          +editedAt: DateTimeImmutable @1692956099 {#1560
            date: 2023-08-25 11:34:59.0 +02:00
          }
          +createdAt: DateTimeImmutable @1692955881 {#1568
            date: 2023-08-25 11:31:21.0 +02:00
          }
          +"title": 26782
        }
      ]
      -id: 1944
      -titleTs: "'batteri':5 'circuit':7 'improv':3 'measur':6"
      -bodyTs: "'/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)':152 '/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)':188 '/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)':53 '1.1':69,77 '10':107 '100µa':127 '10kω':88 '5v':5 '9v':12 'abl':73 'ad':178 'adc':85,95,165 'add':137 'address':173 'analog':99 'anyon':213 'approxim':106 'arduino':7 'atmega':83,91 'atmega328p':9 'bad':156 'batteri':28,130,170 'block':13 'bother':118 'buck':16 'chosen':56 'circuit':123 'clone':8 'constant':125 'convert':17 'curious':211 'current':197 'datasheet':92 'discuss.tchncs.de':52,151,187 'discuss.tchncs.de/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)':150 'discuss.tchncs.de/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)':186 'discuss.tchncs.de/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)':51 'divid':50,142 'draw':126,195 'except':198 'figur':239 'first':42 'full':38 'get':33 'great':113 'haven':237 'howev':201 'idea':35,43,216 'imped':104 'input':166 'intern':79 'issu':175 'kω':108 'less':110 'let':22 'like':230 'm':210,246 'measur':26,66,149,184,200 'microcontrol':6,24 'mosfet':139,161,181,225 'next':133 'obvious':155 'occasion':25 'oh':242 'optim':97 'output':67,103 'part':207 'path':185 'pleas':251 'possibl':234 'power':3 'quit':204 'r1':86 'r2':87 'refer':80 'resistor':58 'say':93 'second':180 'see':167 'seem':227 'signal':100 'simpl':48 'sinc':89 'singl':224 'someth':248 'stupid':249 'switch':144 'tell':252 'thought':134 'use':10,46,75 'v':70,78 'valu':59 've':55,177 'voltag':29,49,63,171 'want':20 'whole':169 'work':190"
      +cross: false
      +upVotes: 0
      +downVotes: 0
      +ranking: 1693029637
      +visibility: "visible             "
      +apId: "https://discuss.tchncs.de/post/2309537"
      +editedAt: DateTimeImmutable @1692947232 {#1693
        date: 2023-08-25 09:07:12.0 +02:00
      }
      +createdAt: DateTimeImmutable @1692947137 {#1740
        date: 2023-08-25 09:05:37.0 +02:00
      }
      +__isInitialized__: true
       …2
    }
    +magazine: Proxies\__CG__\App\Entity\Magazine {#1584 …2}
    +image: null
    +parent: null
    +root: null
    +body: """
      Could you do similar to diagram 2, but instead of an N-FET use a P-FET between the battery and first resistor in the potential divider?\n
      \n
      Add a gate pull up resistor to source to ensure the FET is off by default, have the micro pull the gate down to take a measurement. You’ll probably need to add another resistor on the control pin to 0V to limit the voltage there also, but those two can be much much higher values to really limit current. Or use a zener/TVS diode instead of second resistor to clamp the voltage instead of dividing (more robust).\n
      \n
      Switch it with an NFET\n
      \n
      The micro will see 0V or divided/clamped battery voltage on the measurement pin.
      """
    +lang: "en"
    +isAdult: false
    +favouriteCount: 3
    +score: 0
    +lastActive: DateTime @1692955883 {#1439
      date: 2023-08-25 11:31:23.0 +02:00
    }
    +ip: null
    +tags: null
    +mentions: [
      "@nilclass@discuss.tchncs.de"
    ]
    +children: Doctrine\ORM\PersistentCollection {#1579 …}
    +nested: Doctrine\ORM\PersistentCollection {#1577 …}
    +votes: Doctrine\ORM\PersistentCollection {#1578 …}
    +reports: Doctrine\ORM\PersistentCollection {#1571 …}
    +favourites: Doctrine\ORM\PersistentCollection {#1574 …}
    +notifications: Doctrine\ORM\PersistentCollection {#1667 …}
    -id: 26779
    -bodyTs: "'0v':70,117 '2':7 'add':30,62 'also':76 'anoth':63 'batteri':22,120 'clamp':100 'control':67 'could':1 'current':89 'default':45 'diagram':6 'diod':94 'divid':29,105 'divided/clamped':119 'ensur':39 'fet':14,19,41 'first':24 'gate':32,51 'higher':84 'instead':9,95,103 'limit':72,88 'll':58 'measur':56,124 'micro':48,114 'much':82,83 'n':13 'n-fet':12 'need':60 'nfet':112 'p':18 'p-fet':17 'pin':68,125 'potenti':28 'probabl':59 'pull':33,49 'realli':87 'resistor':25,35,64,98 'robust':107 'second':97 'see':116 'similar':4 'sourc':37 'switch':108 'take':54 'two':79 'use':15,91 'valu':85 'voltag':74,102,121 'zener/tvs':93"
    +ranking: 0
    +commentCount: 0
    +upVotes: 0
    +downVotes: 0
    +visibility: "visible             "
    +apId: "https://feddit.uk/comment/2185380"
    +editedAt: DateTimeImmutable @1692969047 {#1435
      date: 2023-08-25 15:10:47.0 +02:00
    }
    +createdAt: DateTimeImmutable @1692950595 {#1436
      date: 2023-08-25 10:03:15.0 +02:00
    }
    +"title": 26779
  }
  -cache: Symfony\Component\Cache\Adapter\TraceableTagAwareAdapter {#600 …}
}
entry_comment App\Twig\Components\EntryCommentComponent 12.0 MiB 6.24 ms
Input props
[
  "comment" => App\Entity\EntryComment {#1549
    +user: App\Entity\User {#265
      +avatar: null
      +cover: null
      +email: "Yonrak@feddit.uk"
      +username: "@Yonrak@feddit.uk"
      +roles: []
      +followersCount: 0
      +homepage: "front"
      +about: null
      +lastActive: DateTime @1692955883 {#275
        date: 2023-08-25 11:31:23.0 +02:00
      }
      +markedForDeletionAt: null
      +fields: null
      +oauthGithubId: null
      +oauthGoogleId: null
      +oauthFacebookId: null
      +oauthKeycloakId: null
      +hideAdult: true
      +showSubscribedUsers: true
      +showSubscribedMagazines: true
      +showSubscribedDomains: true
      +preferredLanguages: []
      +featuredMagazines: null
      +showProfileSubscriptions: false
      +showProfileFollowings: true
      +markNewComments: false
      +notifyOnNewEntry: false
      +notifyOnNewEntryReply: true
      +notifyOnNewEntryCommentReply: true
      +notifyOnNewPost: false
      +notifyOnNewPostReply: true
      +notifyOnNewPostCommentReply: true
      +addMentionsEntries: false
      +addMentionsPosts: true
      +isBanned: false
      +isVerified: false
      +isDeleted: false
      +isBot: false
      +spamProtection: true
      +customCss: null
      +ignoreMagazinesCustomCss: false
      +moderatorTokens: Doctrine\ORM\PersistentCollection {#253 …}
      +magazineOwnershipRequests: Doctrine\ORM\PersistentCollection {#249 …}
      +moderatorRequests: Doctrine\ORM\PersistentCollection {#238 …}
      +entries: Doctrine\ORM\PersistentCollection {#196 …}
      +entryVotes: Doctrine\ORM\PersistentCollection {#168 …}
      +entryComments: Doctrine\ORM\PersistentCollection {#141 …}
      +entryCommentVotes: Doctrine\ORM\PersistentCollection {#111 …}
      +posts: Doctrine\ORM\PersistentCollection {#84 …}
      +postVotes: Doctrine\ORM\PersistentCollection {#99 …}
      +postComments: Doctrine\ORM\PersistentCollection {#1863 …}
      +postCommentVotes: Doctrine\ORM\PersistentCollection {#1479 …}
      +subscriptions: Doctrine\ORM\PersistentCollection {#1658 …}
      +subscribedDomains: Doctrine\ORM\PersistentCollection {#1868 …}
      +follows: Doctrine\ORM\PersistentCollection {#1917 …}
      +followers: Doctrine\ORM\PersistentCollection {#1601 …}
      +blocks: Doctrine\ORM\PersistentCollection {#1805 …}
      +blockers: Doctrine\ORM\PersistentCollection {#1810 …}
      +blockedMagazines: Doctrine\ORM\PersistentCollection {#1857 …}
      +blockedDomains: Doctrine\ORM\PersistentCollection {#1860 …}
      +reports: Doctrine\ORM\PersistentCollection {#1791 …}
      +favourites: Doctrine\ORM\PersistentCollection {#2416 …}
      +violations: Doctrine\ORM\PersistentCollection {#1824 …}
      +notifications: Doctrine\ORM\PersistentCollection {#1914 …}
      +awards: Doctrine\ORM\PersistentCollection {#1929 …}
      +subscribedCategories: Doctrine\ORM\PersistentCollection {#1867 …}
      +categories: Doctrine\ORM\PersistentCollection {#1880 …}
      -id: 42482
      -password: "$2y$13$NhIMiF1JXctMkB.To0A1l.9Yf5tUWEmnsXRxLOIoPHjfEy4B2UkMe"
      -totpSecret: null
      -totpBackupCodes: []
      -oAuth2UserConsents: Doctrine\ORM\PersistentCollection {#1894 …}
      +apId: "Yonrak@feddit.uk"
      +apProfileId: "https://feddit.uk/u/Yonrak"
      +apPublicUrl: "https://feddit.uk/u/Yonrak"
      +apFollowersUrl: null
      +apInboxUrl: "https://feddit.uk/inbox"
      +apDomain: "feddit.uk"
      +apPreferredUsername: "Yonrak"
      +apDiscoverable: true
      +apManuallyApprovesFollowers: false
      +privateKey: null
      +publicKey: null
      +apFetchedAt: DateTime @1692955883 {#269
        date: 2023-08-25 11:31:23.0 +02:00
      }
      +apDeletedAt: null
      +apTimeoutAt: null
      +visibility: "visible             "
      +createdAt: DateTimeImmutable @1692950596 {#268
        date: 2023-08-25 10:03:16.0 +02:00
      }
    }
    +entry: Proxies\__CG__\App\Entity\Entry {#1591
      +user: Proxies\__CG__\App\Entity\User {#2459
        +avatar: null
        +cover: null
        +email: "nilclass@discuss.tchncs.de"
        +username: "@nilclass@discuss.tchncs.de"
        +roles: []
        +followersCount: 0
        +homepage: "front"
        +about: null
        +lastActive: DateTime @1721268563 {#3096
          date: 2024-07-18 04:09:23.0 +02:00
        }
        +markedForDeletionAt: null
        +fields: null
        +oauthGithubId: null
        +oauthGoogleId: null
        +oauthFacebookId: null
        +oauthKeycloakId: null
        +hideAdult: true
        +showSubscribedUsers: true
        +showSubscribedMagazines: true
        +showSubscribedDomains: true
        +preferredLanguages: []
        +featuredMagazines: null
        +showProfileSubscriptions: true
        +showProfileFollowings: true
        +markNewComments: false
        +notifyOnNewEntry: false
        +notifyOnNewEntryReply: false
        +notifyOnNewEntryCommentReply: false
        +notifyOnNewPost: false
        +notifyOnNewPostReply: false
        +notifyOnNewPostCommentReply: false
        +addMentionsEntries: false
        +addMentionsPosts: true
        +isBanned: false
        +isVerified: false
        +isDeleted: false
        +isBot: false
        +spamProtection: true
        +customCss: null
        +ignoreMagazinesCustomCss: false
        +moderatorTokens: Doctrine\ORM\PersistentCollection {#3099 …}
        +magazineOwnershipRequests: Doctrine\ORM\PersistentCollection {#3101 …}
        +moderatorRequests: Doctrine\ORM\PersistentCollection {#3103 …}
        +entries: Doctrine\ORM\PersistentCollection {#3105 …}
        +entryVotes: Doctrine\ORM\PersistentCollection {#3107 …}
        +entryComments: Doctrine\ORM\PersistentCollection {#3109 …}
        +entryCommentVotes: Doctrine\ORM\PersistentCollection {#3111 …}
        +posts: Doctrine\ORM\PersistentCollection {#3113 …}
        +postVotes: Doctrine\ORM\PersistentCollection {#3115 …}
        +postComments: Doctrine\ORM\PersistentCollection {#3117 …}
        +postCommentVotes: Doctrine\ORM\PersistentCollection {#3119 …}
        +subscriptions: Doctrine\ORM\PersistentCollection {#3121 …}
        +subscribedDomains: Doctrine\ORM\PersistentCollection {#3123 …}
        +follows: Doctrine\ORM\PersistentCollection {#3125 …}
        +followers: Doctrine\ORM\PersistentCollection {#3127 …}
        +blocks: Doctrine\ORM\PersistentCollection {#3129 …}
        +blockers: Doctrine\ORM\PersistentCollection {#3131 …}
        +blockedMagazines: Doctrine\ORM\PersistentCollection {#3133 …}
        +blockedDomains: Doctrine\ORM\PersistentCollection {#3135 …}
        +reports: Doctrine\ORM\PersistentCollection {#3137 …}
        +favourites: Doctrine\ORM\PersistentCollection {#3139 …}
        +violations: Doctrine\ORM\PersistentCollection {#3141 …}
        +notifications: Doctrine\ORM\PersistentCollection {#3143 …}
        +awards: Doctrine\ORM\PersistentCollection {#3145 …}
        +subscribedCategories: Doctrine\ORM\PersistentCollection {#3147 …}
        +categories: Doctrine\ORM\PersistentCollection {#3149 …}
        -id: 6046
        -password: "$2y$13$FEroXtR95mjA6.omogLZRe7NJuWUL6hb.9a/FfXkqyIPnPgg4Apme"
        -totpSecret: null
        -totpBackupCodes: []
        -oAuth2UserConsents: Doctrine\ORM\PersistentCollection {#3151 …}
        +apId: "nilclass@discuss.tchncs.de"
        +apProfileId: "https://discuss.tchncs.de/u/nilclass"
        +apPublicUrl: "https://discuss.tchncs.de/u/nilclass"
        +apFollowersUrl: null
        +apInboxUrl: "https://discuss.tchncs.de/inbox"
        +apDomain: "discuss.tchncs.de"
        +apPreferredUsername: "nilclass"
        +apDiscoverable: true
        +apManuallyApprovesFollowers: false
        +privateKey: null
        +publicKey: null
        +apFetchedAt: DateTime @1720630912 {#3097
          date: 2024-07-10 19:01:52.0 +02:00
        }
        +apDeletedAt: null
        +apTimeoutAt: null
        +visibility: "visible             "
        +createdAt: DateTimeImmutable @1687291240 {#3098
          date: 2023-06-20 22:00:40.0 +02:00
        }
        +__isInitialized__: true
         …2
      }
      +magazine: Proxies\__CG__\App\Entity\Magazine {#1584
        +icon: Proxies\__CG__\App\Entity\Image {#2886 …}
        +name: "askelectronics@discuss.tchncs.de"
        +title: "askelectronics"
        +description: """
          **For questions about component-level electronic circuits, tools and equipment.**\n
          \n
          Rules\n
          -----\n
          \n
          1: Be nice.\n
          \n
          2: Be on-topic (eg: *Electronic*, not *electrical*).\n
          \n
          3: No commercial stuff, buying, selling or valuations.\n
          \n
          4: Be safe.\n
          \n
          ---
          """
        +rules: null
        +subscriptionsCount: 1
        +entryCount: 154
        +entryCommentCount: 1230
        +postCount: 1
        +postCommentCount: 4
        +isAdult: false
        +customCss: null
        +lastActive: DateTime @1729413608 {#2865
          date: 2024-10-20 10:40:08.0 +02:00
        }
        +markedForDeletionAt: null
        +tags: null
        +moderators: Doctrine\ORM\PersistentCollection {#2885 …}
        +ownershipRequests: Doctrine\ORM\PersistentCollection {#2883 …}
        +moderatorRequests: Doctrine\ORM\PersistentCollection {#2888 …}
        +entries: Doctrine\ORM\PersistentCollection {#2889 …}
        +posts: Doctrine\ORM\PersistentCollection {#2892 …}
        +subscriptions: Doctrine\ORM\PersistentCollection {#2894 …}
        +bans: Doctrine\ORM\PersistentCollection {#2900 …}
        +reports: Doctrine\ORM\PersistentCollection {#2908 …}
        +badges: Doctrine\ORM\PersistentCollection {#2921 …}
        +logs: Doctrine\ORM\PersistentCollection {#2931 …}
        +awards: Doctrine\ORM\PersistentCollection {#2913 …}
        +categories: Doctrine\ORM\PersistentCollection {#2937 …}
        -id: 11
        +apId: "askelectronics@discuss.tchncs.de"
        +apProfileId: "https://discuss.tchncs.de/c/askelectronics"
        +apPublicUrl: "https://discuss.tchncs.de/c/askelectronics"
        +apFollowersUrl: "https://discuss.tchncs.de/c/askelectronics/followers"
        +apInboxUrl: "https://discuss.tchncs.de/inbox"
        +apDomain: "discuss.tchncs.de"
        +apPreferredUsername: "askelectronics"
        +apDiscoverable: true
        +apManuallyApprovesFollowers: null
        +privateKey: null
        +publicKey: null
        +apFetchedAt: DateTime @1727247714 {#2866
          date: 2024-09-25 09:01:54.0 +02:00
        }
        +apDeletedAt: null
        +apTimeoutAt: null
        +visibility: "visible             "
        +createdAt: DateTimeImmutable @1687144409 {#2867
          date: 2023-06-19 05:13:29.0 +02:00
        }
        +__isInitialized__: true
         …2
      }
      +image: null
      +domain: Proxies\__CG__\App\Entity\Domain {#1630 …}
      +slug: "How-to-improve-my-battery-measurement-circuit"
      +title: "How to improve my battery measurement circuit?"
      +url: null
      +body: """
        I am powering a 5V microcontroller (arduino clone, atmega328p) using a 9V block and a buck converter. Now I want to let the microcontroller occasionally measure the battery voltage, so I can get an idea of how full it is.\n
        \n
        My first idea was to use a simple voltage divider:\n
        \n
        ![](https://discuss.tchncs.de/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)\n
        \n
        I’ve chosen the resistor values so that:\n
        \n
        - the voltage at the measure output is `< 1.1V`, to be able to use the 1.1V internal reference of the atmega’s ADC\n
        - `R1 || R2 < 10kΩ`, since the atmega datasheet says “The ADC is optimized for analog signals with an output impedance of approximately 10 kΩ or less”\n
        \n
        This is great and all, but what bothers me is that this circuit will constantly draw ~100µA from the battery.\n
        \n
        So, my next thought was to add a mosfet to the divider, to switch it on only while measuring:\n
        \n
        ![](https://discuss.tchncs.de/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)\n
        \n
        This is obviously bad, because now when the mosfet is off, the ADC input sees the whole battery voltage.\n
        \n
        To address that issue, I’ve added a second mosfet into the measure path:\n
        \n
        ![](https://discuss.tchncs.de/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)\n
        \n
        This works, and it does not draw any current, except while measuring.\n
        \n
        However, it’s quite a few parts. So I’m curious if anyone has an idea how to do this with just a single mosfet. It seems to me like it should be possible, but I haven’t figured out how.\n
        \n
        Oh, and if I’m doing something stupid here, please tell me :)
        """
      +type: "article"
      +lang: "en"
      +isOc: false
      +hasEmbed: false
      +commentCount: 11
      +favouriteCount: 17
      +score: 0
      +isAdult: false
      +sticky: false
      +lastActive: DateTime @1694781042 {#1715
        date: 2023-09-15 14:30:42.0 +02:00
      }
      +ip: null
      +adaAmount: 0
      +tags: null
      +mentions: null
      +comments: Doctrine\ORM\PersistentCollection {#1629 …}
      +votes: Doctrine\ORM\PersistentCollection {#1626 …}
      +reports: Doctrine\ORM\PersistentCollection {#1625 …}
      +favourites: Doctrine\ORM\PersistentCollection {#2370 …}
      +notifications: Doctrine\ORM\PersistentCollection {#2371 …}
      +badges: Doctrine\ORM\PersistentCollection {#1708 …}
      +children: [
        1 => App\Entity\EntryComment {#1709
          +user: App\Entity\User {#265}
          +entry: Proxies\__CG__\App\Entity\Entry {#1591 …2}
          +magazine: Proxies\__CG__\App\Entity\Magazine {#1584 …2}
          +image: null
          +parent: null
          +root: null
          +body: """
            Could you do similar to diagram 2, but instead of an N-FET use a P-FET between the battery and first resistor in the potential divider?\n
            \n
            Add a gate pull up resistor to source to ensure the FET is off by default, have the micro pull the gate down to take a measurement. You’ll probably need to add another resistor on the control pin to 0V to limit the voltage there also, but those two can be much much higher values to really limit current. Or use a zener/TVS diode instead of second resistor to clamp the voltage instead of dividing (more robust).\n
            \n
            Switch it with an NFET\n
            \n
            The micro will see 0V or divided/clamped battery voltage on the measurement pin.
            """
          +lang: "en"
          +isAdult: false
          +favouriteCount: 3
          +score: 0
          +lastActive: DateTime @1692955883 {#1439
            date: 2023-08-25 11:31:23.0 +02:00
          }
          +ip: null
          +tags: null
          +mentions: [
            "@nilclass@discuss.tchncs.de"
          ]
          +children: Doctrine\ORM\PersistentCollection {#1579 …}
          +nested: Doctrine\ORM\PersistentCollection {#1577 …}
          +votes: Doctrine\ORM\PersistentCollection {#1578 …}
          +reports: Doctrine\ORM\PersistentCollection {#1571 …}
          +favourites: Doctrine\ORM\PersistentCollection {#1574 …}
          +notifications: Doctrine\ORM\PersistentCollection {#1667 …}
          -id: 26779
          -bodyTs: "'0v':70,117 '2':7 'add':30,62 'also':76 'anoth':63 'batteri':22,120 'clamp':100 'control':67 'could':1 'current':89 'default':45 'diagram':6 'diod':94 'divid':29,105 'divided/clamped':119 'ensur':39 'fet':14,19,41 'first':24 'gate':32,51 'higher':84 'instead':9,95,103 'limit':72,88 'll':58 'measur':56,124 'micro':48,114 'much':82,83 'n':13 'n-fet':12 'need':60 'nfet':112 'p':18 'p-fet':17 'pin':68,125 'potenti':28 'probabl':59 'pull':33,49 'realli':87 'resistor':25,35,64,98 'robust':107 'second':97 'see':116 'similar':4 'sourc':37 'switch':108 'take':54 'two':79 'use':15,91 'valu':85 'voltag':74,102,121 'zener/tvs':93"
          +ranking: 0
          +commentCount: 0
          +upVotes: 0
          +downVotes: 0
          +visibility: "visible             "
          +apId: "https://feddit.uk/comment/2185380"
          +editedAt: DateTimeImmutable @1692969047 {#1435
            date: 2023-08-25 15:10:47.0 +02:00
          }
          +createdAt: DateTimeImmutable @1692950595 {#1436
            date: 2023-08-25 10:03:15.0 +02:00
          }
          +"title": 26779
        }
        0 => App\Entity\EntryComment {#1549}
      ]
      -id: 1944
      -titleTs: "'batteri':5 'circuit':7 'improv':3 'measur':6"
      -bodyTs: "'/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)':152 '/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)':188 '/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)':53 '1.1':69,77 '10':107 '100µa':127 '10kω':88 '5v':5 '9v':12 'abl':73 'ad':178 'adc':85,95,165 'add':137 'address':173 'analog':99 'anyon':213 'approxim':106 'arduino':7 'atmega':83,91 'atmega328p':9 'bad':156 'batteri':28,130,170 'block':13 'bother':118 'buck':16 'chosen':56 'circuit':123 'clone':8 'constant':125 'convert':17 'curious':211 'current':197 'datasheet':92 'discuss.tchncs.de':52,151,187 'discuss.tchncs.de/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)':150 'discuss.tchncs.de/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)':186 'discuss.tchncs.de/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)':51 'divid':50,142 'draw':126,195 'except':198 'figur':239 'first':42 'full':38 'get':33 'great':113 'haven':237 'howev':201 'idea':35,43,216 'imped':104 'input':166 'intern':79 'issu':175 'kω':108 'less':110 'let':22 'like':230 'm':210,246 'measur':26,66,149,184,200 'microcontrol':6,24 'mosfet':139,161,181,225 'next':133 'obvious':155 'occasion':25 'oh':242 'optim':97 'output':67,103 'part':207 'path':185 'pleas':251 'possibl':234 'power':3 'quit':204 'r1':86 'r2':87 'refer':80 'resistor':58 'say':93 'second':180 'see':167 'seem':227 'signal':100 'simpl':48 'sinc':89 'singl':224 'someth':248 'stupid':249 'switch':144 'tell':252 'thought':134 'use':10,46,75 'v':70,78 'valu':59 've':55,177 'voltag':29,49,63,171 'want':20 'whole':169 'work':190"
      +cross: false
      +upVotes: 0
      +downVotes: 0
      +ranking: 1693029637
      +visibility: "visible             "
      +apId: "https://discuss.tchncs.de/post/2309537"
      +editedAt: DateTimeImmutable @1692947232 {#1693
        date: 2023-08-25 09:07:12.0 +02:00
      }
      +createdAt: DateTimeImmutable @1692947137 {#1740
        date: 2023-08-25 09:05:37.0 +02:00
      }
      +__isInitialized__: true
       …2
    }
    +magazine: Proxies\__CG__\App\Entity\Magazine {#1584 …2}
    +image: null
    +parent: Proxies\__CG__\App\Entity\EntryComment {#1692 …}
    +root: App\Entity\EntryComment {#1709}
    +body: """
      > Not sure I understand this point. Which resistor would you replace with a diode?\n
      \n
      Sorry, I think I was talking nonesense (doing this in my head and just woke up 😅).\n
      \n
      Not sure it’ll work with just a P-FET actually. You’ll likely need to control the PFET with a NFET, otherwise you still end up with too high a voltage on your control pin when the FET is off due to the gate pullup (unless you can use a fet with a very high Vgs Threshold and then drive it push/pull from the micro, but this isn’t really best practice).\n
      \n
      The above comment about diodes was to protect the microcontroller pin, but you end up not being able to control the FET doing it that way.\n
      \n
      I think either your existing Option 3 or PFET upstream of the divider, switched via an N-FET is the way to go.
      """
    +lang: "en"
    +isAdult: false
    +favouriteCount: 2
    +score: 0
    +lastActive: DateTime @1692955881 {#1673
      date: 2023-08-25 11:31:21.0 +02:00
    }
    +ip: null
    +tags: null
    +mentions: [
      "@nilclass@discuss.tchncs.de"
      "@Yonrak@feddit.uk"
    ]
    +children: Doctrine\ORM\PersistentCollection {#1691 …}
    +nested: Doctrine\ORM\PersistentCollection {#1680 …}
    +votes: Doctrine\ORM\PersistentCollection {#1683 …}
    +reports: Doctrine\ORM\PersistentCollection {#1702 …}
    +favourites: Doctrine\ORM\PersistentCollection {#1596 …}
    +notifications: Doctrine\ORM\PersistentCollection {#1613 …}
    -id: 26782
    -bodyTs: "'3':137 'abl':122 'actual':42 'best':103 'comment':107 'control':48,66,124 'diod':14,109 'divid':143 'drive':92 'due':73 'either':133 'end':57,118 'exist':135 'fet':41,70,83,126,149 'gate':76 'go':154 'head':26 'high':61,87 'isn':100 'like':45 'll':34,44 'micro':97 'microcontrol':114 'n':148 'n-fet':147 'need':46 'nfet':53 'nonesens':21 'option':136 'otherwis':54 'p':40 'p-fet':39 'pfet':50,139 'pin':67,115 'point':6 'practic':104 'protect':112 'pullup':77 'push/pull':94 'realli':102 'replac':11 'resistor':8 'sorri':15 'still':56 'sure':2,32 'switch':144 'talk':20 'think':17,132 'threshold':89 'understand':4 'unless':78 'upstream':140 'use':81 'vgs':88 'via':145 'voltag':63 'way':130,152 'woke':29 'work':35 'would':9"
    +ranking: 0
    +commentCount: 0
    +upVotes: 0
    +downVotes: 0
    +visibility: "visible             "
    +apId: "https://feddit.uk/comment/2186641"
    +editedAt: DateTimeImmutable @1692956099 {#1560
      date: 2023-08-25 11:34:59.0 +02:00
    }
    +createdAt: DateTimeImmutable @1692955881 {#1568
      date: 2023-08-25 11:31:21.0 +02:00
    }
    +"title": 26782
  }
  "showEntryTitle" => false
  "dateAsUrl" => true
  "showMagazineName" => false
]
Attributes
[]
Component
App\Twig\Components\EntryCommentComponent {#4383
  +comment: App\Entity\EntryComment {#1549
    +user: App\Entity\User {#265
      +avatar: null
      +cover: null
      +email: "Yonrak@feddit.uk"
      +username: "@Yonrak@feddit.uk"
      +roles: []
      +followersCount: 0
      +homepage: "front"
      +about: null
      +lastActive: DateTime @1692955883 {#275
        date: 2023-08-25 11:31:23.0 +02:00
      }
      +markedForDeletionAt: null
      +fields: null
      +oauthGithubId: null
      +oauthGoogleId: null
      +oauthFacebookId: null
      +oauthKeycloakId: null
      +hideAdult: true
      +showSubscribedUsers: true
      +showSubscribedMagazines: true
      +showSubscribedDomains: true
      +preferredLanguages: []
      +featuredMagazines: null
      +showProfileSubscriptions: false
      +showProfileFollowings: true
      +markNewComments: false
      +notifyOnNewEntry: false
      +notifyOnNewEntryReply: true
      +notifyOnNewEntryCommentReply: true
      +notifyOnNewPost: false
      +notifyOnNewPostReply: true
      +notifyOnNewPostCommentReply: true
      +addMentionsEntries: false
      +addMentionsPosts: true
      +isBanned: false
      +isVerified: false
      +isDeleted: false
      +isBot: false
      +spamProtection: true
      +customCss: null
      +ignoreMagazinesCustomCss: false
      +moderatorTokens: Doctrine\ORM\PersistentCollection {#253 …}
      +magazineOwnershipRequests: Doctrine\ORM\PersistentCollection {#249 …}
      +moderatorRequests: Doctrine\ORM\PersistentCollection {#238 …}
      +entries: Doctrine\ORM\PersistentCollection {#196 …}
      +entryVotes: Doctrine\ORM\PersistentCollection {#168 …}
      +entryComments: Doctrine\ORM\PersistentCollection {#141 …}
      +entryCommentVotes: Doctrine\ORM\PersistentCollection {#111 …}
      +posts: Doctrine\ORM\PersistentCollection {#84 …}
      +postVotes: Doctrine\ORM\PersistentCollection {#99 …}
      +postComments: Doctrine\ORM\PersistentCollection {#1863 …}
      +postCommentVotes: Doctrine\ORM\PersistentCollection {#1479 …}
      +subscriptions: Doctrine\ORM\PersistentCollection {#1658 …}
      +subscribedDomains: Doctrine\ORM\PersistentCollection {#1868 …}
      +follows: Doctrine\ORM\PersistentCollection {#1917 …}
      +followers: Doctrine\ORM\PersistentCollection {#1601 …}
      +blocks: Doctrine\ORM\PersistentCollection {#1805 …}
      +blockers: Doctrine\ORM\PersistentCollection {#1810 …}
      +blockedMagazines: Doctrine\ORM\PersistentCollection {#1857 …}
      +blockedDomains: Doctrine\ORM\PersistentCollection {#1860 …}
      +reports: Doctrine\ORM\PersistentCollection {#1791 …}
      +favourites: Doctrine\ORM\PersistentCollection {#2416 …}
      +violations: Doctrine\ORM\PersistentCollection {#1824 …}
      +notifications: Doctrine\ORM\PersistentCollection {#1914 …}
      +awards: Doctrine\ORM\PersistentCollection {#1929 …}
      +subscribedCategories: Doctrine\ORM\PersistentCollection {#1867 …}
      +categories: Doctrine\ORM\PersistentCollection {#1880 …}
      -id: 42482
      -password: "$2y$13$NhIMiF1JXctMkB.To0A1l.9Yf5tUWEmnsXRxLOIoPHjfEy4B2UkMe"
      -totpSecret: null
      -totpBackupCodes: []
      -oAuth2UserConsents: Doctrine\ORM\PersistentCollection {#1894 …}
      +apId: "Yonrak@feddit.uk"
      +apProfileId: "https://feddit.uk/u/Yonrak"
      +apPublicUrl: "https://feddit.uk/u/Yonrak"
      +apFollowersUrl: null
      +apInboxUrl: "https://feddit.uk/inbox"
      +apDomain: "feddit.uk"
      +apPreferredUsername: "Yonrak"
      +apDiscoverable: true
      +apManuallyApprovesFollowers: false
      +privateKey: null
      +publicKey: null
      +apFetchedAt: DateTime @1692955883 {#269
        date: 2023-08-25 11:31:23.0 +02:00
      }
      +apDeletedAt: null
      +apTimeoutAt: null
      +visibility: "visible             "
      +createdAt: DateTimeImmutable @1692950596 {#268
        date: 2023-08-25 10:03:16.0 +02:00
      }
    }
    +entry: Proxies\__CG__\App\Entity\Entry {#1591
      +user: Proxies\__CG__\App\Entity\User {#2459
        +avatar: null
        +cover: null
        +email: "nilclass@discuss.tchncs.de"
        +username: "@nilclass@discuss.tchncs.de"
        +roles: []
        +followersCount: 0
        +homepage: "front"
        +about: null
        +lastActive: DateTime @1721268563 {#3096
          date: 2024-07-18 04:09:23.0 +02:00
        }
        +markedForDeletionAt: null
        +fields: null
        +oauthGithubId: null
        +oauthGoogleId: null
        +oauthFacebookId: null
        +oauthKeycloakId: null
        +hideAdult: true
        +showSubscribedUsers: true
        +showSubscribedMagazines: true
        +showSubscribedDomains: true
        +preferredLanguages: []
        +featuredMagazines: null
        +showProfileSubscriptions: true
        +showProfileFollowings: true
        +markNewComments: false
        +notifyOnNewEntry: false
        +notifyOnNewEntryReply: false
        +notifyOnNewEntryCommentReply: false
        +notifyOnNewPost: false
        +notifyOnNewPostReply: false
        +notifyOnNewPostCommentReply: false
        +addMentionsEntries: false
        +addMentionsPosts: true
        +isBanned: false
        +isVerified: false
        +isDeleted: false
        +isBot: false
        +spamProtection: true
        +customCss: null
        +ignoreMagazinesCustomCss: false
        +moderatorTokens: Doctrine\ORM\PersistentCollection {#3099 …}
        +magazineOwnershipRequests: Doctrine\ORM\PersistentCollection {#3101 …}
        +moderatorRequests: Doctrine\ORM\PersistentCollection {#3103 …}
        +entries: Doctrine\ORM\PersistentCollection {#3105 …}
        +entryVotes: Doctrine\ORM\PersistentCollection {#3107 …}
        +entryComments: Doctrine\ORM\PersistentCollection {#3109 …}
        +entryCommentVotes: Doctrine\ORM\PersistentCollection {#3111 …}
        +posts: Doctrine\ORM\PersistentCollection {#3113 …}
        +postVotes: Doctrine\ORM\PersistentCollection {#3115 …}
        +postComments: Doctrine\ORM\PersistentCollection {#3117 …}
        +postCommentVotes: Doctrine\ORM\PersistentCollection {#3119 …}
        +subscriptions: Doctrine\ORM\PersistentCollection {#3121 …}
        +subscribedDomains: Doctrine\ORM\PersistentCollection {#3123 …}
        +follows: Doctrine\ORM\PersistentCollection {#3125 …}
        +followers: Doctrine\ORM\PersistentCollection {#3127 …}
        +blocks: Doctrine\ORM\PersistentCollection {#3129 …}
        +blockers: Doctrine\ORM\PersistentCollection {#3131 …}
        +blockedMagazines: Doctrine\ORM\PersistentCollection {#3133 …}
        +blockedDomains: Doctrine\ORM\PersistentCollection {#3135 …}
        +reports: Doctrine\ORM\PersistentCollection {#3137 …}
        +favourites: Doctrine\ORM\PersistentCollection {#3139 …}
        +violations: Doctrine\ORM\PersistentCollection {#3141 …}
        +notifications: Doctrine\ORM\PersistentCollection {#3143 …}
        +awards: Doctrine\ORM\PersistentCollection {#3145 …}
        +subscribedCategories: Doctrine\ORM\PersistentCollection {#3147 …}
        +categories: Doctrine\ORM\PersistentCollection {#3149 …}
        -id: 6046
        -password: "$2y$13$FEroXtR95mjA6.omogLZRe7NJuWUL6hb.9a/FfXkqyIPnPgg4Apme"
        -totpSecret: null
        -totpBackupCodes: []
        -oAuth2UserConsents: Doctrine\ORM\PersistentCollection {#3151 …}
        +apId: "nilclass@discuss.tchncs.de"
        +apProfileId: "https://discuss.tchncs.de/u/nilclass"
        +apPublicUrl: "https://discuss.tchncs.de/u/nilclass"
        +apFollowersUrl: null
        +apInboxUrl: "https://discuss.tchncs.de/inbox"
        +apDomain: "discuss.tchncs.de"
        +apPreferredUsername: "nilclass"
        +apDiscoverable: true
        +apManuallyApprovesFollowers: false
        +privateKey: null
        +publicKey: null
        +apFetchedAt: DateTime @1720630912 {#3097
          date: 2024-07-10 19:01:52.0 +02:00
        }
        +apDeletedAt: null
        +apTimeoutAt: null
        +visibility: "visible             "
        +createdAt: DateTimeImmutable @1687291240 {#3098
          date: 2023-06-20 22:00:40.0 +02:00
        }
        +__isInitialized__: true
         …2
      }
      +magazine: Proxies\__CG__\App\Entity\Magazine {#1584
        +icon: Proxies\__CG__\App\Entity\Image {#2886 …}
        +name: "askelectronics@discuss.tchncs.de"
        +title: "askelectronics"
        +description: """
          **For questions about component-level electronic circuits, tools and equipment.**\n
          \n
          Rules\n
          -----\n
          \n
          1: Be nice.\n
          \n
          2: Be on-topic (eg: *Electronic*, not *electrical*).\n
          \n
          3: No commercial stuff, buying, selling or valuations.\n
          \n
          4: Be safe.\n
          \n
          ---
          """
        +rules: null
        +subscriptionsCount: 1
        +entryCount: 154
        +entryCommentCount: 1230
        +postCount: 1
        +postCommentCount: 4
        +isAdult: false
        +customCss: null
        +lastActive: DateTime @1729413608 {#2865
          date: 2024-10-20 10:40:08.0 +02:00
        }
        +markedForDeletionAt: null
        +tags: null
        +moderators: Doctrine\ORM\PersistentCollection {#2885 …}
        +ownershipRequests: Doctrine\ORM\PersistentCollection {#2883 …}
        +moderatorRequests: Doctrine\ORM\PersistentCollection {#2888 …}
        +entries: Doctrine\ORM\PersistentCollection {#2889 …}
        +posts: Doctrine\ORM\PersistentCollection {#2892 …}
        +subscriptions: Doctrine\ORM\PersistentCollection {#2894 …}
        +bans: Doctrine\ORM\PersistentCollection {#2900 …}
        +reports: Doctrine\ORM\PersistentCollection {#2908 …}
        +badges: Doctrine\ORM\PersistentCollection {#2921 …}
        +logs: Doctrine\ORM\PersistentCollection {#2931 …}
        +awards: Doctrine\ORM\PersistentCollection {#2913 …}
        +categories: Doctrine\ORM\PersistentCollection {#2937 …}
        -id: 11
        +apId: "askelectronics@discuss.tchncs.de"
        +apProfileId: "https://discuss.tchncs.de/c/askelectronics"
        +apPublicUrl: "https://discuss.tchncs.de/c/askelectronics"
        +apFollowersUrl: "https://discuss.tchncs.de/c/askelectronics/followers"
        +apInboxUrl: "https://discuss.tchncs.de/inbox"
        +apDomain: "discuss.tchncs.de"
        +apPreferredUsername: "askelectronics"
        +apDiscoverable: true
        +apManuallyApprovesFollowers: null
        +privateKey: null
        +publicKey: null
        +apFetchedAt: DateTime @1727247714 {#2866
          date: 2024-09-25 09:01:54.0 +02:00
        }
        +apDeletedAt: null
        +apTimeoutAt: null
        +visibility: "visible             "
        +createdAt: DateTimeImmutable @1687144409 {#2867
          date: 2023-06-19 05:13:29.0 +02:00
        }
        +__isInitialized__: true
         …2
      }
      +image: null
      +domain: Proxies\__CG__\App\Entity\Domain {#1630 …}
      +slug: "How-to-improve-my-battery-measurement-circuit"
      +title: "How to improve my battery measurement circuit?"
      +url: null
      +body: """
        I am powering a 5V microcontroller (arduino clone, atmega328p) using a 9V block and a buck converter. Now I want to let the microcontroller occasionally measure the battery voltage, so I can get an idea of how full it is.\n
        \n
        My first idea was to use a simple voltage divider:\n
        \n
        ![](https://discuss.tchncs.de/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)\n
        \n
        I’ve chosen the resistor values so that:\n
        \n
        - the voltage at the measure output is `< 1.1V`, to be able to use the 1.1V internal reference of the atmega’s ADC\n
        - `R1 || R2 < 10kΩ`, since the atmega datasheet says “The ADC is optimized for analog signals with an output impedance of approximately 10 kΩ or less”\n
        \n
        This is great and all, but what bothers me is that this circuit will constantly draw ~100µA from the battery.\n
        \n
        So, my next thought was to add a mosfet to the divider, to switch it on only while measuring:\n
        \n
        ![](https://discuss.tchncs.de/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)\n
        \n
        This is obviously bad, because now when the mosfet is off, the ADC input sees the whole battery voltage.\n
        \n
        To address that issue, I’ve added a second mosfet into the measure path:\n
        \n
        ![](https://discuss.tchncs.de/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)\n
        \n
        This works, and it does not draw any current, except while measuring.\n
        \n
        However, it’s quite a few parts. So I’m curious if anyone has an idea how to do this with just a single mosfet. It seems to me like it should be possible, but I haven’t figured out how.\n
        \n
        Oh, and if I’m doing something stupid here, please tell me :)
        """
      +type: "article"
      +lang: "en"
      +isOc: false
      +hasEmbed: false
      +commentCount: 11
      +favouriteCount: 17
      +score: 0
      +isAdult: false
      +sticky: false
      +lastActive: DateTime @1694781042 {#1715
        date: 2023-09-15 14:30:42.0 +02:00
      }
      +ip: null
      +adaAmount: 0
      +tags: null
      +mentions: null
      +comments: Doctrine\ORM\PersistentCollection {#1629 …}
      +votes: Doctrine\ORM\PersistentCollection {#1626 …}
      +reports: Doctrine\ORM\PersistentCollection {#1625 …}
      +favourites: Doctrine\ORM\PersistentCollection {#2370 …}
      +notifications: Doctrine\ORM\PersistentCollection {#2371 …}
      +badges: Doctrine\ORM\PersistentCollection {#1708 …}
      +children: [
        1 => App\Entity\EntryComment {#1709
          +user: App\Entity\User {#265}
          +entry: Proxies\__CG__\App\Entity\Entry {#1591 …2}
          +magazine: Proxies\__CG__\App\Entity\Magazine {#1584 …2}
          +image: null
          +parent: null
          +root: null
          +body: """
            Could you do similar to diagram 2, but instead of an N-FET use a P-FET between the battery and first resistor in the potential divider?\n
            \n
            Add a gate pull up resistor to source to ensure the FET is off by default, have the micro pull the gate down to take a measurement. You’ll probably need to add another resistor on the control pin to 0V to limit the voltage there also, but those two can be much much higher values to really limit current. Or use a zener/TVS diode instead of second resistor to clamp the voltage instead of dividing (more robust).\n
            \n
            Switch it with an NFET\n
            \n
            The micro will see 0V or divided/clamped battery voltage on the measurement pin.
            """
          +lang: "en"
          +isAdult: false
          +favouriteCount: 3
          +score: 0
          +lastActive: DateTime @1692955883 {#1439
            date: 2023-08-25 11:31:23.0 +02:00
          }
          +ip: null
          +tags: null
          +mentions: [
            "@nilclass@discuss.tchncs.de"
          ]
          +children: Doctrine\ORM\PersistentCollection {#1579 …}
          +nested: Doctrine\ORM\PersistentCollection {#1577 …}
          +votes: Doctrine\ORM\PersistentCollection {#1578 …}
          +reports: Doctrine\ORM\PersistentCollection {#1571 …}
          +favourites: Doctrine\ORM\PersistentCollection {#1574 …}
          +notifications: Doctrine\ORM\PersistentCollection {#1667 …}
          -id: 26779
          -bodyTs: "'0v':70,117 '2':7 'add':30,62 'also':76 'anoth':63 'batteri':22,120 'clamp':100 'control':67 'could':1 'current':89 'default':45 'diagram':6 'diod':94 'divid':29,105 'divided/clamped':119 'ensur':39 'fet':14,19,41 'first':24 'gate':32,51 'higher':84 'instead':9,95,103 'limit':72,88 'll':58 'measur':56,124 'micro':48,114 'much':82,83 'n':13 'n-fet':12 'need':60 'nfet':112 'p':18 'p-fet':17 'pin':68,125 'potenti':28 'probabl':59 'pull':33,49 'realli':87 'resistor':25,35,64,98 'robust':107 'second':97 'see':116 'similar':4 'sourc':37 'switch':108 'take':54 'two':79 'use':15,91 'valu':85 'voltag':74,102,121 'zener/tvs':93"
          +ranking: 0
          +commentCount: 0
          +upVotes: 0
          +downVotes: 0
          +visibility: "visible             "
          +apId: "https://feddit.uk/comment/2185380"
          +editedAt: DateTimeImmutable @1692969047 {#1435
            date: 2023-08-25 15:10:47.0 +02:00
          }
          +createdAt: DateTimeImmutable @1692950595 {#1436
            date: 2023-08-25 10:03:15.0 +02:00
          }
          +"title": 26779
        }
        0 => App\Entity\EntryComment {#1549}
      ]
      -id: 1944
      -titleTs: "'batteri':5 'circuit':7 'improv':3 'measur':6"
      -bodyTs: "'/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)':152 '/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)':188 '/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)':53 '1.1':69,77 '10':107 '100µa':127 '10kω':88 '5v':5 '9v':12 'abl':73 'ad':178 'adc':85,95,165 'add':137 'address':173 'analog':99 'anyon':213 'approxim':106 'arduino':7 'atmega':83,91 'atmega328p':9 'bad':156 'batteri':28,130,170 'block':13 'bother':118 'buck':16 'chosen':56 'circuit':123 'clone':8 'constant':125 'convert':17 'curious':211 'current':197 'datasheet':92 'discuss.tchncs.de':52,151,187 'discuss.tchncs.de/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)':150 'discuss.tchncs.de/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)':186 'discuss.tchncs.de/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)':51 'divid':50,142 'draw':126,195 'except':198 'figur':239 'first':42 'full':38 'get':33 'great':113 'haven':237 'howev':201 'idea':35,43,216 'imped':104 'input':166 'intern':79 'issu':175 'kω':108 'less':110 'let':22 'like':230 'm':210,246 'measur':26,66,149,184,200 'microcontrol':6,24 'mosfet':139,161,181,225 'next':133 'obvious':155 'occasion':25 'oh':242 'optim':97 'output':67,103 'part':207 'path':185 'pleas':251 'possibl':234 'power':3 'quit':204 'r1':86 'r2':87 'refer':80 'resistor':58 'say':93 'second':180 'see':167 'seem':227 'signal':100 'simpl':48 'sinc':89 'singl':224 'someth':248 'stupid':249 'switch':144 'tell':252 'thought':134 'use':10,46,75 'v':70,78 'valu':59 've':55,177 'voltag':29,49,63,171 'want':20 'whole':169 'work':190"
      +cross: false
      +upVotes: 0
      +downVotes: 0
      +ranking: 1693029637
      +visibility: "visible             "
      +apId: "https://discuss.tchncs.de/post/2309537"
      +editedAt: DateTimeImmutable @1692947232 {#1693
        date: 2023-08-25 09:07:12.0 +02:00
      }
      +createdAt: DateTimeImmutable @1692947137 {#1740
        date: 2023-08-25 09:05:37.0 +02:00
      }
      +__isInitialized__: true
       …2
    }
    +magazine: Proxies\__CG__\App\Entity\Magazine {#1584 …2}
    +image: null
    +parent: Proxies\__CG__\App\Entity\EntryComment {#1692 …}
    +root: App\Entity\EntryComment {#1709}
    +body: """
      > Not sure I understand this point. Which resistor would you replace with a diode?\n
      \n
      Sorry, I think I was talking nonesense (doing this in my head and just woke up 😅).\n
      \n
      Not sure it’ll work with just a P-FET actually. You’ll likely need to control the PFET with a NFET, otherwise you still end up with too high a voltage on your control pin when the FET is off due to the gate pullup (unless you can use a fet with a very high Vgs Threshold and then drive it push/pull from the micro, but this isn’t really best practice).\n
      \n
      The above comment about diodes was to protect the microcontroller pin, but you end up not being able to control the FET doing it that way.\n
      \n
      I think either your existing Option 3 or PFET upstream of the divider, switched via an N-FET is the way to go.
      """
    +lang: "en"
    +isAdult: false
    +favouriteCount: 2
    +score: 0
    +lastActive: DateTime @1692955881 {#1673
      date: 2023-08-25 11:31:21.0 +02:00
    }
    +ip: null
    +tags: null
    +mentions: [
      "@nilclass@discuss.tchncs.de"
      "@Yonrak@feddit.uk"
    ]
    +children: Doctrine\ORM\PersistentCollection {#1691 …}
    +nested: Doctrine\ORM\PersistentCollection {#1680 …}
    +votes: Doctrine\ORM\PersistentCollection {#1683 …}
    +reports: Doctrine\ORM\PersistentCollection {#1702 …}
    +favourites: Doctrine\ORM\PersistentCollection {#1596 …}
    +notifications: Doctrine\ORM\PersistentCollection {#1613 …}
    -id: 26782
    -bodyTs: "'3':137 'abl':122 'actual':42 'best':103 'comment':107 'control':48,66,124 'diod':14,109 'divid':143 'drive':92 'due':73 'either':133 'end':57,118 'exist':135 'fet':41,70,83,126,149 'gate':76 'go':154 'head':26 'high':61,87 'isn':100 'like':45 'll':34,44 'micro':97 'microcontrol':114 'n':148 'n-fet':147 'need':46 'nfet':53 'nonesens':21 'option':136 'otherwis':54 'p':40 'p-fet':39 'pfet':50,139 'pin':67,115 'point':6 'practic':104 'protect':112 'pullup':77 'push/pull':94 'realli':102 'replac':11 'resistor':8 'sorri':15 'still':56 'sure':2,32 'switch':144 'talk':20 'think':17,132 'threshold':89 'understand':4 'unless':78 'upstream':140 'use':81 'vgs':88 'via':145 'voltag':63 'way':130,152 'woke':29 'work':35 'would':9"
    +ranking: 0
    +commentCount: 0
    +upVotes: 0
    +downVotes: 0
    +visibility: "visible             "
    +apId: "https://feddit.uk/comment/2186641"
    +editedAt: DateTimeImmutable @1692956099 {#1560
      date: 2023-08-25 11:34:59.0 +02:00
    }
    +createdAt: DateTimeImmutable @1692955881 {#1568
      date: 2023-08-25 11:31:21.0 +02:00
    }
    +"title": 26782
  }
  +showMagazineName: false
  +showEntryTitle: false
  +showNested: false
  +level: 1
  +canSeeTrash: false
  +dateAsUrl: true
  -requestStack: Symfony\Component\HttpFoundation\RequestStack {#1328 …}
  -authorizationChecker: Symfony\Component\Security\Core\Authorization\AuthorizationChecker {#931 …}
}
user_inline App\Twig\Components\UserInlineComponent 12.0 MiB 0.16 ms
Input props
[
  "user" => App\Entity\User {#265
    +avatar: null
    +cover: null
    +email: "Yonrak@feddit.uk"
    +username: "@Yonrak@feddit.uk"
    +roles: []
    +followersCount: 0
    +homepage: "front"
    +about: null
    +lastActive: DateTime @1692955883 {#275
      date: 2023-08-25 11:31:23.0 +02:00
    }
    +markedForDeletionAt: null
    +fields: null
    +oauthGithubId: null
    +oauthGoogleId: null
    +oauthFacebookId: null
    +oauthKeycloakId: null
    +hideAdult: true
    +showSubscribedUsers: true
    +showSubscribedMagazines: true
    +showSubscribedDomains: true
    +preferredLanguages: []
    +featuredMagazines: null
    +showProfileSubscriptions: false
    +showProfileFollowings: true
    +markNewComments: false
    +notifyOnNewEntry: false
    +notifyOnNewEntryReply: true
    +notifyOnNewEntryCommentReply: true
    +notifyOnNewPost: false
    +notifyOnNewPostReply: true
    +notifyOnNewPostCommentReply: true
    +addMentionsEntries: false
    +addMentionsPosts: true
    +isBanned: false
    +isVerified: false
    +isDeleted: false
    +isBot: false
    +spamProtection: true
    +customCss: null
    +ignoreMagazinesCustomCss: false
    +moderatorTokens: Doctrine\ORM\PersistentCollection {#253 …}
    +magazineOwnershipRequests: Doctrine\ORM\PersistentCollection {#249 …}
    +moderatorRequests: Doctrine\ORM\PersistentCollection {#238 …}
    +entries: Doctrine\ORM\PersistentCollection {#196 …}
    +entryVotes: Doctrine\ORM\PersistentCollection {#168 …}
    +entryComments: Doctrine\ORM\PersistentCollection {#141 …}
    +entryCommentVotes: Doctrine\ORM\PersistentCollection {#111 …}
    +posts: Doctrine\ORM\PersistentCollection {#84 …}
    +postVotes: Doctrine\ORM\PersistentCollection {#99 …}
    +postComments: Doctrine\ORM\PersistentCollection {#1863 …}
    +postCommentVotes: Doctrine\ORM\PersistentCollection {#1479 …}
    +subscriptions: Doctrine\ORM\PersistentCollection {#1658 …}
    +subscribedDomains: Doctrine\ORM\PersistentCollection {#1868 …}
    +follows: Doctrine\ORM\PersistentCollection {#1917 …}
    +followers: Doctrine\ORM\PersistentCollection {#1601 …}
    +blocks: Doctrine\ORM\PersistentCollection {#1805 …}
    +blockers: Doctrine\ORM\PersistentCollection {#1810 …}
    +blockedMagazines: Doctrine\ORM\PersistentCollection {#1857 …}
    +blockedDomains: Doctrine\ORM\PersistentCollection {#1860 …}
    +reports: Doctrine\ORM\PersistentCollection {#1791 …}
    +favourites: Doctrine\ORM\PersistentCollection {#2416 …}
    +violations: Doctrine\ORM\PersistentCollection {#1824 …}
    +notifications: Doctrine\ORM\PersistentCollection {#1914 …}
    +awards: Doctrine\ORM\PersistentCollection {#1929 …}
    +subscribedCategories: Doctrine\ORM\PersistentCollection {#1867 …}
    +categories: Doctrine\ORM\PersistentCollection {#1880 …}
    -id: 42482
    -password: "$2y$13$NhIMiF1JXctMkB.To0A1l.9Yf5tUWEmnsXRxLOIoPHjfEy4B2UkMe"
    -totpSecret: null
    -totpBackupCodes: []
    -oAuth2UserConsents: Doctrine\ORM\PersistentCollection {#1894 …}
    +apId: "Yonrak@feddit.uk"
    +apProfileId: "https://feddit.uk/u/Yonrak"
    +apPublicUrl: "https://feddit.uk/u/Yonrak"
    +apFollowersUrl: null
    +apInboxUrl: "https://feddit.uk/inbox"
    +apDomain: "feddit.uk"
    +apPreferredUsername: "Yonrak"
    +apDiscoverable: true
    +apManuallyApprovesFollowers: false
    +privateKey: null
    +publicKey: null
    +apFetchedAt: DateTime @1692955883 {#269
      date: 2023-08-25 11:31:23.0 +02:00
    }
    +apDeletedAt: null
    +apTimeoutAt: null
    +visibility: "visible             "
    +createdAt: DateTimeImmutable @1692950596 {#268
      date: 2023-08-25 10:03:16.0 +02:00
    }
  }
  "showAvatar" => false
]
Attributes
[]
Component
App\Twig\Components\UserInlineComponent {#4428
  +user: App\Entity\User {#265
    +avatar: null
    +cover: null
    +email: "Yonrak@feddit.uk"
    +username: "@Yonrak@feddit.uk"
    +roles: []
    +followersCount: 0
    +homepage: "front"
    +about: null
    +lastActive: DateTime @1692955883 {#275
      date: 2023-08-25 11:31:23.0 +02:00
    }
    +markedForDeletionAt: null
    +fields: null
    +oauthGithubId: null
    +oauthGoogleId: null
    +oauthFacebookId: null
    +oauthKeycloakId: null
    +hideAdult: true
    +showSubscribedUsers: true
    +showSubscribedMagazines: true
    +showSubscribedDomains: true
    +preferredLanguages: []
    +featuredMagazines: null
    +showProfileSubscriptions: false
    +showProfileFollowings: true
    +markNewComments: false
    +notifyOnNewEntry: false
    +notifyOnNewEntryReply: true
    +notifyOnNewEntryCommentReply: true
    +notifyOnNewPost: false
    +notifyOnNewPostReply: true
    +notifyOnNewPostCommentReply: true
    +addMentionsEntries: false
    +addMentionsPosts: true
    +isBanned: false
    +isVerified: false
    +isDeleted: false
    +isBot: false
    +spamProtection: true
    +customCss: null
    +ignoreMagazinesCustomCss: false
    +moderatorTokens: Doctrine\ORM\PersistentCollection {#253 …}
    +magazineOwnershipRequests: Doctrine\ORM\PersistentCollection {#249 …}
    +moderatorRequests: Doctrine\ORM\PersistentCollection {#238 …}
    +entries: Doctrine\ORM\PersistentCollection {#196 …}
    +entryVotes: Doctrine\ORM\PersistentCollection {#168 …}
    +entryComments: Doctrine\ORM\PersistentCollection {#141 …}
    +entryCommentVotes: Doctrine\ORM\PersistentCollection {#111 …}
    +posts: Doctrine\ORM\PersistentCollection {#84 …}
    +postVotes: Doctrine\ORM\PersistentCollection {#99 …}
    +postComments: Doctrine\ORM\PersistentCollection {#1863 …}
    +postCommentVotes: Doctrine\ORM\PersistentCollection {#1479 …}
    +subscriptions: Doctrine\ORM\PersistentCollection {#1658 …}
    +subscribedDomains: Doctrine\ORM\PersistentCollection {#1868 …}
    +follows: Doctrine\ORM\PersistentCollection {#1917 …}
    +followers: Doctrine\ORM\PersistentCollection {#1601 …}
    +blocks: Doctrine\ORM\PersistentCollection {#1805 …}
    +blockers: Doctrine\ORM\PersistentCollection {#1810 …}
    +blockedMagazines: Doctrine\ORM\PersistentCollection {#1857 …}
    +blockedDomains: Doctrine\ORM\PersistentCollection {#1860 …}
    +reports: Doctrine\ORM\PersistentCollection {#1791 …}
    +favourites: Doctrine\ORM\PersistentCollection {#2416 …}
    +violations: Doctrine\ORM\PersistentCollection {#1824 …}
    +notifications: Doctrine\ORM\PersistentCollection {#1914 …}
    +awards: Doctrine\ORM\PersistentCollection {#1929 …}
    +subscribedCategories: Doctrine\ORM\PersistentCollection {#1867 …}
    +categories: Doctrine\ORM\PersistentCollection {#1880 …}
    -id: 42482
    -password: "$2y$13$NhIMiF1JXctMkB.To0A1l.9Yf5tUWEmnsXRxLOIoPHjfEy4B2UkMe"
    -totpSecret: null
    -totpBackupCodes: []
    -oAuth2UserConsents: Doctrine\ORM\PersistentCollection {#1894 …}
    +apId: "Yonrak@feddit.uk"
    +apProfileId: "https://feddit.uk/u/Yonrak"
    +apPublicUrl: "https://feddit.uk/u/Yonrak"
    +apFollowersUrl: null
    +apInboxUrl: "https://feddit.uk/inbox"
    +apDomain: "feddit.uk"
    +apPreferredUsername: "Yonrak"
    +apDiscoverable: true
    +apManuallyApprovesFollowers: false
    +privateKey: null
    +publicKey: null
    +apFetchedAt: DateTime @1692955883 {#269
      date: 2023-08-25 11:31:23.0 +02:00
    }
    +apDeletedAt: null
    +apTimeoutAt: null
    +visibility: "visible             "
    +createdAt: DateTimeImmutable @1692950596 {#268
      date: 2023-08-25 10:03:16.0 +02:00
    }
  }
  +showAvatar: false
}
date App\Twig\Components\DateComponent 12.0 MiB 0.16 ms
Input props
[
  "date" => DateTimeImmutable @1692955881 {#1568
    date: 2023-08-25 11:31:21.0 +02:00
  }
]
Attributes
[]
Component
App\Twig\Components\DateComponent {#4484
  +date: DateTimeImmutable @1692955881 {#1568
    date: 2023-08-25 11:31:21.0 +02:00
  }
}
date_edited App\Twig\Components\DateEditedComponent 12.0 MiB 0.11 ms
Input props
[
  "createdAt" => DateTimeImmutable @1692955881 {#1568
    date: 2023-08-25 11:31:21.0 +02:00
  }
  "editedAt" => DateTimeImmutable @1692956099 {#1560
    date: 2023-08-25 11:34:59.0 +02:00
  }
]
Attributes
[]
Component
App\Twig\Components\DateEditedComponent {#4538
  +createdAt: DateTimeImmutable @1692955881 {#1568
    date: 2023-08-25 11:31:21.0 +02:00
  }
  +editedAt: DateTimeImmutable @1692956099 {#1560
    date: 2023-08-25 11:34:59.0 +02:00
  }
}
user_avatar App\Twig\Components\UserAvatarComponent 12.0 MiB 0.15 ms
Input props
[
  "user" => App\Entity\User {#265
    +avatar: null
    +cover: null
    +email: "Yonrak@feddit.uk"
    +username: "@Yonrak@feddit.uk"
    +roles: []
    +followersCount: 0
    +homepage: "front"
    +about: null
    +lastActive: DateTime @1692955883 {#275
      date: 2023-08-25 11:31:23.0 +02:00
    }
    +markedForDeletionAt: null
    +fields: null
    +oauthGithubId: null
    +oauthGoogleId: null
    +oauthFacebookId: null
    +oauthKeycloakId: null
    +hideAdult: true
    +showSubscribedUsers: true
    +showSubscribedMagazines: true
    +showSubscribedDomains: true
    +preferredLanguages: []
    +featuredMagazines: null
    +showProfileSubscriptions: false
    +showProfileFollowings: true
    +markNewComments: false
    +notifyOnNewEntry: false
    +notifyOnNewEntryReply: true
    +notifyOnNewEntryCommentReply: true
    +notifyOnNewPost: false
    +notifyOnNewPostReply: true
    +notifyOnNewPostCommentReply: true
    +addMentionsEntries: false
    +addMentionsPosts: true
    +isBanned: false
    +isVerified: false
    +isDeleted: false
    +isBot: false
    +spamProtection: true
    +customCss: null
    +ignoreMagazinesCustomCss: false
    +moderatorTokens: Doctrine\ORM\PersistentCollection {#253 …}
    +magazineOwnershipRequests: Doctrine\ORM\PersistentCollection {#249 …}
    +moderatorRequests: Doctrine\ORM\PersistentCollection {#238 …}
    +entries: Doctrine\ORM\PersistentCollection {#196 …}
    +entryVotes: Doctrine\ORM\PersistentCollection {#168 …}
    +entryComments: Doctrine\ORM\PersistentCollection {#141 …}
    +entryCommentVotes: Doctrine\ORM\PersistentCollection {#111 …}
    +posts: Doctrine\ORM\PersistentCollection {#84 …}
    +postVotes: Doctrine\ORM\PersistentCollection {#99 …}
    +postComments: Doctrine\ORM\PersistentCollection {#1863 …}
    +postCommentVotes: Doctrine\ORM\PersistentCollection {#1479 …}
    +subscriptions: Doctrine\ORM\PersistentCollection {#1658 …}
    +subscribedDomains: Doctrine\ORM\PersistentCollection {#1868 …}
    +follows: Doctrine\ORM\PersistentCollection {#1917 …}
    +followers: Doctrine\ORM\PersistentCollection {#1601 …}
    +blocks: Doctrine\ORM\PersistentCollection {#1805 …}
    +blockers: Doctrine\ORM\PersistentCollection {#1810 …}
    +blockedMagazines: Doctrine\ORM\PersistentCollection {#1857 …}
    +blockedDomains: Doctrine\ORM\PersistentCollection {#1860 …}
    +reports: Doctrine\ORM\PersistentCollection {#1791 …}
    +favourites: Doctrine\ORM\PersistentCollection {#2416 …}
    +violations: Doctrine\ORM\PersistentCollection {#1824 …}
    +notifications: Doctrine\ORM\PersistentCollection {#1914 …}
    +awards: Doctrine\ORM\PersistentCollection {#1929 …}
    +subscribedCategories: Doctrine\ORM\PersistentCollection {#1867 …}
    +categories: Doctrine\ORM\PersistentCollection {#1880 …}
    -id: 42482
    -password: "$2y$13$NhIMiF1JXctMkB.To0A1l.9Yf5tUWEmnsXRxLOIoPHjfEy4B2UkMe"
    -totpSecret: null
    -totpBackupCodes: []
    -oAuth2UserConsents: Doctrine\ORM\PersistentCollection {#1894 …}
    +apId: "Yonrak@feddit.uk"
    +apProfileId: "https://feddit.uk/u/Yonrak"
    +apPublicUrl: "https://feddit.uk/u/Yonrak"
    +apFollowersUrl: null
    +apInboxUrl: "https://feddit.uk/inbox"
    +apDomain: "feddit.uk"
    +apPreferredUsername: "Yonrak"
    +apDiscoverable: true
    +apManuallyApprovesFollowers: false
    +privateKey: null
    +publicKey: null
    +apFetchedAt: DateTime @1692955883 {#269
      date: 2023-08-25 11:31:23.0 +02:00
    }
    +apDeletedAt: null
    +apTimeoutAt: null
    +visibility: "visible             "
    +createdAt: DateTimeImmutable @1692950596 {#268
      date: 2023-08-25 10:03:16.0 +02:00
    }
  }
  "width" => 40
  "height" => 40
  "asLink" => true
]
Attributes
[]
Component
App\Twig\Components\UserAvatarComponent {#4592
  +width: 40
  +height: 40
  +user: App\Entity\User {#265
    +avatar: null
    +cover: null
    +email: "Yonrak@feddit.uk"
    +username: "@Yonrak@feddit.uk"
    +roles: []
    +followersCount: 0
    +homepage: "front"
    +about: null
    +lastActive: DateTime @1692955883 {#275
      date: 2023-08-25 11:31:23.0 +02:00
    }
    +markedForDeletionAt: null
    +fields: null
    +oauthGithubId: null
    +oauthGoogleId: null
    +oauthFacebookId: null
    +oauthKeycloakId: null
    +hideAdult: true
    +showSubscribedUsers: true
    +showSubscribedMagazines: true
    +showSubscribedDomains: true
    +preferredLanguages: []
    +featuredMagazines: null
    +showProfileSubscriptions: false
    +showProfileFollowings: true
    +markNewComments: false
    +notifyOnNewEntry: false
    +notifyOnNewEntryReply: true
    +notifyOnNewEntryCommentReply: true
    +notifyOnNewPost: false
    +notifyOnNewPostReply: true
    +notifyOnNewPostCommentReply: true
    +addMentionsEntries: false
    +addMentionsPosts: true
    +isBanned: false
    +isVerified: false
    +isDeleted: false
    +isBot: false
    +spamProtection: true
    +customCss: null
    +ignoreMagazinesCustomCss: false
    +moderatorTokens: Doctrine\ORM\PersistentCollection {#253 …}
    +magazineOwnershipRequests: Doctrine\ORM\PersistentCollection {#249 …}
    +moderatorRequests: Doctrine\ORM\PersistentCollection {#238 …}
    +entries: Doctrine\ORM\PersistentCollection {#196 …}
    +entryVotes: Doctrine\ORM\PersistentCollection {#168 …}
    +entryComments: Doctrine\ORM\PersistentCollection {#141 …}
    +entryCommentVotes: Doctrine\ORM\PersistentCollection {#111 …}
    +posts: Doctrine\ORM\PersistentCollection {#84 …}
    +postVotes: Doctrine\ORM\PersistentCollection {#99 …}
    +postComments: Doctrine\ORM\PersistentCollection {#1863 …}
    +postCommentVotes: Doctrine\ORM\PersistentCollection {#1479 …}
    +subscriptions: Doctrine\ORM\PersistentCollection {#1658 …}
    +subscribedDomains: Doctrine\ORM\PersistentCollection {#1868 …}
    +follows: Doctrine\ORM\PersistentCollection {#1917 …}
    +followers: Doctrine\ORM\PersistentCollection {#1601 …}
    +blocks: Doctrine\ORM\PersistentCollection {#1805 …}
    +blockers: Doctrine\ORM\PersistentCollection {#1810 …}
    +blockedMagazines: Doctrine\ORM\PersistentCollection {#1857 …}
    +blockedDomains: Doctrine\ORM\PersistentCollection {#1860 …}
    +reports: Doctrine\ORM\PersistentCollection {#1791 …}
    +favourites: Doctrine\ORM\PersistentCollection {#2416 …}
    +violations: Doctrine\ORM\PersistentCollection {#1824 …}
    +notifications: Doctrine\ORM\PersistentCollection {#1914 …}
    +awards: Doctrine\ORM\PersistentCollection {#1929 …}
    +subscribedCategories: Doctrine\ORM\PersistentCollection {#1867 …}
    +categories: Doctrine\ORM\PersistentCollection {#1880 …}
    -id: 42482
    -password: "$2y$13$NhIMiF1JXctMkB.To0A1l.9Yf5tUWEmnsXRxLOIoPHjfEy4B2UkMe"
    -totpSecret: null
    -totpBackupCodes: []
    -oAuth2UserConsents: Doctrine\ORM\PersistentCollection {#1894 …}
    +apId: "Yonrak@feddit.uk"
    +apProfileId: "https://feddit.uk/u/Yonrak"
    +apPublicUrl: "https://feddit.uk/u/Yonrak"
    +apFollowersUrl: null
    +apInboxUrl: "https://feddit.uk/inbox"
    +apDomain: "feddit.uk"
    +apPreferredUsername: "Yonrak"
    +apDiscoverable: true
    +apManuallyApprovesFollowers: false
    +privateKey: null
    +publicKey: null
    +apFetchedAt: DateTime @1692955883 {#269
      date: 2023-08-25 11:31:23.0 +02:00
    }
    +apDeletedAt: null
    +apTimeoutAt: null
    +visibility: "visible             "
    +createdAt: DateTimeImmutable @1692950596 {#268
      date: 2023-08-25 10:03:16.0 +02:00
    }
  }
  +asLink: true
}
vote App\Twig\Components\VoteComponent 12.0 MiB 0.45 ms
Input props
[
  "subject" => App\Entity\EntryComment {#1549
    +user: App\Entity\User {#265
      +avatar: null
      +cover: null
      +email: "Yonrak@feddit.uk"
      +username: "@Yonrak@feddit.uk"
      +roles: []
      +followersCount: 0
      +homepage: "front"
      +about: null
      +lastActive: DateTime @1692955883 {#275
        date: 2023-08-25 11:31:23.0 +02:00
      }
      +markedForDeletionAt: null
      +fields: null
      +oauthGithubId: null
      +oauthGoogleId: null
      +oauthFacebookId: null
      +oauthKeycloakId: null
      +hideAdult: true
      +showSubscribedUsers: true
      +showSubscribedMagazines: true
      +showSubscribedDomains: true
      +preferredLanguages: []
      +featuredMagazines: null
      +showProfileSubscriptions: false
      +showProfileFollowings: true
      +markNewComments: false
      +notifyOnNewEntry: false
      +notifyOnNewEntryReply: true
      +notifyOnNewEntryCommentReply: true
      +notifyOnNewPost: false
      +notifyOnNewPostReply: true
      +notifyOnNewPostCommentReply: true
      +addMentionsEntries: false
      +addMentionsPosts: true
      +isBanned: false
      +isVerified: false
      +isDeleted: false
      +isBot: false
      +spamProtection: true
      +customCss: null
      +ignoreMagazinesCustomCss: false
      +moderatorTokens: Doctrine\ORM\PersistentCollection {#253 …}
      +magazineOwnershipRequests: Doctrine\ORM\PersistentCollection {#249 …}
      +moderatorRequests: Doctrine\ORM\PersistentCollection {#238 …}
      +entries: Doctrine\ORM\PersistentCollection {#196 …}
      +entryVotes: Doctrine\ORM\PersistentCollection {#168 …}
      +entryComments: Doctrine\ORM\PersistentCollection {#141 …}
      +entryCommentVotes: Doctrine\ORM\PersistentCollection {#111 …}
      +posts: Doctrine\ORM\PersistentCollection {#84 …}
      +postVotes: Doctrine\ORM\PersistentCollection {#99 …}
      +postComments: Doctrine\ORM\PersistentCollection {#1863 …}
      +postCommentVotes: Doctrine\ORM\PersistentCollection {#1479 …}
      +subscriptions: Doctrine\ORM\PersistentCollection {#1658 …}
      +subscribedDomains: Doctrine\ORM\PersistentCollection {#1868 …}
      +follows: Doctrine\ORM\PersistentCollection {#1917 …}
      +followers: Doctrine\ORM\PersistentCollection {#1601 …}
      +blocks: Doctrine\ORM\PersistentCollection {#1805 …}
      +blockers: Doctrine\ORM\PersistentCollection {#1810 …}
      +blockedMagazines: Doctrine\ORM\PersistentCollection {#1857 …}
      +blockedDomains: Doctrine\ORM\PersistentCollection {#1860 …}
      +reports: Doctrine\ORM\PersistentCollection {#1791 …}
      +favourites: Doctrine\ORM\PersistentCollection {#2416 …}
      +violations: Doctrine\ORM\PersistentCollection {#1824 …}
      +notifications: Doctrine\ORM\PersistentCollection {#1914 …}
      +awards: Doctrine\ORM\PersistentCollection {#1929 …}
      +subscribedCategories: Doctrine\ORM\PersistentCollection {#1867 …}
      +categories: Doctrine\ORM\PersistentCollection {#1880 …}
      -id: 42482
      -password: "$2y$13$NhIMiF1JXctMkB.To0A1l.9Yf5tUWEmnsXRxLOIoPHjfEy4B2UkMe"
      -totpSecret: null
      -totpBackupCodes: []
      -oAuth2UserConsents: Doctrine\ORM\PersistentCollection {#1894 …}
      +apId: "Yonrak@feddit.uk"
      +apProfileId: "https://feddit.uk/u/Yonrak"
      +apPublicUrl: "https://feddit.uk/u/Yonrak"
      +apFollowersUrl: null
      +apInboxUrl: "https://feddit.uk/inbox"
      +apDomain: "feddit.uk"
      +apPreferredUsername: "Yonrak"
      +apDiscoverable: true
      +apManuallyApprovesFollowers: false
      +privateKey: null
      +publicKey: null
      +apFetchedAt: DateTime @1692955883 {#269
        date: 2023-08-25 11:31:23.0 +02:00
      }
      +apDeletedAt: null
      +apTimeoutAt: null
      +visibility: "visible             "
      +createdAt: DateTimeImmutable @1692950596 {#268
        date: 2023-08-25 10:03:16.0 +02:00
      }
    }
    +entry: Proxies\__CG__\App\Entity\Entry {#1591
      +user: Proxies\__CG__\App\Entity\User {#2459
        +avatar: null
        +cover: null
        +email: "nilclass@discuss.tchncs.de"
        +username: "@nilclass@discuss.tchncs.de"
        +roles: []
        +followersCount: 0
        +homepage: "front"
        +about: null
        +lastActive: DateTime @1721268563 {#3096
          date: 2024-07-18 04:09:23.0 +02:00
        }
        +markedForDeletionAt: null
        +fields: null
        +oauthGithubId: null
        +oauthGoogleId: null
        +oauthFacebookId: null
        +oauthKeycloakId: null
        +hideAdult: true
        +showSubscribedUsers: true
        +showSubscribedMagazines: true
        +showSubscribedDomains: true
        +preferredLanguages: []
        +featuredMagazines: null
        +showProfileSubscriptions: true
        +showProfileFollowings: true
        +markNewComments: false
        +notifyOnNewEntry: false
        +notifyOnNewEntryReply: false
        +notifyOnNewEntryCommentReply: false
        +notifyOnNewPost: false
        +notifyOnNewPostReply: false
        +notifyOnNewPostCommentReply: false
        +addMentionsEntries: false
        +addMentionsPosts: true
        +isBanned: false
        +isVerified: false
        +isDeleted: false
        +isBot: false
        +spamProtection: true
        +customCss: null
        +ignoreMagazinesCustomCss: false
        +moderatorTokens: Doctrine\ORM\PersistentCollection {#3099 …}
        +magazineOwnershipRequests: Doctrine\ORM\PersistentCollection {#3101 …}
        +moderatorRequests: Doctrine\ORM\PersistentCollection {#3103 …}
        +entries: Doctrine\ORM\PersistentCollection {#3105 …}
        +entryVotes: Doctrine\ORM\PersistentCollection {#3107 …}
        +entryComments: Doctrine\ORM\PersistentCollection {#3109 …}
        +entryCommentVotes: Doctrine\ORM\PersistentCollection {#3111 …}
        +posts: Doctrine\ORM\PersistentCollection {#3113 …}
        +postVotes: Doctrine\ORM\PersistentCollection {#3115 …}
        +postComments: Doctrine\ORM\PersistentCollection {#3117 …}
        +postCommentVotes: Doctrine\ORM\PersistentCollection {#3119 …}
        +subscriptions: Doctrine\ORM\PersistentCollection {#3121 …}
        +subscribedDomains: Doctrine\ORM\PersistentCollection {#3123 …}
        +follows: Doctrine\ORM\PersistentCollection {#3125 …}
        +followers: Doctrine\ORM\PersistentCollection {#3127 …}
        +blocks: Doctrine\ORM\PersistentCollection {#3129 …}
        +blockers: Doctrine\ORM\PersistentCollection {#3131 …}
        +blockedMagazines: Doctrine\ORM\PersistentCollection {#3133 …}
        +blockedDomains: Doctrine\ORM\PersistentCollection {#3135 …}
        +reports: Doctrine\ORM\PersistentCollection {#3137 …}
        +favourites: Doctrine\ORM\PersistentCollection {#3139 …}
        +violations: Doctrine\ORM\PersistentCollection {#3141 …}
        +notifications: Doctrine\ORM\PersistentCollection {#3143 …}
        +awards: Doctrine\ORM\PersistentCollection {#3145 …}
        +subscribedCategories: Doctrine\ORM\PersistentCollection {#3147 …}
        +categories: Doctrine\ORM\PersistentCollection {#3149 …}
        -id: 6046
        -password: "$2y$13$FEroXtR95mjA6.omogLZRe7NJuWUL6hb.9a/FfXkqyIPnPgg4Apme"
        -totpSecret: null
        -totpBackupCodes: []
        -oAuth2UserConsents: Doctrine\ORM\PersistentCollection {#3151 …}
        +apId: "nilclass@discuss.tchncs.de"
        +apProfileId: "https://discuss.tchncs.de/u/nilclass"
        +apPublicUrl: "https://discuss.tchncs.de/u/nilclass"
        +apFollowersUrl: null
        +apInboxUrl: "https://discuss.tchncs.de/inbox"
        +apDomain: "discuss.tchncs.de"
        +apPreferredUsername: "nilclass"
        +apDiscoverable: true
        +apManuallyApprovesFollowers: false
        +privateKey: null
        +publicKey: null
        +apFetchedAt: DateTime @1720630912 {#3097
          date: 2024-07-10 19:01:52.0 +02:00
        }
        +apDeletedAt: null
        +apTimeoutAt: null
        +visibility: "visible             "
        +createdAt: DateTimeImmutable @1687291240 {#3098
          date: 2023-06-20 22:00:40.0 +02:00
        }
        +__isInitialized__: true
         …2
      }
      +magazine: Proxies\__CG__\App\Entity\Magazine {#1584
        +icon: Proxies\__CG__\App\Entity\Image {#2886 …}
        +name: "askelectronics@discuss.tchncs.de"
        +title: "askelectronics"
        +description: """
          **For questions about component-level electronic circuits, tools and equipment.**\n
          \n
          Rules\n
          -----\n
          \n
          1: Be nice.\n
          \n
          2: Be on-topic (eg: *Electronic*, not *electrical*).\n
          \n
          3: No commercial stuff, buying, selling or valuations.\n
          \n
          4: Be safe.\n
          \n
          ---
          """
        +rules: null
        +subscriptionsCount: 1
        +entryCount: 154
        +entryCommentCount: 1230
        +postCount: 1
        +postCommentCount: 4
        +isAdult: false
        +customCss: null
        +lastActive: DateTime @1729413608 {#2865
          date: 2024-10-20 10:40:08.0 +02:00
        }
        +markedForDeletionAt: null
        +tags: null
        +moderators: Doctrine\ORM\PersistentCollection {#2885 …}
        +ownershipRequests: Doctrine\ORM\PersistentCollection {#2883 …}
        +moderatorRequests: Doctrine\ORM\PersistentCollection {#2888 …}
        +entries: Doctrine\ORM\PersistentCollection {#2889 …}
        +posts: Doctrine\ORM\PersistentCollection {#2892 …}
        +subscriptions: Doctrine\ORM\PersistentCollection {#2894 …}
        +bans: Doctrine\ORM\PersistentCollection {#2900 …}
        +reports: Doctrine\ORM\PersistentCollection {#2908 …}
        +badges: Doctrine\ORM\PersistentCollection {#2921 …}
        +logs: Doctrine\ORM\PersistentCollection {#2931 …}
        +awards: Doctrine\ORM\PersistentCollection {#2913 …}
        +categories: Doctrine\ORM\PersistentCollection {#2937 …}
        -id: 11
        +apId: "askelectronics@discuss.tchncs.de"
        +apProfileId: "https://discuss.tchncs.de/c/askelectronics"
        +apPublicUrl: "https://discuss.tchncs.de/c/askelectronics"
        +apFollowersUrl: "https://discuss.tchncs.de/c/askelectronics/followers"
        +apInboxUrl: "https://discuss.tchncs.de/inbox"
        +apDomain: "discuss.tchncs.de"
        +apPreferredUsername: "askelectronics"
        +apDiscoverable: true
        +apManuallyApprovesFollowers: null
        +privateKey: null
        +publicKey: null
        +apFetchedAt: DateTime @1727247714 {#2866
          date: 2024-09-25 09:01:54.0 +02:00
        }
        +apDeletedAt: null
        +apTimeoutAt: null
        +visibility: "visible             "
        +createdAt: DateTimeImmutable @1687144409 {#2867
          date: 2023-06-19 05:13:29.0 +02:00
        }
        +__isInitialized__: true
         …2
      }
      +image: null
      +domain: Proxies\__CG__\App\Entity\Domain {#1630 …}
      +slug: "How-to-improve-my-battery-measurement-circuit"
      +title: "How to improve my battery measurement circuit?"
      +url: null
      +body: """
        I am powering a 5V microcontroller (arduino clone, atmega328p) using a 9V block and a buck converter. Now I want to let the microcontroller occasionally measure the battery voltage, so I can get an idea of how full it is.\n
        \n
        My first idea was to use a simple voltage divider:\n
        \n
        ![](https://discuss.tchncs.de/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)\n
        \n
        I’ve chosen the resistor values so that:\n
        \n
        - the voltage at the measure output is `< 1.1V`, to be able to use the 1.1V internal reference of the atmega’s ADC\n
        - `R1 || R2 < 10kΩ`, since the atmega datasheet says “The ADC is optimized for analog signals with an output impedance of approximately 10 kΩ or less”\n
        \n
        This is great and all, but what bothers me is that this circuit will constantly draw ~100µA from the battery.\n
        \n
        So, my next thought was to add a mosfet to the divider, to switch it on only while measuring:\n
        \n
        ![](https://discuss.tchncs.de/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)\n
        \n
        This is obviously bad, because now when the mosfet is off, the ADC input sees the whole battery voltage.\n
        \n
        To address that issue, I’ve added a second mosfet into the measure path:\n
        \n
        ![](https://discuss.tchncs.de/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)\n
        \n
        This works, and it does not draw any current, except while measuring.\n
        \n
        However, it’s quite a few parts. So I’m curious if anyone has an idea how to do this with just a single mosfet. It seems to me like it should be possible, but I haven’t figured out how.\n
        \n
        Oh, and if I’m doing something stupid here, please tell me :)
        """
      +type: "article"
      +lang: "en"
      +isOc: false
      +hasEmbed: false
      +commentCount: 11
      +favouriteCount: 17
      +score: 0
      +isAdult: false
      +sticky: false
      +lastActive: DateTime @1694781042 {#1715
        date: 2023-09-15 14:30:42.0 +02:00
      }
      +ip: null
      +adaAmount: 0
      +tags: null
      +mentions: null
      +comments: Doctrine\ORM\PersistentCollection {#1629 …}
      +votes: Doctrine\ORM\PersistentCollection {#1626 …}
      +reports: Doctrine\ORM\PersistentCollection {#1625 …}
      +favourites: Doctrine\ORM\PersistentCollection {#2370 …}
      +notifications: Doctrine\ORM\PersistentCollection {#2371 …}
      +badges: Doctrine\ORM\PersistentCollection {#1708 …}
      +children: [
        1 => App\Entity\EntryComment {#1709
          +user: App\Entity\User {#265}
          +entry: Proxies\__CG__\App\Entity\Entry {#1591 …2}
          +magazine: Proxies\__CG__\App\Entity\Magazine {#1584 …2}
          +image: null
          +parent: null
          +root: null
          +body: """
            Could you do similar to diagram 2, but instead of an N-FET use a P-FET between the battery and first resistor in the potential divider?\n
            \n
            Add a gate pull up resistor to source to ensure the FET is off by default, have the micro pull the gate down to take a measurement. You’ll probably need to add another resistor on the control pin to 0V to limit the voltage there also, but those two can be much much higher values to really limit current. Or use a zener/TVS diode instead of second resistor to clamp the voltage instead of dividing (more robust).\n
            \n
            Switch it with an NFET\n
            \n
            The micro will see 0V or divided/clamped battery voltage on the measurement pin.
            """
          +lang: "en"
          +isAdult: false
          +favouriteCount: 3
          +score: 0
          +lastActive: DateTime @1692955883 {#1439
            date: 2023-08-25 11:31:23.0 +02:00
          }
          +ip: null
          +tags: null
          +mentions: [
            "@nilclass@discuss.tchncs.de"
          ]
          +children: Doctrine\ORM\PersistentCollection {#1579 …}
          +nested: Doctrine\ORM\PersistentCollection {#1577 …}
          +votes: Doctrine\ORM\PersistentCollection {#1578 …}
          +reports: Doctrine\ORM\PersistentCollection {#1571 …}
          +favourites: Doctrine\ORM\PersistentCollection {#1574 …}
          +notifications: Doctrine\ORM\PersistentCollection {#1667 …}
          -id: 26779
          -bodyTs: "'0v':70,117 '2':7 'add':30,62 'also':76 'anoth':63 'batteri':22,120 'clamp':100 'control':67 'could':1 'current':89 'default':45 'diagram':6 'diod':94 'divid':29,105 'divided/clamped':119 'ensur':39 'fet':14,19,41 'first':24 'gate':32,51 'higher':84 'instead':9,95,103 'limit':72,88 'll':58 'measur':56,124 'micro':48,114 'much':82,83 'n':13 'n-fet':12 'need':60 'nfet':112 'p':18 'p-fet':17 'pin':68,125 'potenti':28 'probabl':59 'pull':33,49 'realli':87 'resistor':25,35,64,98 'robust':107 'second':97 'see':116 'similar':4 'sourc':37 'switch':108 'take':54 'two':79 'use':15,91 'valu':85 'voltag':74,102,121 'zener/tvs':93"
          +ranking: 0
          +commentCount: 0
          +upVotes: 0
          +downVotes: 0
          +visibility: "visible             "
          +apId: "https://feddit.uk/comment/2185380"
          +editedAt: DateTimeImmutable @1692969047 {#1435
            date: 2023-08-25 15:10:47.0 +02:00
          }
          +createdAt: DateTimeImmutable @1692950595 {#1436
            date: 2023-08-25 10:03:15.0 +02:00
          }
          +"title": 26779
        }
        0 => App\Entity\EntryComment {#1549}
      ]
      -id: 1944
      -titleTs: "'batteri':5 'circuit':7 'improv':3 'measur':6"
      -bodyTs: "'/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)':152 '/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)':188 '/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)':53 '1.1':69,77 '10':107 '100µa':127 '10kω':88 '5v':5 '9v':12 'abl':73 'ad':178 'adc':85,95,165 'add':137 'address':173 'analog':99 'anyon':213 'approxim':106 'arduino':7 'atmega':83,91 'atmega328p':9 'bad':156 'batteri':28,130,170 'block':13 'bother':118 'buck':16 'chosen':56 'circuit':123 'clone':8 'constant':125 'convert':17 'curious':211 'current':197 'datasheet':92 'discuss.tchncs.de':52,151,187 'discuss.tchncs.de/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)':150 'discuss.tchncs.de/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)':186 'discuss.tchncs.de/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)':51 'divid':50,142 'draw':126,195 'except':198 'figur':239 'first':42 'full':38 'get':33 'great':113 'haven':237 'howev':201 'idea':35,43,216 'imped':104 'input':166 'intern':79 'issu':175 'kω':108 'less':110 'let':22 'like':230 'm':210,246 'measur':26,66,149,184,200 'microcontrol':6,24 'mosfet':139,161,181,225 'next':133 'obvious':155 'occasion':25 'oh':242 'optim':97 'output':67,103 'part':207 'path':185 'pleas':251 'possibl':234 'power':3 'quit':204 'r1':86 'r2':87 'refer':80 'resistor':58 'say':93 'second':180 'see':167 'seem':227 'signal':100 'simpl':48 'sinc':89 'singl':224 'someth':248 'stupid':249 'switch':144 'tell':252 'thought':134 'use':10,46,75 'v':70,78 'valu':59 've':55,177 'voltag':29,49,63,171 'want':20 'whole':169 'work':190"
      +cross: false
      +upVotes: 0
      +downVotes: 0
      +ranking: 1693029637
      +visibility: "visible             "
      +apId: "https://discuss.tchncs.de/post/2309537"
      +editedAt: DateTimeImmutable @1692947232 {#1693
        date: 2023-08-25 09:07:12.0 +02:00
      }
      +createdAt: DateTimeImmutable @1692947137 {#1740
        date: 2023-08-25 09:05:37.0 +02:00
      }
      +__isInitialized__: true
       …2
    }
    +magazine: Proxies\__CG__\App\Entity\Magazine {#1584 …2}
    +image: null
    +parent: Proxies\__CG__\App\Entity\EntryComment {#1692 …}
    +root: App\Entity\EntryComment {#1709}
    +body: """
      > Not sure I understand this point. Which resistor would you replace with a diode?\n
      \n
      Sorry, I think I was talking nonesense (doing this in my head and just woke up 😅).\n
      \n
      Not sure it’ll work with just a P-FET actually. You’ll likely need to control the PFET with a NFET, otherwise you still end up with too high a voltage on your control pin when the FET is off due to the gate pullup (unless you can use a fet with a very high Vgs Threshold and then drive it push/pull from the micro, but this isn’t really best practice).\n
      \n
      The above comment about diodes was to protect the microcontroller pin, but you end up not being able to control the FET doing it that way.\n
      \n
      I think either your existing Option 3 or PFET upstream of the divider, switched via an N-FET is the way to go.
      """
    +lang: "en"
    +isAdult: false
    +favouriteCount: 2
    +score: 0
    +lastActive: DateTime @1692955881 {#1673
      date: 2023-08-25 11:31:21.0 +02:00
    }
    +ip: null
    +tags: null
    +mentions: [
      "@nilclass@discuss.tchncs.de"
      "@Yonrak@feddit.uk"
    ]
    +children: Doctrine\ORM\PersistentCollection {#1691 …}
    +nested: Doctrine\ORM\PersistentCollection {#1680 …}
    +votes: Doctrine\ORM\PersistentCollection {#1683 …}
    +reports: Doctrine\ORM\PersistentCollection {#1702 …}
    +favourites: Doctrine\ORM\PersistentCollection {#1596 …}
    +notifications: Doctrine\ORM\PersistentCollection {#1613 …}
    -id: 26782
    -bodyTs: "'3':137 'abl':122 'actual':42 'best':103 'comment':107 'control':48,66,124 'diod':14,109 'divid':143 'drive':92 'due':73 'either':133 'end':57,118 'exist':135 'fet':41,70,83,126,149 'gate':76 'go':154 'head':26 'high':61,87 'isn':100 'like':45 'll':34,44 'micro':97 'microcontrol':114 'n':148 'n-fet':147 'need':46 'nfet':53 'nonesens':21 'option':136 'otherwis':54 'p':40 'p-fet':39 'pfet':50,139 'pin':67,115 'point':6 'practic':104 'protect':112 'pullup':77 'push/pull':94 'realli':102 'replac':11 'resistor':8 'sorri':15 'still':56 'sure':2,32 'switch':144 'talk':20 'think':17,132 'threshold':89 'understand':4 'unless':78 'upstream':140 'use':81 'vgs':88 'via':145 'voltag':63 'way':130,152 'woke':29 'work':35 'would':9"
    +ranking: 0
    +commentCount: 0
    +upVotes: 0
    +downVotes: 0
    +visibility: "visible             "
    +apId: "https://feddit.uk/comment/2186641"
    +editedAt: DateTimeImmutable @1692956099 {#1560
      date: 2023-08-25 11:34:59.0 +02:00
    }
    +createdAt: DateTimeImmutable @1692955881 {#1568
      date: 2023-08-25 11:31:21.0 +02:00
    }
    +"title": 26782
  }
]
Attributes
[]
Component
App\Twig\Components\VoteComponent {#4679
  +subject: App\Entity\EntryComment {#1549
    +user: App\Entity\User {#265
      +avatar: null
      +cover: null
      +email: "Yonrak@feddit.uk"
      +username: "@Yonrak@feddit.uk"
      +roles: []
      +followersCount: 0
      +homepage: "front"
      +about: null
      +lastActive: DateTime @1692955883 {#275
        date: 2023-08-25 11:31:23.0 +02:00
      }
      +markedForDeletionAt: null
      +fields: null
      +oauthGithubId: null
      +oauthGoogleId: null
      +oauthFacebookId: null
      +oauthKeycloakId: null
      +hideAdult: true
      +showSubscribedUsers: true
      +showSubscribedMagazines: true
      +showSubscribedDomains: true
      +preferredLanguages: []
      +featuredMagazines: null
      +showProfileSubscriptions: false
      +showProfileFollowings: true
      +markNewComments: false
      +notifyOnNewEntry: false
      +notifyOnNewEntryReply: true
      +notifyOnNewEntryCommentReply: true
      +notifyOnNewPost: false
      +notifyOnNewPostReply: true
      +notifyOnNewPostCommentReply: true
      +addMentionsEntries: false
      +addMentionsPosts: true
      +isBanned: false
      +isVerified: false
      +isDeleted: false
      +isBot: false
      +spamProtection: true
      +customCss: null
      +ignoreMagazinesCustomCss: false
      +moderatorTokens: Doctrine\ORM\PersistentCollection {#253 …}
      +magazineOwnershipRequests: Doctrine\ORM\PersistentCollection {#249 …}
      +moderatorRequests: Doctrine\ORM\PersistentCollection {#238 …}
      +entries: Doctrine\ORM\PersistentCollection {#196 …}
      +entryVotes: Doctrine\ORM\PersistentCollection {#168 …}
      +entryComments: Doctrine\ORM\PersistentCollection {#141 …}
      +entryCommentVotes: Doctrine\ORM\PersistentCollection {#111 …}
      +posts: Doctrine\ORM\PersistentCollection {#84 …}
      +postVotes: Doctrine\ORM\PersistentCollection {#99 …}
      +postComments: Doctrine\ORM\PersistentCollection {#1863 …}
      +postCommentVotes: Doctrine\ORM\PersistentCollection {#1479 …}
      +subscriptions: Doctrine\ORM\PersistentCollection {#1658 …}
      +subscribedDomains: Doctrine\ORM\PersistentCollection {#1868 …}
      +follows: Doctrine\ORM\PersistentCollection {#1917 …}
      +followers: Doctrine\ORM\PersistentCollection {#1601 …}
      +blocks: Doctrine\ORM\PersistentCollection {#1805 …}
      +blockers: Doctrine\ORM\PersistentCollection {#1810 …}
      +blockedMagazines: Doctrine\ORM\PersistentCollection {#1857 …}
      +blockedDomains: Doctrine\ORM\PersistentCollection {#1860 …}
      +reports: Doctrine\ORM\PersistentCollection {#1791 …}
      +favourites: Doctrine\ORM\PersistentCollection {#2416 …}
      +violations: Doctrine\ORM\PersistentCollection {#1824 …}
      +notifications: Doctrine\ORM\PersistentCollection {#1914 …}
      +awards: Doctrine\ORM\PersistentCollection {#1929 …}
      +subscribedCategories: Doctrine\ORM\PersistentCollection {#1867 …}
      +categories: Doctrine\ORM\PersistentCollection {#1880 …}
      -id: 42482
      -password: "$2y$13$NhIMiF1JXctMkB.To0A1l.9Yf5tUWEmnsXRxLOIoPHjfEy4B2UkMe"
      -totpSecret: null
      -totpBackupCodes: []
      -oAuth2UserConsents: Doctrine\ORM\PersistentCollection {#1894 …}
      +apId: "Yonrak@feddit.uk"
      +apProfileId: "https://feddit.uk/u/Yonrak"
      +apPublicUrl: "https://feddit.uk/u/Yonrak"
      +apFollowersUrl: null
      +apInboxUrl: "https://feddit.uk/inbox"
      +apDomain: "feddit.uk"
      +apPreferredUsername: "Yonrak"
      +apDiscoverable: true
      +apManuallyApprovesFollowers: false
      +privateKey: null
      +publicKey: null
      +apFetchedAt: DateTime @1692955883 {#269
        date: 2023-08-25 11:31:23.0 +02:00
      }
      +apDeletedAt: null
      +apTimeoutAt: null
      +visibility: "visible             "
      +createdAt: DateTimeImmutable @1692950596 {#268
        date: 2023-08-25 10:03:16.0 +02:00
      }
    }
    +entry: Proxies\__CG__\App\Entity\Entry {#1591
      +user: Proxies\__CG__\App\Entity\User {#2459
        +avatar: null
        +cover: null
        +email: "nilclass@discuss.tchncs.de"
        +username: "@nilclass@discuss.tchncs.de"
        +roles: []
        +followersCount: 0
        +homepage: "front"
        +about: null
        +lastActive: DateTime @1721268563 {#3096
          date: 2024-07-18 04:09:23.0 +02:00
        }
        +markedForDeletionAt: null
        +fields: null
        +oauthGithubId: null
        +oauthGoogleId: null
        +oauthFacebookId: null
        +oauthKeycloakId: null
        +hideAdult: true
        +showSubscribedUsers: true
        +showSubscribedMagazines: true
        +showSubscribedDomains: true
        +preferredLanguages: []
        +featuredMagazines: null
        +showProfileSubscriptions: true
        +showProfileFollowings: true
        +markNewComments: false
        +notifyOnNewEntry: false
        +notifyOnNewEntryReply: false
        +notifyOnNewEntryCommentReply: false
        +notifyOnNewPost: false
        +notifyOnNewPostReply: false
        +notifyOnNewPostCommentReply: false
        +addMentionsEntries: false
        +addMentionsPosts: true
        +isBanned: false
        +isVerified: false
        +isDeleted: false
        +isBot: false
        +spamProtection: true
        +customCss: null
        +ignoreMagazinesCustomCss: false
        +moderatorTokens: Doctrine\ORM\PersistentCollection {#3099 …}
        +magazineOwnershipRequests: Doctrine\ORM\PersistentCollection {#3101 …}
        +moderatorRequests: Doctrine\ORM\PersistentCollection {#3103 …}
        +entries: Doctrine\ORM\PersistentCollection {#3105 …}
        +entryVotes: Doctrine\ORM\PersistentCollection {#3107 …}
        +entryComments: Doctrine\ORM\PersistentCollection {#3109 …}
        +entryCommentVotes: Doctrine\ORM\PersistentCollection {#3111 …}
        +posts: Doctrine\ORM\PersistentCollection {#3113 …}
        +postVotes: Doctrine\ORM\PersistentCollection {#3115 …}
        +postComments: Doctrine\ORM\PersistentCollection {#3117 …}
        +postCommentVotes: Doctrine\ORM\PersistentCollection {#3119 …}
        +subscriptions: Doctrine\ORM\PersistentCollection {#3121 …}
        +subscribedDomains: Doctrine\ORM\PersistentCollection {#3123 …}
        +follows: Doctrine\ORM\PersistentCollection {#3125 …}
        +followers: Doctrine\ORM\PersistentCollection {#3127 …}
        +blocks: Doctrine\ORM\PersistentCollection {#3129 …}
        +blockers: Doctrine\ORM\PersistentCollection {#3131 …}
        +blockedMagazines: Doctrine\ORM\PersistentCollection {#3133 …}
        +blockedDomains: Doctrine\ORM\PersistentCollection {#3135 …}
        +reports: Doctrine\ORM\PersistentCollection {#3137 …}
        +favourites: Doctrine\ORM\PersistentCollection {#3139 …}
        +violations: Doctrine\ORM\PersistentCollection {#3141 …}
        +notifications: Doctrine\ORM\PersistentCollection {#3143 …}
        +awards: Doctrine\ORM\PersistentCollection {#3145 …}
        +subscribedCategories: Doctrine\ORM\PersistentCollection {#3147 …}
        +categories: Doctrine\ORM\PersistentCollection {#3149 …}
        -id: 6046
        -password: "$2y$13$FEroXtR95mjA6.omogLZRe7NJuWUL6hb.9a/FfXkqyIPnPgg4Apme"
        -totpSecret: null
        -totpBackupCodes: []
        -oAuth2UserConsents: Doctrine\ORM\PersistentCollection {#3151 …}
        +apId: "nilclass@discuss.tchncs.de"
        +apProfileId: "https://discuss.tchncs.de/u/nilclass"
        +apPublicUrl: "https://discuss.tchncs.de/u/nilclass"
        +apFollowersUrl: null
        +apInboxUrl: "https://discuss.tchncs.de/inbox"
        +apDomain: "discuss.tchncs.de"
        +apPreferredUsername: "nilclass"
        +apDiscoverable: true
        +apManuallyApprovesFollowers: false
        +privateKey: null
        +publicKey: null
        +apFetchedAt: DateTime @1720630912 {#3097
          date: 2024-07-10 19:01:52.0 +02:00
        }
        +apDeletedAt: null
        +apTimeoutAt: null
        +visibility: "visible             "
        +createdAt: DateTimeImmutable @1687291240 {#3098
          date: 2023-06-20 22:00:40.0 +02:00
        }
        +__isInitialized__: true
         …2
      }
      +magazine: Proxies\__CG__\App\Entity\Magazine {#1584
        +icon: Proxies\__CG__\App\Entity\Image {#2886 …}
        +name: "askelectronics@discuss.tchncs.de"
        +title: "askelectronics"
        +description: """
          **For questions about component-level electronic circuits, tools and equipment.**\n
          \n
          Rules\n
          -----\n
          \n
          1: Be nice.\n
          \n
          2: Be on-topic (eg: *Electronic*, not *electrical*).\n
          \n
          3: No commercial stuff, buying, selling or valuations.\n
          \n
          4: Be safe.\n
          \n
          ---
          """
        +rules: null
        +subscriptionsCount: 1
        +entryCount: 154
        +entryCommentCount: 1230
        +postCount: 1
        +postCommentCount: 4
        +isAdult: false
        +customCss: null
        +lastActive: DateTime @1729413608 {#2865
          date: 2024-10-20 10:40:08.0 +02:00
        }
        +markedForDeletionAt: null
        +tags: null
        +moderators: Doctrine\ORM\PersistentCollection {#2885 …}
        +ownershipRequests: Doctrine\ORM\PersistentCollection {#2883 …}
        +moderatorRequests: Doctrine\ORM\PersistentCollection {#2888 …}
        +entries: Doctrine\ORM\PersistentCollection {#2889 …}
        +posts: Doctrine\ORM\PersistentCollection {#2892 …}
        +subscriptions: Doctrine\ORM\PersistentCollection {#2894 …}
        +bans: Doctrine\ORM\PersistentCollection {#2900 …}
        +reports: Doctrine\ORM\PersistentCollection {#2908 …}
        +badges: Doctrine\ORM\PersistentCollection {#2921 …}
        +logs: Doctrine\ORM\PersistentCollection {#2931 …}
        +awards: Doctrine\ORM\PersistentCollection {#2913 …}
        +categories: Doctrine\ORM\PersistentCollection {#2937 …}
        -id: 11
        +apId: "askelectronics@discuss.tchncs.de"
        +apProfileId: "https://discuss.tchncs.de/c/askelectronics"
        +apPublicUrl: "https://discuss.tchncs.de/c/askelectronics"
        +apFollowersUrl: "https://discuss.tchncs.de/c/askelectronics/followers"
        +apInboxUrl: "https://discuss.tchncs.de/inbox"
        +apDomain: "discuss.tchncs.de"
        +apPreferredUsername: "askelectronics"
        +apDiscoverable: true
        +apManuallyApprovesFollowers: null
        +privateKey: null
        +publicKey: null
        +apFetchedAt: DateTime @1727247714 {#2866
          date: 2024-09-25 09:01:54.0 +02:00
        }
        +apDeletedAt: null
        +apTimeoutAt: null
        +visibility: "visible             "
        +createdAt: DateTimeImmutable @1687144409 {#2867
          date: 2023-06-19 05:13:29.0 +02:00
        }
        +__isInitialized__: true
         …2
      }
      +image: null
      +domain: Proxies\__CG__\App\Entity\Domain {#1630 …}
      +slug: "How-to-improve-my-battery-measurement-circuit"
      +title: "How to improve my battery measurement circuit?"
      +url: null
      +body: """
        I am powering a 5V microcontroller (arduino clone, atmega328p) using a 9V block and a buck converter. Now I want to let the microcontroller occasionally measure the battery voltage, so I can get an idea of how full it is.\n
        \n
        My first idea was to use a simple voltage divider:\n
        \n
        ![](https://discuss.tchncs.de/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)\n
        \n
        I’ve chosen the resistor values so that:\n
        \n
        - the voltage at the measure output is `< 1.1V`, to be able to use the 1.1V internal reference of the atmega’s ADC\n
        - `R1 || R2 < 10kΩ`, since the atmega datasheet says “The ADC is optimized for analog signals with an output impedance of approximately 10 kΩ or less”\n
        \n
        This is great and all, but what bothers me is that this circuit will constantly draw ~100µA from the battery.\n
        \n
        So, my next thought was to add a mosfet to the divider, to switch it on only while measuring:\n
        \n
        ![](https://discuss.tchncs.de/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)\n
        \n
        This is obviously bad, because now when the mosfet is off, the ADC input sees the whole battery voltage.\n
        \n
        To address that issue, I’ve added a second mosfet into the measure path:\n
        \n
        ![](https://discuss.tchncs.de/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)\n
        \n
        This works, and it does not draw any current, except while measuring.\n
        \n
        However, it’s quite a few parts. So I’m curious if anyone has an idea how to do this with just a single mosfet. It seems to me like it should be possible, but I haven’t figured out how.\n
        \n
        Oh, and if I’m doing something stupid here, please tell me :)
        """
      +type: "article"
      +lang: "en"
      +isOc: false
      +hasEmbed: false
      +commentCount: 11
      +favouriteCount: 17
      +score: 0
      +isAdult: false
      +sticky: false
      +lastActive: DateTime @1694781042 {#1715
        date: 2023-09-15 14:30:42.0 +02:00
      }
      +ip: null
      +adaAmount: 0
      +tags: null
      +mentions: null
      +comments: Doctrine\ORM\PersistentCollection {#1629 …}
      +votes: Doctrine\ORM\PersistentCollection {#1626 …}
      +reports: Doctrine\ORM\PersistentCollection {#1625 …}
      +favourites: Doctrine\ORM\PersistentCollection {#2370 …}
      +notifications: Doctrine\ORM\PersistentCollection {#2371 …}
      +badges: Doctrine\ORM\PersistentCollection {#1708 …}
      +children: [
        1 => App\Entity\EntryComment {#1709
          +user: App\Entity\User {#265}
          +entry: Proxies\__CG__\App\Entity\Entry {#1591 …2}
          +magazine: Proxies\__CG__\App\Entity\Magazine {#1584 …2}
          +image: null
          +parent: null
          +root: null
          +body: """
            Could you do similar to diagram 2, but instead of an N-FET use a P-FET between the battery and first resistor in the potential divider?\n
            \n
            Add a gate pull up resistor to source to ensure the FET is off by default, have the micro pull the gate down to take a measurement. You’ll probably need to add another resistor on the control pin to 0V to limit the voltage there also, but those two can be much much higher values to really limit current. Or use a zener/TVS diode instead of second resistor to clamp the voltage instead of dividing (more robust).\n
            \n
            Switch it with an NFET\n
            \n
            The micro will see 0V or divided/clamped battery voltage on the measurement pin.
            """
          +lang: "en"
          +isAdult: false
          +favouriteCount: 3
          +score: 0
          +lastActive: DateTime @1692955883 {#1439
            date: 2023-08-25 11:31:23.0 +02:00
          }
          +ip: null
          +tags: null
          +mentions: [
            "@nilclass@discuss.tchncs.de"
          ]
          +children: Doctrine\ORM\PersistentCollection {#1579 …}
          +nested: Doctrine\ORM\PersistentCollection {#1577 …}
          +votes: Doctrine\ORM\PersistentCollection {#1578 …}
          +reports: Doctrine\ORM\PersistentCollection {#1571 …}
          +favourites: Doctrine\ORM\PersistentCollection {#1574 …}
          +notifications: Doctrine\ORM\PersistentCollection {#1667 …}
          -id: 26779
          -bodyTs: "'0v':70,117 '2':7 'add':30,62 'also':76 'anoth':63 'batteri':22,120 'clamp':100 'control':67 'could':1 'current':89 'default':45 'diagram':6 'diod':94 'divid':29,105 'divided/clamped':119 'ensur':39 'fet':14,19,41 'first':24 'gate':32,51 'higher':84 'instead':9,95,103 'limit':72,88 'll':58 'measur':56,124 'micro':48,114 'much':82,83 'n':13 'n-fet':12 'need':60 'nfet':112 'p':18 'p-fet':17 'pin':68,125 'potenti':28 'probabl':59 'pull':33,49 'realli':87 'resistor':25,35,64,98 'robust':107 'second':97 'see':116 'similar':4 'sourc':37 'switch':108 'take':54 'two':79 'use':15,91 'valu':85 'voltag':74,102,121 'zener/tvs':93"
          +ranking: 0
          +commentCount: 0
          +upVotes: 0
          +downVotes: 0
          +visibility: "visible             "
          +apId: "https://feddit.uk/comment/2185380"
          +editedAt: DateTimeImmutable @1692969047 {#1435
            date: 2023-08-25 15:10:47.0 +02:00
          }
          +createdAt: DateTimeImmutable @1692950595 {#1436
            date: 2023-08-25 10:03:15.0 +02:00
          }
          +"title": 26779
        }
        0 => App\Entity\EntryComment {#1549}
      ]
      -id: 1944
      -titleTs: "'batteri':5 'circuit':7 'improv':3 'measur':6"
      -bodyTs: "'/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)':152 '/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)':188 '/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)':53 '1.1':69,77 '10':107 '100µa':127 '10kω':88 '5v':5 '9v':12 'abl':73 'ad':178 'adc':85,95,165 'add':137 'address':173 'analog':99 'anyon':213 'approxim':106 'arduino':7 'atmega':83,91 'atmega328p':9 'bad':156 'batteri':28,130,170 'block':13 'bother':118 'buck':16 'chosen':56 'circuit':123 'clone':8 'constant':125 'convert':17 'curious':211 'current':197 'datasheet':92 'discuss.tchncs.de':52,151,187 'discuss.tchncs.de/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)':150 'discuss.tchncs.de/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)':186 'discuss.tchncs.de/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)':51 'divid':50,142 'draw':126,195 'except':198 'figur':239 'first':42 'full':38 'get':33 'great':113 'haven':237 'howev':201 'idea':35,43,216 'imped':104 'input':166 'intern':79 'issu':175 'kω':108 'less':110 'let':22 'like':230 'm':210,246 'measur':26,66,149,184,200 'microcontrol':6,24 'mosfet':139,161,181,225 'next':133 'obvious':155 'occasion':25 'oh':242 'optim':97 'output':67,103 'part':207 'path':185 'pleas':251 'possibl':234 'power':3 'quit':204 'r1':86 'r2':87 'refer':80 'resistor':58 'say':93 'second':180 'see':167 'seem':227 'signal':100 'simpl':48 'sinc':89 'singl':224 'someth':248 'stupid':249 'switch':144 'tell':252 'thought':134 'use':10,46,75 'v':70,78 'valu':59 've':55,177 'voltag':29,49,63,171 'want':20 'whole':169 'work':190"
      +cross: false
      +upVotes: 0
      +downVotes: 0
      +ranking: 1693029637
      +visibility: "visible             "
      +apId: "https://discuss.tchncs.de/post/2309537"
      +editedAt: DateTimeImmutable @1692947232 {#1693
        date: 2023-08-25 09:07:12.0 +02:00
      }
      +createdAt: DateTimeImmutable @1692947137 {#1740
        date: 2023-08-25 09:05:37.0 +02:00
      }
      +__isInitialized__: true
       …2
    }
    +magazine: Proxies\__CG__\App\Entity\Magazine {#1584 …2}
    +image: null
    +parent: Proxies\__CG__\App\Entity\EntryComment {#1692 …}
    +root: App\Entity\EntryComment {#1709}
    +body: """
      > Not sure I understand this point. Which resistor would you replace with a diode?\n
      \n
      Sorry, I think I was talking nonesense (doing this in my head and just woke up 😅).\n
      \n
      Not sure it’ll work with just a P-FET actually. You’ll likely need to control the PFET with a NFET, otherwise you still end up with too high a voltage on your control pin when the FET is off due to the gate pullup (unless you can use a fet with a very high Vgs Threshold and then drive it push/pull from the micro, but this isn’t really best practice).\n
      \n
      The above comment about diodes was to protect the microcontroller pin, but you end up not being able to control the FET doing it that way.\n
      \n
      I think either your existing Option 3 or PFET upstream of the divider, switched via an N-FET is the way to go.
      """
    +lang: "en"
    +isAdult: false
    +favouriteCount: 2
    +score: 0
    +lastActive: DateTime @1692955881 {#1673
      date: 2023-08-25 11:31:21.0 +02:00
    }
    +ip: null
    +tags: null
    +mentions: [
      "@nilclass@discuss.tchncs.de"
      "@Yonrak@feddit.uk"
    ]
    +children: Doctrine\ORM\PersistentCollection {#1691 …}
    +nested: Doctrine\ORM\PersistentCollection {#1680 …}
    +votes: Doctrine\ORM\PersistentCollection {#1683 …}
    +reports: Doctrine\ORM\PersistentCollection {#1702 …}
    +favourites: Doctrine\ORM\PersistentCollection {#1596 …}
    +notifications: Doctrine\ORM\PersistentCollection {#1613 …}
    -id: 26782
    -bodyTs: "'3':137 'abl':122 'actual':42 'best':103 'comment':107 'control':48,66,124 'diod':14,109 'divid':143 'drive':92 'due':73 'either':133 'end':57,118 'exist':135 'fet':41,70,83,126,149 'gate':76 'go':154 'head':26 'high':61,87 'isn':100 'like':45 'll':34,44 'micro':97 'microcontrol':114 'n':148 'n-fet':147 'need':46 'nfet':53 'nonesens':21 'option':136 'otherwis':54 'p':40 'p-fet':39 'pfet':50,139 'pin':67,115 'point':6 'practic':104 'protect':112 'pullup':77 'push/pull':94 'realli':102 'replac':11 'resistor':8 'sorri':15 'still':56 'sure':2,32 'switch':144 'talk':20 'think':17,132 'threshold':89 'understand':4 'unless':78 'upstream':140 'use':81 'vgs':88 'via':145 'voltag':63 'way':130,152 'woke':29 'work':35 'would':9"
    +ranking: 0
    +commentCount: 0
    +upVotes: 0
    +downVotes: 0
    +visibility: "visible             "
    +apId: "https://feddit.uk/comment/2186641"
    +editedAt: DateTimeImmutable @1692956099 {#1560
      date: 2023-08-25 11:34:59.0 +02:00
    }
    +createdAt: DateTimeImmutable @1692955881 {#1568
      date: 2023-08-25 11:31:21.0 +02:00
    }
    +"title": 26782
  }
  +formDest: "entry_comment"
  +showDownvote: true
  -cache: Symfony\Component\Cache\Adapter\TraceableTagAwareAdapter {#600 …}
}
boost App\Twig\Components\BoostComponent 12.0 MiB 0.75 ms
Input props
[
  "subject" => App\Entity\EntryComment {#1549
    +user: App\Entity\User {#265
      +avatar: null
      +cover: null
      +email: "Yonrak@feddit.uk"
      +username: "@Yonrak@feddit.uk"
      +roles: []
      +followersCount: 0
      +homepage: "front"
      +about: null
      +lastActive: DateTime @1692955883 {#275
        date: 2023-08-25 11:31:23.0 +02:00
      }
      +markedForDeletionAt: null
      +fields: null
      +oauthGithubId: null
      +oauthGoogleId: null
      +oauthFacebookId: null
      +oauthKeycloakId: null
      +hideAdult: true
      +showSubscribedUsers: true
      +showSubscribedMagazines: true
      +showSubscribedDomains: true
      +preferredLanguages: []
      +featuredMagazines: null
      +showProfileSubscriptions: false
      +showProfileFollowings: true
      +markNewComments: false
      +notifyOnNewEntry: false
      +notifyOnNewEntryReply: true
      +notifyOnNewEntryCommentReply: true
      +notifyOnNewPost: false
      +notifyOnNewPostReply: true
      +notifyOnNewPostCommentReply: true
      +addMentionsEntries: false
      +addMentionsPosts: true
      +isBanned: false
      +isVerified: false
      +isDeleted: false
      +isBot: false
      +spamProtection: true
      +customCss: null
      +ignoreMagazinesCustomCss: false
      +moderatorTokens: Doctrine\ORM\PersistentCollection {#253 …}
      +magazineOwnershipRequests: Doctrine\ORM\PersistentCollection {#249 …}
      +moderatorRequests: Doctrine\ORM\PersistentCollection {#238 …}
      +entries: Doctrine\ORM\PersistentCollection {#196 …}
      +entryVotes: Doctrine\ORM\PersistentCollection {#168 …}
      +entryComments: Doctrine\ORM\PersistentCollection {#141 …}
      +entryCommentVotes: Doctrine\ORM\PersistentCollection {#111 …}
      +posts: Doctrine\ORM\PersistentCollection {#84 …}
      +postVotes: Doctrine\ORM\PersistentCollection {#99 …}
      +postComments: Doctrine\ORM\PersistentCollection {#1863 …}
      +postCommentVotes: Doctrine\ORM\PersistentCollection {#1479 …}
      +subscriptions: Doctrine\ORM\PersistentCollection {#1658 …}
      +subscribedDomains: Doctrine\ORM\PersistentCollection {#1868 …}
      +follows: Doctrine\ORM\PersistentCollection {#1917 …}
      +followers: Doctrine\ORM\PersistentCollection {#1601 …}
      +blocks: Doctrine\ORM\PersistentCollection {#1805 …}
      +blockers: Doctrine\ORM\PersistentCollection {#1810 …}
      +blockedMagazines: Doctrine\ORM\PersistentCollection {#1857 …}
      +blockedDomains: Doctrine\ORM\PersistentCollection {#1860 …}
      +reports: Doctrine\ORM\PersistentCollection {#1791 …}
      +favourites: Doctrine\ORM\PersistentCollection {#2416 …}
      +violations: Doctrine\ORM\PersistentCollection {#1824 …}
      +notifications: Doctrine\ORM\PersistentCollection {#1914 …}
      +awards: Doctrine\ORM\PersistentCollection {#1929 …}
      +subscribedCategories: Doctrine\ORM\PersistentCollection {#1867 …}
      +categories: Doctrine\ORM\PersistentCollection {#1880 …}
      -id: 42482
      -password: "$2y$13$NhIMiF1JXctMkB.To0A1l.9Yf5tUWEmnsXRxLOIoPHjfEy4B2UkMe"
      -totpSecret: null
      -totpBackupCodes: []
      -oAuth2UserConsents: Doctrine\ORM\PersistentCollection {#1894 …}
      +apId: "Yonrak@feddit.uk"
      +apProfileId: "https://feddit.uk/u/Yonrak"
      +apPublicUrl: "https://feddit.uk/u/Yonrak"
      +apFollowersUrl: null
      +apInboxUrl: "https://feddit.uk/inbox"
      +apDomain: "feddit.uk"
      +apPreferredUsername: "Yonrak"
      +apDiscoverable: true
      +apManuallyApprovesFollowers: false
      +privateKey: null
      +publicKey: null
      +apFetchedAt: DateTime @1692955883 {#269
        date: 2023-08-25 11:31:23.0 +02:00
      }
      +apDeletedAt: null
      +apTimeoutAt: null
      +visibility: "visible             "
      +createdAt: DateTimeImmutable @1692950596 {#268
        date: 2023-08-25 10:03:16.0 +02:00
      }
    }
    +entry: Proxies\__CG__\App\Entity\Entry {#1591
      +user: Proxies\__CG__\App\Entity\User {#2459
        +avatar: null
        +cover: null
        +email: "nilclass@discuss.tchncs.de"
        +username: "@nilclass@discuss.tchncs.de"
        +roles: []
        +followersCount: 0
        +homepage: "front"
        +about: null
        +lastActive: DateTime @1721268563 {#3096
          date: 2024-07-18 04:09:23.0 +02:00
        }
        +markedForDeletionAt: null
        +fields: null
        +oauthGithubId: null
        +oauthGoogleId: null
        +oauthFacebookId: null
        +oauthKeycloakId: null
        +hideAdult: true
        +showSubscribedUsers: true
        +showSubscribedMagazines: true
        +showSubscribedDomains: true
        +preferredLanguages: []
        +featuredMagazines: null
        +showProfileSubscriptions: true
        +showProfileFollowings: true
        +markNewComments: false
        +notifyOnNewEntry: false
        +notifyOnNewEntryReply: false
        +notifyOnNewEntryCommentReply: false
        +notifyOnNewPost: false
        +notifyOnNewPostReply: false
        +notifyOnNewPostCommentReply: false
        +addMentionsEntries: false
        +addMentionsPosts: true
        +isBanned: false
        +isVerified: false
        +isDeleted: false
        +isBot: false
        +spamProtection: true
        +customCss: null
        +ignoreMagazinesCustomCss: false
        +moderatorTokens: Doctrine\ORM\PersistentCollection {#3099 …}
        +magazineOwnershipRequests: Doctrine\ORM\PersistentCollection {#3101 …}
        +moderatorRequests: Doctrine\ORM\PersistentCollection {#3103 …}
        +entries: Doctrine\ORM\PersistentCollection {#3105 …}
        +entryVotes: Doctrine\ORM\PersistentCollection {#3107 …}
        +entryComments: Doctrine\ORM\PersistentCollection {#3109 …}
        +entryCommentVotes: Doctrine\ORM\PersistentCollection {#3111 …}
        +posts: Doctrine\ORM\PersistentCollection {#3113 …}
        +postVotes: Doctrine\ORM\PersistentCollection {#3115 …}
        +postComments: Doctrine\ORM\PersistentCollection {#3117 …}
        +postCommentVotes: Doctrine\ORM\PersistentCollection {#3119 …}
        +subscriptions: Doctrine\ORM\PersistentCollection {#3121 …}
        +subscribedDomains: Doctrine\ORM\PersistentCollection {#3123 …}
        +follows: Doctrine\ORM\PersistentCollection {#3125 …}
        +followers: Doctrine\ORM\PersistentCollection {#3127 …}
        +blocks: Doctrine\ORM\PersistentCollection {#3129 …}
        +blockers: Doctrine\ORM\PersistentCollection {#3131 …}
        +blockedMagazines: Doctrine\ORM\PersistentCollection {#3133 …}
        +blockedDomains: Doctrine\ORM\PersistentCollection {#3135 …}
        +reports: Doctrine\ORM\PersistentCollection {#3137 …}
        +favourites: Doctrine\ORM\PersistentCollection {#3139 …}
        +violations: Doctrine\ORM\PersistentCollection {#3141 …}
        +notifications: Doctrine\ORM\PersistentCollection {#3143 …}
        +awards: Doctrine\ORM\PersistentCollection {#3145 …}
        +subscribedCategories: Doctrine\ORM\PersistentCollection {#3147 …}
        +categories: Doctrine\ORM\PersistentCollection {#3149 …}
        -id: 6046
        -password: "$2y$13$FEroXtR95mjA6.omogLZRe7NJuWUL6hb.9a/FfXkqyIPnPgg4Apme"
        -totpSecret: null
        -totpBackupCodes: []
        -oAuth2UserConsents: Doctrine\ORM\PersistentCollection {#3151 …}
        +apId: "nilclass@discuss.tchncs.de"
        +apProfileId: "https://discuss.tchncs.de/u/nilclass"
        +apPublicUrl: "https://discuss.tchncs.de/u/nilclass"
        +apFollowersUrl: null
        +apInboxUrl: "https://discuss.tchncs.de/inbox"
        +apDomain: "discuss.tchncs.de"
        +apPreferredUsername: "nilclass"
        +apDiscoverable: true
        +apManuallyApprovesFollowers: false
        +privateKey: null
        +publicKey: null
        +apFetchedAt: DateTime @1720630912 {#3097
          date: 2024-07-10 19:01:52.0 +02:00
        }
        +apDeletedAt: null
        +apTimeoutAt: null
        +visibility: "visible             "
        +createdAt: DateTimeImmutable @1687291240 {#3098
          date: 2023-06-20 22:00:40.0 +02:00
        }
        +__isInitialized__: true
         …2
      }
      +magazine: Proxies\__CG__\App\Entity\Magazine {#1584
        +icon: Proxies\__CG__\App\Entity\Image {#2886 …}
        +name: "askelectronics@discuss.tchncs.de"
        +title: "askelectronics"
        +description: """
          **For questions about component-level electronic circuits, tools and equipment.**\n
          \n
          Rules\n
          -----\n
          \n
          1: Be nice.\n
          \n
          2: Be on-topic (eg: *Electronic*, not *electrical*).\n
          \n
          3: No commercial stuff, buying, selling or valuations.\n
          \n
          4: Be safe.\n
          \n
          ---
          """
        +rules: null
        +subscriptionsCount: 1
        +entryCount: 154
        +entryCommentCount: 1230
        +postCount: 1
        +postCommentCount: 4
        +isAdult: false
        +customCss: null
        +lastActive: DateTime @1729413608 {#2865
          date: 2024-10-20 10:40:08.0 +02:00
        }
        +markedForDeletionAt: null
        +tags: null
        +moderators: Doctrine\ORM\PersistentCollection {#2885 …}
        +ownershipRequests: Doctrine\ORM\PersistentCollection {#2883 …}
        +moderatorRequests: Doctrine\ORM\PersistentCollection {#2888 …}
        +entries: Doctrine\ORM\PersistentCollection {#2889 …}
        +posts: Doctrine\ORM\PersistentCollection {#2892 …}
        +subscriptions: Doctrine\ORM\PersistentCollection {#2894 …}
        +bans: Doctrine\ORM\PersistentCollection {#2900 …}
        +reports: Doctrine\ORM\PersistentCollection {#2908 …}
        +badges: Doctrine\ORM\PersistentCollection {#2921 …}
        +logs: Doctrine\ORM\PersistentCollection {#2931 …}
        +awards: Doctrine\ORM\PersistentCollection {#2913 …}
        +categories: Doctrine\ORM\PersistentCollection {#2937 …}
        -id: 11
        +apId: "askelectronics@discuss.tchncs.de"
        +apProfileId: "https://discuss.tchncs.de/c/askelectronics"
        +apPublicUrl: "https://discuss.tchncs.de/c/askelectronics"
        +apFollowersUrl: "https://discuss.tchncs.de/c/askelectronics/followers"
        +apInboxUrl: "https://discuss.tchncs.de/inbox"
        +apDomain: "discuss.tchncs.de"
        +apPreferredUsername: "askelectronics"
        +apDiscoverable: true
        +apManuallyApprovesFollowers: null
        +privateKey: null
        +publicKey: null
        +apFetchedAt: DateTime @1727247714 {#2866
          date: 2024-09-25 09:01:54.0 +02:00
        }
        +apDeletedAt: null
        +apTimeoutAt: null
        +visibility: "visible             "
        +createdAt: DateTimeImmutable @1687144409 {#2867
          date: 2023-06-19 05:13:29.0 +02:00
        }
        +__isInitialized__: true
         …2
      }
      +image: null
      +domain: Proxies\__CG__\App\Entity\Domain {#1630 …}
      +slug: "How-to-improve-my-battery-measurement-circuit"
      +title: "How to improve my battery measurement circuit?"
      +url: null
      +body: """
        I am powering a 5V microcontroller (arduino clone, atmega328p) using a 9V block and a buck converter. Now I want to let the microcontroller occasionally measure the battery voltage, so I can get an idea of how full it is.\n
        \n
        My first idea was to use a simple voltage divider:\n
        \n
        ![](https://discuss.tchncs.de/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)\n
        \n
        I’ve chosen the resistor values so that:\n
        \n
        - the voltage at the measure output is `< 1.1V`, to be able to use the 1.1V internal reference of the atmega’s ADC\n
        - `R1 || R2 < 10kΩ`, since the atmega datasheet says “The ADC is optimized for analog signals with an output impedance of approximately 10 kΩ or less”\n
        \n
        This is great and all, but what bothers me is that this circuit will constantly draw ~100µA from the battery.\n
        \n
        So, my next thought was to add a mosfet to the divider, to switch it on only while measuring:\n
        \n
        ![](https://discuss.tchncs.de/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)\n
        \n
        This is obviously bad, because now when the mosfet is off, the ADC input sees the whole battery voltage.\n
        \n
        To address that issue, I’ve added a second mosfet into the measure path:\n
        \n
        ![](https://discuss.tchncs.de/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)\n
        \n
        This works, and it does not draw any current, except while measuring.\n
        \n
        However, it’s quite a few parts. So I’m curious if anyone has an idea how to do this with just a single mosfet. It seems to me like it should be possible, but I haven’t figured out how.\n
        \n
        Oh, and if I’m doing something stupid here, please tell me :)
        """
      +type: "article"
      +lang: "en"
      +isOc: false
      +hasEmbed: false
      +commentCount: 11
      +favouriteCount: 17
      +score: 0
      +isAdult: false
      +sticky: false
      +lastActive: DateTime @1694781042 {#1715
        date: 2023-09-15 14:30:42.0 +02:00
      }
      +ip: null
      +adaAmount: 0
      +tags: null
      +mentions: null
      +comments: Doctrine\ORM\PersistentCollection {#1629 …}
      +votes: Doctrine\ORM\PersistentCollection {#1626 …}
      +reports: Doctrine\ORM\PersistentCollection {#1625 …}
      +favourites: Doctrine\ORM\PersistentCollection {#2370 …}
      +notifications: Doctrine\ORM\PersistentCollection {#2371 …}
      +badges: Doctrine\ORM\PersistentCollection {#1708 …}
      +children: [
        1 => App\Entity\EntryComment {#1709
          +user: App\Entity\User {#265}
          +entry: Proxies\__CG__\App\Entity\Entry {#1591 …2}
          +magazine: Proxies\__CG__\App\Entity\Magazine {#1584 …2}
          +image: null
          +parent: null
          +root: null
          +body: """
            Could you do similar to diagram 2, but instead of an N-FET use a P-FET between the battery and first resistor in the potential divider?\n
            \n
            Add a gate pull up resistor to source to ensure the FET is off by default, have the micro pull the gate down to take a measurement. You’ll probably need to add another resistor on the control pin to 0V to limit the voltage there also, but those two can be much much higher values to really limit current. Or use a zener/TVS diode instead of second resistor to clamp the voltage instead of dividing (more robust).\n
            \n
            Switch it with an NFET\n
            \n
            The micro will see 0V or divided/clamped battery voltage on the measurement pin.
            """
          +lang: "en"
          +isAdult: false
          +favouriteCount: 3
          +score: 0
          +lastActive: DateTime @1692955883 {#1439
            date: 2023-08-25 11:31:23.0 +02:00
          }
          +ip: null
          +tags: null
          +mentions: [
            "@nilclass@discuss.tchncs.de"
          ]
          +children: Doctrine\ORM\PersistentCollection {#1579 …}
          +nested: Doctrine\ORM\PersistentCollection {#1577 …}
          +votes: Doctrine\ORM\PersistentCollection {#1578 …}
          +reports: Doctrine\ORM\PersistentCollection {#1571 …}
          +favourites: Doctrine\ORM\PersistentCollection {#1574 …}
          +notifications: Doctrine\ORM\PersistentCollection {#1667 …}
          -id: 26779
          -bodyTs: "'0v':70,117 '2':7 'add':30,62 'also':76 'anoth':63 'batteri':22,120 'clamp':100 'control':67 'could':1 'current':89 'default':45 'diagram':6 'diod':94 'divid':29,105 'divided/clamped':119 'ensur':39 'fet':14,19,41 'first':24 'gate':32,51 'higher':84 'instead':9,95,103 'limit':72,88 'll':58 'measur':56,124 'micro':48,114 'much':82,83 'n':13 'n-fet':12 'need':60 'nfet':112 'p':18 'p-fet':17 'pin':68,125 'potenti':28 'probabl':59 'pull':33,49 'realli':87 'resistor':25,35,64,98 'robust':107 'second':97 'see':116 'similar':4 'sourc':37 'switch':108 'take':54 'two':79 'use':15,91 'valu':85 'voltag':74,102,121 'zener/tvs':93"
          +ranking: 0
          +commentCount: 0
          +upVotes: 0
          +downVotes: 0
          +visibility: "visible             "
          +apId: "https://feddit.uk/comment/2185380"
          +editedAt: DateTimeImmutable @1692969047 {#1435
            date: 2023-08-25 15:10:47.0 +02:00
          }
          +createdAt: DateTimeImmutable @1692950595 {#1436
            date: 2023-08-25 10:03:15.0 +02:00
          }
          +"title": 26779
        }
        0 => App\Entity\EntryComment {#1549}
      ]
      -id: 1944
      -titleTs: "'batteri':5 'circuit':7 'improv':3 'measur':6"
      -bodyTs: "'/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)':152 '/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)':188 '/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)':53 '1.1':69,77 '10':107 '100µa':127 '10kω':88 '5v':5 '9v':12 'abl':73 'ad':178 'adc':85,95,165 'add':137 'address':173 'analog':99 'anyon':213 'approxim':106 'arduino':7 'atmega':83,91 'atmega328p':9 'bad':156 'batteri':28,130,170 'block':13 'bother':118 'buck':16 'chosen':56 'circuit':123 'clone':8 'constant':125 'convert':17 'curious':211 'current':197 'datasheet':92 'discuss.tchncs.de':52,151,187 'discuss.tchncs.de/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)':150 'discuss.tchncs.de/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)':186 'discuss.tchncs.de/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)':51 'divid':50,142 'draw':126,195 'except':198 'figur':239 'first':42 'full':38 'get':33 'great':113 'haven':237 'howev':201 'idea':35,43,216 'imped':104 'input':166 'intern':79 'issu':175 'kω':108 'less':110 'let':22 'like':230 'm':210,246 'measur':26,66,149,184,200 'microcontrol':6,24 'mosfet':139,161,181,225 'next':133 'obvious':155 'occasion':25 'oh':242 'optim':97 'output':67,103 'part':207 'path':185 'pleas':251 'possibl':234 'power':3 'quit':204 'r1':86 'r2':87 'refer':80 'resistor':58 'say':93 'second':180 'see':167 'seem':227 'signal':100 'simpl':48 'sinc':89 'singl':224 'someth':248 'stupid':249 'switch':144 'tell':252 'thought':134 'use':10,46,75 'v':70,78 'valu':59 've':55,177 'voltag':29,49,63,171 'want':20 'whole':169 'work':190"
      +cross: false
      +upVotes: 0
      +downVotes: 0
      +ranking: 1693029637
      +visibility: "visible             "
      +apId: "https://discuss.tchncs.de/post/2309537"
      +editedAt: DateTimeImmutable @1692947232 {#1693
        date: 2023-08-25 09:07:12.0 +02:00
      }
      +createdAt: DateTimeImmutable @1692947137 {#1740
        date: 2023-08-25 09:05:37.0 +02:00
      }
      +__isInitialized__: true
       …2
    }
    +magazine: Proxies\__CG__\App\Entity\Magazine {#1584 …2}
    +image: null
    +parent: Proxies\__CG__\App\Entity\EntryComment {#1692 …}
    +root: App\Entity\EntryComment {#1709}
    +body: """
      > Not sure I understand this point. Which resistor would you replace with a diode?\n
      \n
      Sorry, I think I was talking nonesense (doing this in my head and just woke up 😅).\n
      \n
      Not sure it’ll work with just a P-FET actually. You’ll likely need to control the PFET with a NFET, otherwise you still end up with too high a voltage on your control pin when the FET is off due to the gate pullup (unless you can use a fet with a very high Vgs Threshold and then drive it push/pull from the micro, but this isn’t really best practice).\n
      \n
      The above comment about diodes was to protect the microcontroller pin, but you end up not being able to control the FET doing it that way.\n
      \n
      I think either your existing Option 3 or PFET upstream of the divider, switched via an N-FET is the way to go.
      """
    +lang: "en"
    +isAdult: false
    +favouriteCount: 2
    +score: 0
    +lastActive: DateTime @1692955881 {#1673
      date: 2023-08-25 11:31:21.0 +02:00
    }
    +ip: null
    +tags: null
    +mentions: [
      "@nilclass@discuss.tchncs.de"
      "@Yonrak@feddit.uk"
    ]
    +children: Doctrine\ORM\PersistentCollection {#1691 …}
    +nested: Doctrine\ORM\PersistentCollection {#1680 …}
    +votes: Doctrine\ORM\PersistentCollection {#1683 …}
    +reports: Doctrine\ORM\PersistentCollection {#1702 …}
    +favourites: Doctrine\ORM\PersistentCollection {#1596 …}
    +notifications: Doctrine\ORM\PersistentCollection {#1613 …}
    -id: 26782
    -bodyTs: "'3':137 'abl':122 'actual':42 'best':103 'comment':107 'control':48,66,124 'diod':14,109 'divid':143 'drive':92 'due':73 'either':133 'end':57,118 'exist':135 'fet':41,70,83,126,149 'gate':76 'go':154 'head':26 'high':61,87 'isn':100 'like':45 'll':34,44 'micro':97 'microcontrol':114 'n':148 'n-fet':147 'need':46 'nfet':53 'nonesens':21 'option':136 'otherwis':54 'p':40 'p-fet':39 'pfet':50,139 'pin':67,115 'point':6 'practic':104 'protect':112 'pullup':77 'push/pull':94 'realli':102 'replac':11 'resistor':8 'sorri':15 'still':56 'sure':2,32 'switch':144 'talk':20 'think':17,132 'threshold':89 'understand':4 'unless':78 'upstream':140 'use':81 'vgs':88 'via':145 'voltag':63 'way':130,152 'woke':29 'work':35 'would':9"
    +ranking: 0
    +commentCount: 0
    +upVotes: 0
    +downVotes: 0
    +visibility: "visible             "
    +apId: "https://feddit.uk/comment/2186641"
    +editedAt: DateTimeImmutable @1692956099 {#1560
      date: 2023-08-25 11:34:59.0 +02:00
    }
    +createdAt: DateTimeImmutable @1692955881 {#1568
      date: 2023-08-25 11:31:21.0 +02:00
    }
    +"title": 26782
  }
]
Attributes
[]
Component
App\Twig\Components\BoostComponent {#4736
  +formDest: "entry_comment"
  +subject: App\Entity\EntryComment {#1549
    +user: App\Entity\User {#265
      +avatar: null
      +cover: null
      +email: "Yonrak@feddit.uk"
      +username: "@Yonrak@feddit.uk"
      +roles: []
      +followersCount: 0
      +homepage: "front"
      +about: null
      +lastActive: DateTime @1692955883 {#275
        date: 2023-08-25 11:31:23.0 +02:00
      }
      +markedForDeletionAt: null
      +fields: null
      +oauthGithubId: null
      +oauthGoogleId: null
      +oauthFacebookId: null
      +oauthKeycloakId: null
      +hideAdult: true
      +showSubscribedUsers: true
      +showSubscribedMagazines: true
      +showSubscribedDomains: true
      +preferredLanguages: []
      +featuredMagazines: null
      +showProfileSubscriptions: false
      +showProfileFollowings: true
      +markNewComments: false
      +notifyOnNewEntry: false
      +notifyOnNewEntryReply: true
      +notifyOnNewEntryCommentReply: true
      +notifyOnNewPost: false
      +notifyOnNewPostReply: true
      +notifyOnNewPostCommentReply: true
      +addMentionsEntries: false
      +addMentionsPosts: true
      +isBanned: false
      +isVerified: false
      +isDeleted: false
      +isBot: false
      +spamProtection: true
      +customCss: null
      +ignoreMagazinesCustomCss: false
      +moderatorTokens: Doctrine\ORM\PersistentCollection {#253 …}
      +magazineOwnershipRequests: Doctrine\ORM\PersistentCollection {#249 …}
      +moderatorRequests: Doctrine\ORM\PersistentCollection {#238 …}
      +entries: Doctrine\ORM\PersistentCollection {#196 …}
      +entryVotes: Doctrine\ORM\PersistentCollection {#168 …}
      +entryComments: Doctrine\ORM\PersistentCollection {#141 …}
      +entryCommentVotes: Doctrine\ORM\PersistentCollection {#111 …}
      +posts: Doctrine\ORM\PersistentCollection {#84 …}
      +postVotes: Doctrine\ORM\PersistentCollection {#99 …}
      +postComments: Doctrine\ORM\PersistentCollection {#1863 …}
      +postCommentVotes: Doctrine\ORM\PersistentCollection {#1479 …}
      +subscriptions: Doctrine\ORM\PersistentCollection {#1658 …}
      +subscribedDomains: Doctrine\ORM\PersistentCollection {#1868 …}
      +follows: Doctrine\ORM\PersistentCollection {#1917 …}
      +followers: Doctrine\ORM\PersistentCollection {#1601 …}
      +blocks: Doctrine\ORM\PersistentCollection {#1805 …}
      +blockers: Doctrine\ORM\PersistentCollection {#1810 …}
      +blockedMagazines: Doctrine\ORM\PersistentCollection {#1857 …}
      +blockedDomains: Doctrine\ORM\PersistentCollection {#1860 …}
      +reports: Doctrine\ORM\PersistentCollection {#1791 …}
      +favourites: Doctrine\ORM\PersistentCollection {#2416 …}
      +violations: Doctrine\ORM\PersistentCollection {#1824 …}
      +notifications: Doctrine\ORM\PersistentCollection {#1914 …}
      +awards: Doctrine\ORM\PersistentCollection {#1929 …}
      +subscribedCategories: Doctrine\ORM\PersistentCollection {#1867 …}
      +categories: Doctrine\ORM\PersistentCollection {#1880 …}
      -id: 42482
      -password: "$2y$13$NhIMiF1JXctMkB.To0A1l.9Yf5tUWEmnsXRxLOIoPHjfEy4B2UkMe"
      -totpSecret: null
      -totpBackupCodes: []
      -oAuth2UserConsents: Doctrine\ORM\PersistentCollection {#1894 …}
      +apId: "Yonrak@feddit.uk"
      +apProfileId: "https://feddit.uk/u/Yonrak"
      +apPublicUrl: "https://feddit.uk/u/Yonrak"
      +apFollowersUrl: null
      +apInboxUrl: "https://feddit.uk/inbox"
      +apDomain: "feddit.uk"
      +apPreferredUsername: "Yonrak"
      +apDiscoverable: true
      +apManuallyApprovesFollowers: false
      +privateKey: null
      +publicKey: null
      +apFetchedAt: DateTime @1692955883 {#269
        date: 2023-08-25 11:31:23.0 +02:00
      }
      +apDeletedAt: null
      +apTimeoutAt: null
      +visibility: "visible             "
      +createdAt: DateTimeImmutable @1692950596 {#268
        date: 2023-08-25 10:03:16.0 +02:00
      }
    }
    +entry: Proxies\__CG__\App\Entity\Entry {#1591
      +user: Proxies\__CG__\App\Entity\User {#2459
        +avatar: null
        +cover: null
        +email: "nilclass@discuss.tchncs.de"
        +username: "@nilclass@discuss.tchncs.de"
        +roles: []
        +followersCount: 0
        +homepage: "front"
        +about: null
        +lastActive: DateTime @1721268563 {#3096
          date: 2024-07-18 04:09:23.0 +02:00
        }
        +markedForDeletionAt: null
        +fields: null
        +oauthGithubId: null
        +oauthGoogleId: null
        +oauthFacebookId: null
        +oauthKeycloakId: null
        +hideAdult: true
        +showSubscribedUsers: true
        +showSubscribedMagazines: true
        +showSubscribedDomains: true
        +preferredLanguages: []
        +featuredMagazines: null
        +showProfileSubscriptions: true
        +showProfileFollowings: true
        +markNewComments: false
        +notifyOnNewEntry: false
        +notifyOnNewEntryReply: false
        +notifyOnNewEntryCommentReply: false
        +notifyOnNewPost: false
        +notifyOnNewPostReply: false
        +notifyOnNewPostCommentReply: false
        +addMentionsEntries: false
        +addMentionsPosts: true
        +isBanned: false
        +isVerified: false
        +isDeleted: false
        +isBot: false
        +spamProtection: true
        +customCss: null
        +ignoreMagazinesCustomCss: false
        +moderatorTokens: Doctrine\ORM\PersistentCollection {#3099 …}
        +magazineOwnershipRequests: Doctrine\ORM\PersistentCollection {#3101 …}
        +moderatorRequests: Doctrine\ORM\PersistentCollection {#3103 …}
        +entries: Doctrine\ORM\PersistentCollection {#3105 …}
        +entryVotes: Doctrine\ORM\PersistentCollection {#3107 …}
        +entryComments: Doctrine\ORM\PersistentCollection {#3109 …}
        +entryCommentVotes: Doctrine\ORM\PersistentCollection {#3111 …}
        +posts: Doctrine\ORM\PersistentCollection {#3113 …}
        +postVotes: Doctrine\ORM\PersistentCollection {#3115 …}
        +postComments: Doctrine\ORM\PersistentCollection {#3117 …}
        +postCommentVotes: Doctrine\ORM\PersistentCollection {#3119 …}
        +subscriptions: Doctrine\ORM\PersistentCollection {#3121 …}
        +subscribedDomains: Doctrine\ORM\PersistentCollection {#3123 …}
        +follows: Doctrine\ORM\PersistentCollection {#3125 …}
        +followers: Doctrine\ORM\PersistentCollection {#3127 …}
        +blocks: Doctrine\ORM\PersistentCollection {#3129 …}
        +blockers: Doctrine\ORM\PersistentCollection {#3131 …}
        +blockedMagazines: Doctrine\ORM\PersistentCollection {#3133 …}
        +blockedDomains: Doctrine\ORM\PersistentCollection {#3135 …}
        +reports: Doctrine\ORM\PersistentCollection {#3137 …}
        +favourites: Doctrine\ORM\PersistentCollection {#3139 …}
        +violations: Doctrine\ORM\PersistentCollection {#3141 …}
        +notifications: Doctrine\ORM\PersistentCollection {#3143 …}
        +awards: Doctrine\ORM\PersistentCollection {#3145 …}
        +subscribedCategories: Doctrine\ORM\PersistentCollection {#3147 …}
        +categories: Doctrine\ORM\PersistentCollection {#3149 …}
        -id: 6046
        -password: "$2y$13$FEroXtR95mjA6.omogLZRe7NJuWUL6hb.9a/FfXkqyIPnPgg4Apme"
        -totpSecret: null
        -totpBackupCodes: []
        -oAuth2UserConsents: Doctrine\ORM\PersistentCollection {#3151 …}
        +apId: "nilclass@discuss.tchncs.de"
        +apProfileId: "https://discuss.tchncs.de/u/nilclass"
        +apPublicUrl: "https://discuss.tchncs.de/u/nilclass"
        +apFollowersUrl: null
        +apInboxUrl: "https://discuss.tchncs.de/inbox"
        +apDomain: "discuss.tchncs.de"
        +apPreferredUsername: "nilclass"
        +apDiscoverable: true
        +apManuallyApprovesFollowers: false
        +privateKey: null
        +publicKey: null
        +apFetchedAt: DateTime @1720630912 {#3097
          date: 2024-07-10 19:01:52.0 +02:00
        }
        +apDeletedAt: null
        +apTimeoutAt: null
        +visibility: "visible             "
        +createdAt: DateTimeImmutable @1687291240 {#3098
          date: 2023-06-20 22:00:40.0 +02:00
        }
        +__isInitialized__: true
         …2
      }
      +magazine: Proxies\__CG__\App\Entity\Magazine {#1584
        +icon: Proxies\__CG__\App\Entity\Image {#2886 …}
        +name: "askelectronics@discuss.tchncs.de"
        +title: "askelectronics"
        +description: """
          **For questions about component-level electronic circuits, tools and equipment.**\n
          \n
          Rules\n
          -----\n
          \n
          1: Be nice.\n
          \n
          2: Be on-topic (eg: *Electronic*, not *electrical*).\n
          \n
          3: No commercial stuff, buying, selling or valuations.\n
          \n
          4: Be safe.\n
          \n
          ---
          """
        +rules: null
        +subscriptionsCount: 1
        +entryCount: 154
        +entryCommentCount: 1230
        +postCount: 1
        +postCommentCount: 4
        +isAdult: false
        +customCss: null
        +lastActive: DateTime @1729413608 {#2865
          date: 2024-10-20 10:40:08.0 +02:00
        }
        +markedForDeletionAt: null
        +tags: null
        +moderators: Doctrine\ORM\PersistentCollection {#2885 …}
        +ownershipRequests: Doctrine\ORM\PersistentCollection {#2883 …}
        +moderatorRequests: Doctrine\ORM\PersistentCollection {#2888 …}
        +entries: Doctrine\ORM\PersistentCollection {#2889 …}
        +posts: Doctrine\ORM\PersistentCollection {#2892 …}
        +subscriptions: Doctrine\ORM\PersistentCollection {#2894 …}
        +bans: Doctrine\ORM\PersistentCollection {#2900 …}
        +reports: Doctrine\ORM\PersistentCollection {#2908 …}
        +badges: Doctrine\ORM\PersistentCollection {#2921 …}
        +logs: Doctrine\ORM\PersistentCollection {#2931 …}
        +awards: Doctrine\ORM\PersistentCollection {#2913 …}
        +categories: Doctrine\ORM\PersistentCollection {#2937 …}
        -id: 11
        +apId: "askelectronics@discuss.tchncs.de"
        +apProfileId: "https://discuss.tchncs.de/c/askelectronics"
        +apPublicUrl: "https://discuss.tchncs.de/c/askelectronics"
        +apFollowersUrl: "https://discuss.tchncs.de/c/askelectronics/followers"
        +apInboxUrl: "https://discuss.tchncs.de/inbox"
        +apDomain: "discuss.tchncs.de"
        +apPreferredUsername: "askelectronics"
        +apDiscoverable: true
        +apManuallyApprovesFollowers: null
        +privateKey: null
        +publicKey: null
        +apFetchedAt: DateTime @1727247714 {#2866
          date: 2024-09-25 09:01:54.0 +02:00
        }
        +apDeletedAt: null
        +apTimeoutAt: null
        +visibility: "visible             "
        +createdAt: DateTimeImmutable @1687144409 {#2867
          date: 2023-06-19 05:13:29.0 +02:00
        }
        +__isInitialized__: true
         …2
      }
      +image: null
      +domain: Proxies\__CG__\App\Entity\Domain {#1630 …}
      +slug: "How-to-improve-my-battery-measurement-circuit"
      +title: "How to improve my battery measurement circuit?"
      +url: null
      +body: """
        I am powering a 5V microcontroller (arduino clone, atmega328p) using a 9V block and a buck converter. Now I want to let the microcontroller occasionally measure the battery voltage, so I can get an idea of how full it is.\n
        \n
        My first idea was to use a simple voltage divider:\n
        \n
        ![](https://discuss.tchncs.de/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)\n
        \n
        I’ve chosen the resistor values so that:\n
        \n
        - the voltage at the measure output is `< 1.1V`, to be able to use the 1.1V internal reference of the atmega’s ADC\n
        - `R1 || R2 < 10kΩ`, since the atmega datasheet says “The ADC is optimized for analog signals with an output impedance of approximately 10 kΩ or less”\n
        \n
        This is great and all, but what bothers me is that this circuit will constantly draw ~100µA from the battery.\n
        \n
        So, my next thought was to add a mosfet to the divider, to switch it on only while measuring:\n
        \n
        ![](https://discuss.tchncs.de/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)\n
        \n
        This is obviously bad, because now when the mosfet is off, the ADC input sees the whole battery voltage.\n
        \n
        To address that issue, I’ve added a second mosfet into the measure path:\n
        \n
        ![](https://discuss.tchncs.de/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)\n
        \n
        This works, and it does not draw any current, except while measuring.\n
        \n
        However, it’s quite a few parts. So I’m curious if anyone has an idea how to do this with just a single mosfet. It seems to me like it should be possible, but I haven’t figured out how.\n
        \n
        Oh, and if I’m doing something stupid here, please tell me :)
        """
      +type: "article"
      +lang: "en"
      +isOc: false
      +hasEmbed: false
      +commentCount: 11
      +favouriteCount: 17
      +score: 0
      +isAdult: false
      +sticky: false
      +lastActive: DateTime @1694781042 {#1715
        date: 2023-09-15 14:30:42.0 +02:00
      }
      +ip: null
      +adaAmount: 0
      +tags: null
      +mentions: null
      +comments: Doctrine\ORM\PersistentCollection {#1629 …}
      +votes: Doctrine\ORM\PersistentCollection {#1626 …}
      +reports: Doctrine\ORM\PersistentCollection {#1625 …}
      +favourites: Doctrine\ORM\PersistentCollection {#2370 …}
      +notifications: Doctrine\ORM\PersistentCollection {#2371 …}
      +badges: Doctrine\ORM\PersistentCollection {#1708 …}
      +children: [
        1 => App\Entity\EntryComment {#1709
          +user: App\Entity\User {#265}
          +entry: Proxies\__CG__\App\Entity\Entry {#1591 …2}
          +magazine: Proxies\__CG__\App\Entity\Magazine {#1584 …2}
          +image: null
          +parent: null
          +root: null
          +body: """
            Could you do similar to diagram 2, but instead of an N-FET use a P-FET between the battery and first resistor in the potential divider?\n
            \n
            Add a gate pull up resistor to source to ensure the FET is off by default, have the micro pull the gate down to take a measurement. You’ll probably need to add another resistor on the control pin to 0V to limit the voltage there also, but those two can be much much higher values to really limit current. Or use a zener/TVS diode instead of second resistor to clamp the voltage instead of dividing (more robust).\n
            \n
            Switch it with an NFET\n
            \n
            The micro will see 0V or divided/clamped battery voltage on the measurement pin.
            """
          +lang: "en"
          +isAdult: false
          +favouriteCount: 3
          +score: 0
          +lastActive: DateTime @1692955883 {#1439
            date: 2023-08-25 11:31:23.0 +02:00
          }
          +ip: null
          +tags: null
          +mentions: [
            "@nilclass@discuss.tchncs.de"
          ]
          +children: Doctrine\ORM\PersistentCollection {#1579 …}
          +nested: Doctrine\ORM\PersistentCollection {#1577 …}
          +votes: Doctrine\ORM\PersistentCollection {#1578 …}
          +reports: Doctrine\ORM\PersistentCollection {#1571 …}
          +favourites: Doctrine\ORM\PersistentCollection {#1574 …}
          +notifications: Doctrine\ORM\PersistentCollection {#1667 …}
          -id: 26779
          -bodyTs: "'0v':70,117 '2':7 'add':30,62 'also':76 'anoth':63 'batteri':22,120 'clamp':100 'control':67 'could':1 'current':89 'default':45 'diagram':6 'diod':94 'divid':29,105 'divided/clamped':119 'ensur':39 'fet':14,19,41 'first':24 'gate':32,51 'higher':84 'instead':9,95,103 'limit':72,88 'll':58 'measur':56,124 'micro':48,114 'much':82,83 'n':13 'n-fet':12 'need':60 'nfet':112 'p':18 'p-fet':17 'pin':68,125 'potenti':28 'probabl':59 'pull':33,49 'realli':87 'resistor':25,35,64,98 'robust':107 'second':97 'see':116 'similar':4 'sourc':37 'switch':108 'take':54 'two':79 'use':15,91 'valu':85 'voltag':74,102,121 'zener/tvs':93"
          +ranking: 0
          +commentCount: 0
          +upVotes: 0
          +downVotes: 0
          +visibility: "visible             "
          +apId: "https://feddit.uk/comment/2185380"
          +editedAt: DateTimeImmutable @1692969047 {#1435
            date: 2023-08-25 15:10:47.0 +02:00
          }
          +createdAt: DateTimeImmutable @1692950595 {#1436
            date: 2023-08-25 10:03:15.0 +02:00
          }
          +"title": 26779
        }
        0 => App\Entity\EntryComment {#1549}
      ]
      -id: 1944
      -titleTs: "'batteri':5 'circuit':7 'improv':3 'measur':6"
      -bodyTs: "'/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)':152 '/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)':188 '/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)':53 '1.1':69,77 '10':107 '100µa':127 '10kω':88 '5v':5 '9v':12 'abl':73 'ad':178 'adc':85,95,165 'add':137 'address':173 'analog':99 'anyon':213 'approxim':106 'arduino':7 'atmega':83,91 'atmega328p':9 'bad':156 'batteri':28,130,170 'block':13 'bother':118 'buck':16 'chosen':56 'circuit':123 'clone':8 'constant':125 'convert':17 'curious':211 'current':197 'datasheet':92 'discuss.tchncs.de':52,151,187 'discuss.tchncs.de/pictrs/image/450dc371-58d0-4eb0-8f3b-4e76bf676bf4.png)':150 'discuss.tchncs.de/pictrs/image/970e3840-fcbb-46dd-92fb-8903b89149a0.png)':186 'discuss.tchncs.de/pictrs/image/9d173f1d-8412-4129-8ae1-c549a7895107.png)':51 'divid':50,142 'draw':126,195 'except':198 'figur':239 'first':42 'full':38 'get':33 'great':113 'haven':237 'howev':201 'idea':35,43,216 'imped':104 'input':166 'intern':79 'issu':175 'kω':108 'less':110 'let':22 'like':230 'm':210,246 'measur':26,66,149,184,200 'microcontrol':6,24 'mosfet':139,161,181,225 'next':133 'obvious':155 'occasion':25 'oh':242 'optim':97 'output':67,103 'part':207 'path':185 'pleas':251 'possibl':234 'power':3 'quit':204 'r1':86 'r2':87 'refer':80 'resistor':58 'say':93 'second':180 'see':167 'seem':227 'signal':100 'simpl':48 'sinc':89 'singl':224 'someth':248 'stupid':249 'switch':144 'tell':252 'thought':134 'use':10,46,75 'v':70,78 'valu':59 've':55,177 'voltag':29,49,63,171 'want':20 'whole':169 'work':190"
      +cross: false
      +upVotes: 0
      +downVotes: 0
      +ranking: 1693029637
      +visibility: "visible             "
      +apId: "https://discuss.tchncs.de/post/2309537"
      +editedAt: DateTimeImmutable @1692947232 {#1693
        date: 2023-08-25 09:07:12.0 +02:00
      }
      +createdAt: DateTimeImmutable @1692947137 {#1740
        date: 2023-08-25 09:05:37.0 +02:00
      }
      +__isInitialized__: true
       …2
    }
    +magazine: Proxies\__CG__\App\Entity\Magazine {#1584 …2}
    +image: null
    +parent: Proxies\__CG__\App\Entity\EntryComment {#1692 …}
    +root: App\Entity\EntryComment {#1709}
    +body: """
      > Not sure I understand this point. Which resistor would you replace with a diode?\n
      \n
      Sorry, I think I was talking nonesense (doing this in my head and just woke up 😅).\n
      \n
      Not sure it’ll work with just a P-FET actually. You’ll likely need to control the PFET with a NFET, otherwise you still end up with too high a voltage on your control pin when the FET is off due to the gate pullup (unless you can use a fet with a very high Vgs Threshold and then drive it push/pull from the micro, but this isn’t really best practice).\n
      \n
      The above comment about diodes was to protect the microcontroller pin, but you end up not being able to control the FET doing it that way.\n
      \n
      I think either your existing Option 3 or PFET upstream of the divider, switched via an N-FET is the way to go.
      """
    +lang: "en"
    +isAdult: false
    +favouriteCount: 2
    +score: 0
    +lastActive: DateTime @1692955881 {#1673
      date: 2023-08-25 11:31:21.0 +02:00
    }
    +ip: null
    +tags: null
    +mentions: [
      "@nilclass@discuss.tchncs.de"
      "@Yonrak@feddit.uk"
    ]
    +children: Doctrine\ORM\PersistentCollection {#1691 …}
    +nested: Doctrine\ORM\PersistentCollection {#1680 …}
    +votes: Doctrine\ORM\PersistentCollection {#1683 …}
    +reports: Doctrine\ORM\PersistentCollection {#1702 …}
    +favourites: Doctrine\ORM\PersistentCollection {#1596 …}
    +notifications: Doctrine\ORM\PersistentCollection {#1613 …}
    -id: 26782
    -bodyTs: "'3':137 'abl':122 'actual':42 'best':103 'comment':107 'control':48,66,124 'diod':14,109 'divid':143 'drive':92 'due':73 'either':133 'end':57,118 'exist':135 'fet':41,70,83,126,149 'gate':76 'go':154 'head':26 'high':61,87 'isn':100 'like':45 'll':34,44 'micro':97 'microcontrol':114 'n':148 'n-fet':147 'need':46 'nfet':53 'nonesens':21 'option':136 'otherwis':54 'p':40 'p-fet':39 'pfet':50,139 'pin':67,115 'point':6 'practic':104 'protect':112 'pullup':77 'push/pull':94 'realli':102 'replac':11 'resistor':8 'sorri':15 'still':56 'sure':2,32 'switch':144 'talk':20 'think':17,132 'threshold':89 'understand':4 'unless':78 'upstream':140 'use':81 'vgs':88 'via':145 'voltag':63 'way':130,152 'woke':29 'work':35 'would':9"
    +ranking: 0
    +commentCount: 0
    +upVotes: 0
    +downVotes: 0
    +visibility: "visible             "
    +apId: "https://feddit.uk/comment/2186641"
    +editedAt: DateTimeImmutable @1692956099 {#1560
      date: 2023-08-25 11:34:59.0 +02:00
    }
    +createdAt: DateTimeImmutable @1692955881 {#1568
      date: 2023-08-25 11:31:21.0 +02:00
    }
    +"title": 26782
  }
  -cache: Symfony\Component\Cache\Adapter\TraceableTagAwareAdapter {#600 …}
}
settings_row_enum App\Twig\Components\SettingsRowEnumComponent 12.0 MiB 0.28 ms
Input props
[
  "label" => "Sidebar position"
  "settingsKey" => "KBIN_GENERAL_SIDEBAR_POSITION"
  "values" => [
    [
      "name" => "Left"
      "value" => "LEFT"
    ]
    [
      "name" => "Right"
      "value" => "RIGHT"
    ]
  ]
  "defaultValue" => "RIGHT"
]
Attributes
[]
Component
App\Twig\Components\SettingsRowEnumComponent {#5114
  +label: "Sidebar position"
  +help: ""
  +settingsKey: "KBIN_GENERAL_SIDEBAR_POSITION"
  +values: [
    [
      "name" => "Left"
      "value" => "LEFT"
    ]
    [
      "name" => "Right"
      "value" => "RIGHT"
    ]
  ]
  +defaultValue: "RIGHT"
  +reloadRequired: true
}
settings_row_switch App\Twig\Components\SettingsRowSwitchComponent 12.0 MiB 0.21 ms
Input props
[
  "label" => "Dynamic lists"
  "settingsKey" => "KBIN_GENERAL_DYNAMIC_LISTS"
]
Attributes
[]
Component
App\Twig\Components\SettingsRowSwitchComponent {#5186
  +label: "Dynamic lists"
  +help: ""
  +settingsKey: "KBIN_GENERAL_DYNAMIC_LISTS"
  +defaultValue: false
  +reloadRequired: true
}
settings_row_switch App\Twig\Components\SettingsRowSwitchComponent 12.0 MiB 0.19 ms
Input props
[
  "label" => "Rounded edges"
  "settingsKey" => "KBIN_GENERAL_ROUNDED_EDGES"
]
Attributes
[]
Component
App\Twig\Components\SettingsRowSwitchComponent {#5249
  +label: "Rounded edges"
  +help: ""
  +settingsKey: "KBIN_GENERAL_ROUNDED_EDGES"
  +defaultValue: false
  +reloadRequired: true
}
settings_row_switch App\Twig\Components\SettingsRowSwitchComponent 12.0 MiB 0.15 ms
Input props
[
  "label" => "Infinite scrolling"
  "help" => "Automatically load more content when you reach the bottom of the page."
  "settingsKey" => "KBIN_GENERAL_INFINITE_SCROLL"
]
Attributes
[]
Component
App\Twig\Components\SettingsRowSwitchComponent {#5305
  +label: "Infinite scrolling"
  +help: "Automatically load more content when you reach the bottom of the page."
  +settingsKey: "KBIN_GENERAL_INFINITE_SCROLL"
  +defaultValue: false
  +reloadRequired: true
}
settings_row_switch App\Twig\Components\SettingsRowSwitchComponent 12.0 MiB 0.14 ms
Input props
[
  "label" => "Sticky navbar"
  "help" => "The navbar will stick to the top of the page when you scroll down."
  "settingsKey" => "KBIN_GENERAL_FIXED_NAVBAR"
]
Attributes
[]
Component
App\Twig\Components\SettingsRowSwitchComponent {#5364
  +label: "Sticky navbar"
  +help: "The navbar will stick to the top of the page when you scroll down."
  +settingsKey: "KBIN_GENERAL_FIXED_NAVBAR"
  +defaultValue: false
  +reloadRequired: true
}
settings_row_switch App\Twig\Components\SettingsRowSwitchComponent 12.0 MiB 0.16 ms
Input props
[
  "label" => "Show top bar"
  "settingsKey" => "KBIN_GENERAL_TOPBAR"
]
Attributes
[]
Component
App\Twig\Components\SettingsRowSwitchComponent {#5420
  +label: "Show top bar"
  +help: ""
  +settingsKey: "KBIN_GENERAL_TOPBAR"
  +defaultValue: false
  +reloadRequired: true
}
settings_row_switch App\Twig\Components\SettingsRowSwitchComponent 12.0 MiB 0.15 ms
Input props
[
  "label" => "Turbo mode (experimental)"
  "settingsKey" => "KBIN_GENERAL_TURBO"
]
Attributes
[]
Component
App\Twig\Components\SettingsRowSwitchComponent {#5476
  +label: "Turbo mode (experimental)"
  +help: ""
  +settingsKey: "KBIN_GENERAL_TURBO"
  +defaultValue: false
  +reloadRequired: true
}
user_settings_row_switch App\Twig\Components\UserSettingsRowSwitchComponent 12.0 MiB 0.29 ms
Input props
[
  "label" => "Mark new comments"
  "settingsKey" => "KBIN_MARK_NEW_COMMENTS"
]
Attributes
[]
Component
App\Twig\Components\UserSettingsRowSwitchComponent {#5534
  +label: "Mark new comments"
  +help: ""
  +settingsKey: "KBIN_MARK_NEW_COMMENTS"
  +defaultValue: false
  +reloadRequired: true
}
settings_row_switch App\Twig\Components\SettingsRowSwitchComponent 12.0 MiB 0.16 ms
Input props
[
  "label" => "Show "Support Us" block"
  "settingsKey" => "KBIN_GENERAL_SUPPORT_US_BLOCK"
  "defaultValue" => true
]
Attributes
[]
Component
App\Twig\Components\SettingsRowSwitchComponent {#5597
  +label: "Show "Support Us" block"
  +help: ""
  +settingsKey: "KBIN_GENERAL_SUPPORT_US_BLOCK"
  +defaultValue: true
  +reloadRequired: true
}
user_settings_row_switch App\Twig\Components\UserSettingsRowSwitchComponent 12.0 MiB 0.18 ms
Input props
[
  "label" => "Show subscribed users"
  "settingsKey" => "KBIN_SUB_CHANNEL_USERS"
]
Attributes
[]
Component
App\Twig\Components\UserSettingsRowSwitchComponent {#5655
  +label: "Show subscribed users"
  +help: ""
  +settingsKey: "KBIN_SUB_CHANNEL_USERS"
  +defaultValue: false
  +reloadRequired: true
}
user_settings_row_switch App\Twig\Components\UserSettingsRowSwitchComponent 12.0 MiB 0.17 ms
Input props
[
  "label" => "Show subscribed magazines"
  "settingsKey" => "KBIN_SUB_CHANNEL_MAGAZINES"
]
Attributes
[]
Component
App\Twig\Components\UserSettingsRowSwitchComponent {#5711
  +label: "Show subscribed magazines"
  +help: ""
  +settingsKey: "KBIN_SUB_CHANNEL_MAGAZINES"
  +defaultValue: false
  +reloadRequired: true
}
user_settings_row_switch App\Twig\Components\UserSettingsRowSwitchComponent 12.0 MiB 0.16 ms
Input props
[
  "label" => "Show subscribed domains"
  "settingsKey" => "KBIN_SUB_CHANNEL_DOMAINS"
]
Attributes
[]
Component
App\Twig\Components\UserSettingsRowSwitchComponent {#5767
  +label: "Show subscribed domains"
  +help: ""
  +settingsKey: "KBIN_SUB_CHANNEL_DOMAINS"
  +defaultValue: false
  +reloadRequired: true
}
settings_row_switch App\Twig\Components\SettingsRowSwitchComponent 12.0 MiB 0.15 ms
Input props
[
  "label" => "Auto media preview"
  "help" => "Automatically expand media previews."
  "settingsKey" => "KBIN_ENTRIES_SHOW_PREVIEW"
]
Attributes
[]
Component
App\Twig\Components\SettingsRowSwitchComponent {#5823
  +label: "Auto media preview"
  +help: "Automatically expand media previews."
  +settingsKey: "KBIN_ENTRIES_SHOW_PREVIEW"
  +defaultValue: false
  +reloadRequired: true
}
settings_row_switch App\Twig\Components\SettingsRowSwitchComponent 12.0 MiB 0.16 ms
Input props
[
  "label" => "Compact view"
  "settingsKey" => "KBIN_ENTRIES_COMPACT"
]
Attributes
[]
Component
App\Twig\Components\SettingsRowSwitchComponent {#5879
  +label: "Compact view"
  +help: ""
  +settingsKey: "KBIN_ENTRIES_COMPACT"
  +defaultValue: false
  +reloadRequired: true
}
settings_row_switch App\Twig\Components\SettingsRowSwitchComponent 12.0 MiB 0.17 ms
Input props
[
  "label" => "Show users’ avatars"
  "settingsKey" => "KBIN_ENTRIES_SHOW_USERS_AVATARS"
]
Attributes
[]
Component
App\Twig\Components\SettingsRowSwitchComponent {#5935
  +label: "Show users’ avatars"
  +help: ""
  +settingsKey: "KBIN_ENTRIES_SHOW_USERS_AVATARS"
  +defaultValue: false
  +reloadRequired: true
}
settings_row_switch App\Twig\Components\SettingsRowSwitchComponent 12.0 MiB 0.13 ms
Input props
[
  "label" => "Show magazines’ icons"
  "settingsKey" => "KBIN_ENTRIES_SHOW_MAGAZINES_ICONS"
]
Attributes
[]
Component
App\Twig\Components\SettingsRowSwitchComponent {#5991
  +label: "Show magazines’ icons"
  +help: ""
  +settingsKey: "KBIN_ENTRIES_SHOW_MAGAZINES_ICONS"
  +defaultValue: false
  +reloadRequired: true
}
settings_row_switch App\Twig\Components\SettingsRowSwitchComponent 12.0 MiB 0.14 ms
Input props
[
  "label" => "Show thumbnails"
  "settingsKey" => "KBIN_ENTRIES_SHOW_THUMBNAILS"
  "defaultValue" => true
]
Attributes
[]
Component
App\Twig\Components\SettingsRowSwitchComponent {#6047
  +label: "Show thumbnails"
  +help: ""
  +settingsKey: "KBIN_ENTRIES_SHOW_THUMBNAILS"
  +defaultValue: true
  +reloadRequired: true
}
settings_row_switch App\Twig\Components\SettingsRowSwitchComponent 12.0 MiB 0.12 ms
Input props
[
  "label" => "Auto media preview"
  "help" => "Automatically expand media previews."
  "settingsKey" => "KBIN_POSTS_SHOW_PREVIEW"
]
Attributes
[]
Component
App\Twig\Components\SettingsRowSwitchComponent {#6103
  +label: "Auto media preview"
  +help: "Automatically expand media previews."
  +settingsKey: "KBIN_POSTS_SHOW_PREVIEW"
  +defaultValue: false
  +reloadRequired: true
}
settings_row_switch App\Twig\Components\SettingsRowSwitchComponent 12.0 MiB 0.12 ms
Input props
[
  "label" => "Show users’ avatars"
  "settingsKey" => "KBIN_POSTS_SHOW_USERS_AVATARS"
  "defaultValue" => true
]
Attributes
[]
Component
App\Twig\Components\SettingsRowSwitchComponent {#6159
  +label: "Show users’ avatars"
  +help: ""
  +settingsKey: "KBIN_POSTS_SHOW_USERS_AVATARS"
  +defaultValue: true
  +reloadRequired: true
}
settings_row_enum App\Twig\Components\SettingsRowEnumComponent 12.0 MiB 0.15 ms
Input props
[
  "label" => "Comment reply position"
  "help" => "Display the comment reply form either at the top or bottom of the page. When 'infinite scroll' is enabled the position will always appear at the top."
  "settingsKey" => "KBIN_COMMENTS_REPLY_POSITION"
  "values" => [
    [
      "name" => "top"
      "value" => "TOP"
    ]
    [
      "name" => "bottom"
      "value" => "BOTTOM"
    ]
  ]
  "defaultValue" => "TOP"
]
Attributes
[]
Component
App\Twig\Components\SettingsRowEnumComponent {#6215
  +label: "Comment reply position"
  +help: "Display the comment reply form either at the top or bottom of the page. When 'infinite scroll' is enabled the position will always appear at the top."
  +settingsKey: "KBIN_COMMENTS_REPLY_POSITION"
  +values: [
    [
      "name" => "top"
      "value" => "TOP"
    ]
    [
      "name" => "bottom"
      "value" => "BOTTOM"
    ]
  ]
  +defaultValue: "TOP"
  +reloadRequired: true
}
settings_row_switch App\Twig\Components\SettingsRowSwitchComponent 12.0 MiB 0.13 ms
Input props
[
  "label" => "Show Comment Avatars"
  "help" => "Display/hide user avatars when viewing comments on a single thread or post."
  "settingsKey" => "KBIN_COMMENTS_SHOW_USER_AVATAR"
  "defaultValue" => true
]
Attributes
[]
Component
App\Twig\Components\SettingsRowSwitchComponent {#6273
  +label: "Show Comment Avatars"
  +help: "Display/hide user avatars when viewing comments on a single thread or post."
  +settingsKey: "KBIN_COMMENTS_SHOW_USER_AVATAR"
  +defaultValue: true
  +reloadRequired: true
}
date App\Twig\Components\DateComponent 12.0 MiB 0.18 ms
Input props
[
  "date" => DateTimeImmutable @1692950596 {#268
    date: 2023-08-25 10:03:16.0 +02:00
  }
]
Attributes
[]
Component
App\Twig\Components\DateComponent {#6346
  +date: DateTimeImmutable @1692950596 {#268
    date: 2023-08-25 10:03:16.0 +02:00
  }
}
related_magazines App\Twig\Components\RelatedMagazinesComponent 12.0 MiB 2.45 ms
Input props
[
  "magazine" => null
  "tag" => null
]
Attributes
[]
Component
App\Twig\Components\RelatedMagazinesComponent {#6433
  +limit: 4
  +tag: null
  +magazine: null
  +type: "random"
  +title: "random_magazines"
  +refreshedRandom: false
  -repository: App\Repository\MagazineRepository {#1370 …}
  -cache: Symfony\Component\Cache\Adapter\TraceableTagAwareAdapter {#600 …}
  -twig: Twig\Environment {#1252 …}
  -requestStack: Symfony\Component\HttpFoundation\RequestStack {#1328 …}
}
active_users App\Twig\Components\ActiveUsersComponent 12.0 MiB 0.25 ms
Input props
[
  "magazine" => null
]
Attributes
[]
Component
App\Twig\Components\ActiveUsersComponent {#6498
  +magazine: null
  -userRepository: App\Repository\UserRepository {#603 …}
  -cache: Symfony\Component\Cache\Adapter\TraceableTagAwareAdapter {#600 …}
  -twig: Twig\Environment {#1252 …}
  -requestStack: Symfony\Component\HttpFoundation\RequestStack {#1328 …}
}
related_categories App\Twig\Components\RelatedCategoriesComponent 12.0 MiB 1.80 ms
Input props
[
  "magazine" => null
  "tag" => null
]
Attributes
[]
Component
App\Twig\Components\RelatedCategoriesComponent {#6557
  +limit: 4
  +tag: null
  +magazine: null
  +type: "random"
  +title: "random_categories"
  +refreshedRandom: false
  -repository: App\Repository\CategoryRepository {#6558 …}
  -cache: Symfony\Component\Cache\Adapter\TraceableTagAwareAdapter {#600 …}
  -twig: Twig\Environment {#1252 …}
  -requestStack: Symfony\Component\HttpFoundation\RequestStack {#1328 …}
}
related_posts App\Twig\Components\RelatedPostsComponent 12.0 MiB 1.60 ms
Input props
[
  "magazine" => null
  "tag" => null
]
Attributes
[]
Component
App\Twig\Components\RelatedPostsComponent {#6627
  +limit: 4
  +tag: null
  +magazine: null
  +type: "random"
  +post: null
  +title: "random_posts"
  +refreshedRandom: false
  -repository: App\Repository\PostRepository {#1764 …}
  -cache: Symfony\Component\Cache\Adapter\TraceableTagAwareAdapter {#600 …}
  -twig: Twig\Environment {#1252 …}
  -requestStack: Symfony\Component\HttpFoundation\RequestStack {#1328 …}
  -mentionManager: App\Service\MentionManager {#1504 …}
}
related_entries App\Twig\Components\RelatedEntriesComponent 12.0 MiB 1.58 ms
Input props
[
  "magazine" => null
  "tag" => null
]
Attributes
[]
Component
App\Twig\Components\RelatedEntriesComponent {#6696
  +limit: 4
  +tag: null
  +magazine: null
  +type: "random"
  +entry: null
  +title: "random_entries"
  +refreshedRandom: false
  -repository: App\Repository\EntryRepository {#1763 …}
  -cache: Symfony\Component\Cache\Adapter\TraceableTagAwareAdapter {#600 …}
  -twig: Twig\Environment {#1252 …}
  -requestStack: Symfony\Component\HttpFoundation\RequestStack {#1328 …}
  -mentionManager: App\Service\MentionManager {#1504 …}
}
support_us_block App\Twig\Components\SupportUsBlock 12.0 MiB 0.22 ms
Input props
[]
Attributes
[]
Component
App\Twig\Components\SupportUsBlock {#6765
  +subject: ? App\Entity\Contracts\VotableInterface
  +url: ? string
  -twig: Twig\Environment {#1252 …}
  -cache: Symfony\Component\Cache\Adapter\TraceableTagAwareAdapter {#600 …}
  -requestStack: Symfony\Component\HttpFoundation\RequestStack {#1328 …}
  -partnerBlockRepository: App\Repository\PartnerBlockRepository {#6766 …}
}
featured_magazines App\Twig\Components\FeaturedMagazinesComponent 12.0 MiB 0.90 ms
Input props
[
  "magazine" => null
]
Attributes
[]
Component
App\Twig\Components\FeaturedMagazinesComponent {#6858
  +magazine: null
  -twig: Twig\Environment {#1252 …}
  -repository: App\Repository\MagazineRepository {#1370 …}
}