Reader small image

You're reading from  Raspberry Pi 3 Projects for Java Programmers

Product typeBook
Published inMay 2017
Reading LevelIntermediate
PublisherPackt
ISBN-139781786462121
Edition1st Edition
Languages
Right arrow
Authors (3):
John Sirach
John Sirach
author image
John Sirach

John Sirach works as a Product Owner at Greenhouse Innovation. He has more than 10 years of experience with Internet-related disciplines from connectivity to hosting and Internet Of Things. Currently, he is involved in the open source "PiDome Home Automation platform" project as a passionate Java and JavaFX software developer and project maintainer. In the past 10 years, he has gained experience with large-scale web applications committed to online services with the most experience gained in frontend web development and application middleware.
Read more about John Sirach

Pradeeka Seneviratne
Pradeeka Seneviratne
author image
Pradeeka Seneviratne

Pradeeka Seneviratne is a software engineer with over 10 years' experience in computer programming and systems design. He is an expert in the development of Arduino- and Raspberry Pi-based embedded systems. Pradeeka is currently a full-time embedded software engineer who works with embedded systems and highly scalable technologies. Previously, he worked as a software engineer for several IT infrastructure and technology servicing companies. He collaborated with the Outernet project as a volunteer hardware and software tester for Lighthouse- and Raspberry Pi-based DIY Outernet receivers based on Ku band satellite frequencies. He is also the author of five books: Internet of Things with Arduino Blueprints [Packt Publishing] IoT: Building Arduino-Based Projects [Packt Publishing] Building Arduino PLCs [Apress] Raspberry Pi 3 Projects for Java Programmers [Packt Publishing] Beginning BBC micro:bit [Apress]
Read more about Pradeeka Seneviratne

View More author details
Right arrow

Adding the light-dependent resistor to the setup

As mentioned earlier, the Raspberry Pi is unable to read analog values. We are going to add the resistor using a RC circuit, as explained earlier. Here, we need the LDR, capacitor, and a 4.7 Kohm fixed resistor. The fixed resistor is used to make sure that when the LDR is completely saturated, which means that there is no resistance anymore, we won't fry our Raspberry Pi. An extra thing we need to keep in mind is that the Raspberry Pi is a 3.3V device. This means that in this schema, we will be using the 3.3V output because we will be reading the input on the Raspberry Pi pin, which cannot be higher than 3.3V.

Here is an image that shows how to attach this RC circuit to the Raspberry Pi:

Shut down the Raspberry Pi and disconnect the power. Let's first take a quick look at the capacitor. The one we are using is an electrolytic capacitor, which has a positive...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Raspberry Pi 3 Projects for Java Programmers
Published in: May 2017Publisher: PacktISBN-13: 9781786462121

Authors (3)

author image
John Sirach

John Sirach works as a Product Owner at Greenhouse Innovation. He has more than 10 years of experience with Internet-related disciplines from connectivity to hosting and Internet Of Things. Currently, he is involved in the open source "PiDome Home Automation platform" project as a passionate Java and JavaFX software developer and project maintainer. In the past 10 years, he has gained experience with large-scale web applications committed to online services with the most experience gained in frontend web development and application middleware.
Read more about John Sirach

author image
Pradeeka Seneviratne

Pradeeka Seneviratne is a software engineer with over 10 years' experience in computer programming and systems design. He is an expert in the development of Arduino- and Raspberry Pi-based embedded systems. Pradeeka is currently a full-time embedded software engineer who works with embedded systems and highly scalable technologies. Previously, he worked as a software engineer for several IT infrastructure and technology servicing companies. He collaborated with the Outernet project as a volunteer hardware and software tester for Lighthouse- and Raspberry Pi-based DIY Outernet receivers based on Ku band satellite frequencies. He is also the author of five books: Internet of Things with Arduino Blueprints [Packt Publishing] IoT: Building Arduino-Based Projects [Packt Publishing] Building Arduino PLCs [Apress] Raspberry Pi 3 Projects for Java Programmers [Packt Publishing] Beginning BBC micro:bit [Apress]
Read more about Pradeeka Seneviratne