Electronics Circuits

Subscribe to receive our latest 5G White Paper for FREE!


Recent Posts

  • Pulse Width Modulation (PWM) Laser/LED Communications Circuit The post briefly shows a circuit that could be used to transmit data optically(through the air) to a receiver. In this case, we made a circuit to transmit music ...
    Posted 13 Jun 2016, 13:24 by Behind The Sciences
  • How to install Tomato on Asus RT-AC66U router We recently upgraded our internet to fibre (fibre to the cabinet) and we thought it was about time to upgrade our faithful Linksys WRT54G. As you probably already know, the ...
    Posted 13 Jun 2016, 14:04 by Behind The Sciences
  • Charge Sensitive Pre-amplifier (Brief overview) Radiation detection systems often consist of a detector, a preamplifier, a pulse shaping amplifier and a multi-channel analyser. The detector converts interaction of photon energy from an X-ray ...
    Posted 13 Jun 2016, 14:05 by Behind The Sciences
  • 3.3V Uninterruptible Power Supply (UPS) battery backup circuit In this article we discuss a UPS circuit powered from mains supply. The backup power is provided by NimH batteries. Figure 1 : UPS schematicThe power supply shown here is ...
    Posted 13 Jun 2016, 14:05 by Behind The Sciences
  • How to install Kodi on a Raspberry Pi 3 The Raspberry Pi model 3, 1.2GHz quad core, 1 GB RAM version is out and we have decided to test Kodi on it. We have Kodi running on multiple ...
    Posted 20 Apr 2016, 13:59 by Behind The Sciences
  • Raspberry Pi 3 review The latest Raspberry Pi was unveiled on the 29th of February and we decided to acquire one to try it out. Physically, the Pi 3 looks very similar to the ...
    Posted 20 Apr 2016, 14:00 by Behind The Sciences
  • Raspberry Pi Kodi Media Center We, at BehindTheSciences, are great fans of the Raspberry Pi. We are also frequent users of Kodi. However we never actually tried running Kodi on the Pi. This post is ...
    Posted 20 Apr 2016, 14:01 by Behind The Sciences
  • Raspberry Pi iButton system Over the years, I have come across various security door access systems such as keypad access, magnetic strip, RFID tags and iButtons. I have found ibuttons and RFID tags to ...
    Posted 13 Jun 2016, 14:07 by Behind The Sciences
Showing posts 1 - 8 of 8. View more »




Pulse Width Modulation (PWM) Laser/LED Communications Circuit

posted 11 Jun 2016, 05:30 by Behind The Sciences [ updated 13 Jun 2016, 13:24 ]


The post briefly shows a circuit that could be used to transmit data optically(through the air) to a receiver. In this case, we made a circuit to transmit music. The topology of the system is shown in Figure 1. This post will only show the transmitter part.


Figure 1: Topology of an optical communication system.

The proposed circuit can drive a laser or an LED. The values of the output may need to be tweaked to provide enough current for your laser/LED. The laser module that can be used are the ones that comes in laser pointers and the usually cost around a couple of £.


Figure 2: Circuit to Encode and drive a laser/LED

For the circuit shown in Figure 2, the signal (in our case, music) is applied to the port A1. The circuit is power using a PP3 9V battery connected to J3. The LED or laser module is connected to J1. U1 is a 555 timer that provides a triangular waveform.

U3 amplifies the sound waveform injected into A1. RV1 allows the gain of the inverting configuration of U3 to be adjusted. U3 is a comparator which compares the amplified music signal and the triangular waveform from U1. U2 then drives the base of BJT Q1, which is effectively configured as a switch.

A partially assembled PCB is shown below:



This post was meant to only give an introduction, more will be posted later. Keep in touch for regular updates. :)

Share




How to install Tomato on Asus RT-AC66U router

posted 30 May 2016, 12:47 by Behind The Sciences [ updated 13 Jun 2016, 14:04 ]


We recently upgraded our internet to fibre (fibre to the cabinet) and we thought it was about time to upgrade our faithful Linksys WRT54G. As you probably already know, the WRT54G was one of the most popular router that allowed alternative firmware such as OpenWrt, DD-Wrt, Tomato and others to be installed on it.

The technology has seen moved on and we can now get faster routers with better WiFi speed and better security with newer routers. We decided to buy an Asus RT-AC66U. This is far from being a "new" router but it fits our purpose.

We ordered one from one of the major computer part suppliers and it arrived a couple of days later.


The Asus default firmware is OK, not great and does not give us the flexiblity we need such as OpenVPN. So we decided to install Tomato on it. There are different Tomato distribution out there but most of them are outdated. Shibby is a very polish guy who dedicate his spare time writing good Tomato distribution for various router.


Here is a tutorial on how we installed Tomato from Shibby on our router.

Download the ASUS RT-AC66U Firmware Restoration



Download Shibby RT-AC66U firmware:



We downloaded the AIO version in our case.

Flashing the Router


  • Open the Asus Firmware restoration software
  • Select the Tomato firmware you recently downloaded.



  • Power Off the router.
  • Connect an Ethernet cable between LAN port 1 and your PC.
  • While holding down the Reset button on the router and power On the router
  • Keep holding the reset button until the power led starts to blink. When the power led starts blinking, release the reset button.
  • Click Upload on the Asus firmware recovery software and wait for the process to finish.
  • The router will reboot after the upgrade. In some cases, you may need to reboot it yourself manually.
And Voila, you should be able to log on the router using the gateway address http://192.168.1.1 and see this:


Head over to the Administration page to erase the NVRAM and reboot the router.


That's it. You have now successfully installed Tomato on your Asus router. :)

Comments are most welcome. If you have any queries, contact us on [email protected]







Charge Sensitive Pre-amplifier (Brief overview)

posted 26 May 2016, 13:45 by Behind The Sciences [ updated 13 Jun 2016, 14:05 ]


Radiation detection systems often consist of a detector, a preamplifier, a pulse shaping amplifier and a multi-channel analyser. The detector converts interaction of photon energy from an X-ray source into an electrical signal. The electrical signal voltage is proportional to the energy of the incident photon. When a semiconductor detector is used for soft x-ray measurement or gamma-rays, the output signal is a current pulse with a pulse width of few nanoseconds. The signal is usually weak and requires amplification. Operational amplifiers conigured as integrators with feedback capacitance are commonly used. When a weak charge pulse signal is presented at the high impedance input of an integrator, the signal is integrated to produce a voltage pulse. This type of integrator amplifiers are known as Charge Sensitive Amplifier (CSA). [1] [2]

The characteristics of a good charge sensitive amplifier are:

  • Low noise.
  • High Gain.
  • Integration linearity.
  • Stable with a big range of detector capacitance.
  • High speed; Fast Rise time.

Figure 1: Charge Sensitive Preamplifier

When X-rays strike a semiconductor detector, current pulses are generated and the amplitude of those pulses are dependant on the particle energy. When a current pulse is generated, the input of the CSA rises but at the same time a potential with reverse polarity will appear at the output. Amplifiers tend to have a large open loop gain and so the output work through the feedback loop to make the input potential zero instantaneously. As a result, the current is integrated across the feedback capacitor Cf. A voltage appears at the output Vout and this output voltage is proportional to the charge contained in the input current pulse.

Charge Sensitive amplifiers are usually not stable and requires a mechanism to reset the charge stored in the feedback capacitor Cf. The simplest way involves putting a resistor Rf in the feedback loop as shown in Figure 1. The feedback resistor Rf will cause the output voltage Vout to look like a voltage pulse that discharges slowly with a time constant given by tau=Cf.Rf. The resistor Rf also establishes a well defined DC operating point to the amplifier. The feedback resistor provides a path for the leakage current of the detector. However, the resistor Rf is known to introduce additional noise to the output signal. In semiconductor X-ray spectrometers, the noise produced by the charge sensitive amplifiers can contribute a considerable noise to the output signal and thus limiting the energy resolution. [3]

Although a higher feedback resistance will introduce higher thermal noise, it is still desirable to have a large resistance as when a shunt capacitance is placed with the feedback resistor; it will limit the resistor thermal noise.


Figure 2: Shunt Resistor and Capacitor circuit

If vn is considered as an input, Vout can be written as:




As Rf increases, vn also increases. However the signal vn starts attenuating with a -3dB point at f = 1/(jwRfCf). As Rf increases, vn increases but the bandwidth of the noise signal decreases. Figure 3 below shows the spectral density of different Rf shunt with a Cf of 1pF.


Figure 3: Spectral density of Resistor and Capacitor shunt circuit



A higher resistor will produce a higher noise but because of the RC network arrangement, the noise spectral density will show a lower cut off frequency. For circuit operating at high frequency, the resistor noise will have significantly less effect on the circuit noise performance. [4]

Other systems reported in literature consist of replacing the feedback resistor with an optical reset method where a pulsed light source is shone onto an unpackaged FET which is sensitive to light. Optical reset method can considerably reduce the noise of the system but it is known to introduce dead time and the effect of the reset pulse need to be remove at the acquisition stage. It also required sensing the output voltage and comparing it to a preset voltage and when the preset voltage is exceeded, the feedback capacitor Cf is reset. This method can be troublesome. It is more desirable to implement a system with continuous feedback rather than one that relies on pulse gating circuits.[5-8]

[9-11] proposes a novel circuit where the feedback resistor Rf is removed and where the circuit remain stable. In the novel circuit, Bertuccio uses the gate to channel junction of the input JFET as a path for the feedback capacitor Cf to discharge and for the detector leakage current to flow.


Figure 4: Charge Sensitive Preamplifier without feedback resistor Rf [10]


In a n-channel JFET, the gate-to-channel junction looks like a p-n junction. In reverse bias mode, the gate leakage current is very low, resulting into a high input impedance. Forward bias mode is not often used because this then results into a low input impedance. Bertuccio also investigate the use of JFETs in the so called `forward bias mode" and concludes that it is possible to forward bias them.

Bertuccio novel idea consists of forcing a forward bias on the gate with respect to the source and in principle, the detector leakage current current will flow towards the source. Bertuccio measurements shows a rise time just under 30ns which is slow when compared to the Amptek commercial amplifier for instance.

If you are looking to make an ultra low noise CSA, Bertuccio novel idea is a good start. His findings has lead to a lot of newer and sometimes better version of the circuit.

If you need any further answers with regards to charge sensitive amplifiers and Spectrometers, do get in touch :)


Share




[1] G. Knoll, Radiation detection and measurement. Wiley, 2000. [Online].
Available: http://books.google.co.uk/books?id=HKBVAAAAMAAJ

[2] J. Webster, The Measurement, Instrumentation, and Sensors:
Handbook, ser. Electrical Engineering Handbook Series. Springer-
Verlag GmbH, 1999. [Online]. Available: http://books.google.co.uk/
books?id=b7UuZzf9ivIC

[3] A. Giachero, C. Gotti, M. Maino, and G. Pessina, \Current
feedback operational ampli.ers as fast charge sensitive preampli.ers for
photomultiplier read out," Journal of Instrumentation, vol. 6, no. 05,
p. P05004, 2011. [Online]. Available: http://stacks.iop.org/1748-0221/
6/i=05/a=P05004

[4] C. Boiano, R. Bassini, A. Pagano, A. Pullia, and S. Riboldi, \A ultra fast
hybrid charge-sensitive preampli.er for high-capacitance detectors," in
Nuclear Science Symposium Conference Record, 2007. NSS '07. IEEE,
vol. 1, 26 2007-nov. 3 2007, pp. 338 {339.

[5] R. Bassini, C. Boiano, and A. Pullia, \A low-noise charge ampli.er with
fast rise time and active discharge mechanism," Nuclear Science, IEEE
Transactions on, vol. 49, no. 5, pp. 2436 { 2439, oct 2002.

[6] V. Radeka, \Low-noise techniques in detectors," Annual Review of Nu-
clear and Particle Science, vol. 38, pp. 217{277, 1988.

[7] A. Fazzi, P. Jalas, P. Rehak, and P. Holl, \Charge-sensitive ampli.er
front-end with an njfet and a forward-biased reset diode," Nuclear Sci-
ence, IEEE Transactions on, vol. 43, no. 6, pp. 3218 {3222, dec 1996.

[8] F. Olschner and J. Lund, \Low noise charge sensitive preampli.er using
drain current feedback," in Nuclear Science Symposium and Medical
Imaging Conference, 1992., Conference Record of the 1992 IEEE, oct
1992, pp. 378 {380 vol.1.

[9] G. Bertuccio, L. Fasoli, C. Fiorini, and M. Sampietro, \Spectroscopy
charge ampli.er for detectors with integrated front-end fet," Nuclear
Science, IEEE Transactions on, vol. 42, no. 4, pp. 1399 {1405, aug
1995.

[10] G. Bertuccio, P. Rehak, and D. Xi, \A novel charge sensitive
preampli.er without the feedback resistor," Nuclear Instruments and
Methods in Physics Research Section A: Accelerators, Spectrometers,
Detectors and Associated Equipment, vol. 326, no. 12, pp. 71 { 76, 1993.

[11] L. Fasoli, C. Fiorini, and G. Bertuccio, \Feedback stability of charge ampli
.ers with continuous reset through forward-biased diode junctions,"
Nuclear Science

3.3V Uninterruptible Power Supply (UPS) battery backup circuit

posted 13 May 2016, 13:24 by Behind The Sciences [ updated 13 Jun 2016, 14:05 ]


In this article we discuss a UPS circuit powered from mains supply. The backup power is provided by NimH batteries.



Figure 1 : UPS schematic

The power supply shown here is designed to provide a voltage of 3.6V and a current of up to 300mA. The 230V to 5V 1.5VA centre- tapped transformer T1 steps down the mains voltage to 5V AC where it is rectified by diodes D1 and D2. The capacitor C1 is used to smooth the ripple of the rectified DC voltage. The power supply contains a 3.6V NimH backup power battery which is indefinitely connected to the circuit. In the event of mains failure, the battery takes over automatically; and the output from the power supply is not interrupted. When mains is restored, the battery recharges automatically.

The power supply is designed to consume as less power as possible from the main. The low-voltage drop rectifiers and LP2981 regulator make sure that the system has minimum power dissipation. The centre-tapped transformer enables the use of only two diodes instead of four to achieve full wave rectification. At each half cycle, current flows through only one of the 2 transformer secondary windings and thus through only 1 diode at a time. This enables the rectifying circuit to have a forward voltage drop of 0.4V instead of 0.8V for a full bridge rectifier (where 2 diodes in series conduct at each half cycle) and again less power dissipation.

The backup battery enables the system to work for 30 minutes in the event of a mains failure under full load. The battery is charged at a slow rate which is usually referred as trickle charging. This allows the battery to be indefinitely connected to the charging circuit. The advantage of trickle charging is that no ‘end-of-charge’ circuitry is required since the battery will never be damage regardless to how long it is used. This means that the charging circuit is cheap and simple.

The transformer T1 produces a peak voltage (VPEAK) of 5√2 Volts and the rectifying diode has a forward voltage drop of 0.4 Volts. This reduces the incoming voltage to 6.67V. Capacitor C3 is used to bypass high frequency component from the circuit and both C2 and C3 were chosen according to the LP2981 datasheet. They also ensure stability over full load current and better performance.

Smoothing Capacitor C1

The output from the rectifier circuit is fed into the input of the LP2981 regulator and the value of the smoothing capacitor C1 will depend on the voltage needed at that input.


Figure 2. Regulator

The regulator outputs 3.8V and has a voltage drop of 200mV. So the minimum required input voltage is 4.0V. The regulator is able to respond to small fluctuation in input voltage. Therefore in this case a perfect smoothing is not essential as the regulator will produce a constant DC of 3.8V as long as the voltage from its input does not fall below 4.0V. So the ripple voltage can vary between the peak voltage of 6.67V (VOPEAK), and 4.0V.

Figure 3. Rectified wave form

The capacitor ensures that the ripple voltage never go below 4.0V and therefore provides the input of the regulator with the required voltage at all time. With the frequency of the full wave rectified supply being twice the frequency of the mains (= 100Hz) and with the load drawing a current of 0.023A, C1 is found to be 86µF. So a preferred value of 100 µF is used.



Battery Capacity

Since the battery is continuously connected to mains supply, it gets the charges used up back throughout the entire day. To ensure that the battery is fully charged at the end of a day, the total amount of charge used up must equal to amount of charge regained.

Taking into consideration the amount of charge which will be used up and the recharge rate in one day:

Amount of charge in a fully charged battery = 3600C Coulombs

Amount of charge gain during charging = charging time x Charging rate

= (23.5 x 3600 x 0.025C) Coulombs

= 2115C coulombs.

Amount of charge used up due to mains failure = [charge used by system in 30 minutes]

= ([30 x 60 x 0.300])

= 540 Coulombs.

Full battery – recharged – backup power = Full battery

3600C + 2115C – 71.4 = 3600C

C = 255 x 10-3 = 255 mAh.

So a 3.6V NiMh 280mAh battery can be used.

Where:

1. C is the capacity of the battery in Ah charging at a rate of 0.025C.

2. Full battery is the charge in a fully charge battery.

3. Recharged is the charge gained (at a rate of 0.025C) by the battery for the whole day (23.5 hours).

4. Backup power is the power required for system to run for 30 minutes in case of mains failure.

The maximum safe trickle charging rate for this kind of battery is C/40, where C represents the Amps-hour of the battery. And hence:

The current needed to trickle charge the battery is: = 0.025C

= 0.025 x 280mAh

= 7.0mA

Resistor R1 is used to draw and limit the charging current to 7.0mA.

Charging Resistor R1

Resistor R1 is connected directly to the transformer through 2 rectifier diodes and so a full wave rectified voltage is available to the charging circuit. A minimum voltage of 3.6V is required across the charging terminal to enable the battery to charge. Hence taking into account the voltage drop across the rectifier diode, the battery is charged whenever the supply voltage is above 4.0V.

To determine the value of R1 needed to draw a current of 7.0mA, the average value of voltage is needed.

The Figure 4 below shows a voltage waveform available in series with resistor R1.


Figure 4 Charging resistor waveform.

The average voltage is found by integrating the voltage waveform shown above between point P1 and point P2, which corresponds to a voltage of 4.0V, and by dividing the integral by and finally by adding that value to 4. The average voltage is found to be 5.04V and so the required resistor R1 is calculated using Ohm’s law.

So a preferred value of 732Ω is used.

Automatic switching of supply

D4 provides a one-way path that allows the incoming current to pass during mains failure while it prevents current from the regulator finding its way to the battery terminals under normal conditions. On the other hand D3 prevents current from battery flowing into the regulator pin.

The terminal voltage of a fully charge battery is 3.6 Volts and the voltage from the regulator is 3.8 Volts. Taking into account the voltage drop across the diodes D3 and D4, the voltage from the regulator and the battery are 3.4V and 3.2V respectively. Since the regulator pin is at higher potential, no current will flow from the battery. However when mains supply is unavailable, the regulator voltage will drop from 3.4V to 0. As that voltage gets lower than 3.2V, current will start flowing from the battery and will continue to provide supply without any power interruption. However the supply will drop from 3.4V to 3.2V under mains failure.

When the mains come back on, the regulator voltage will rise to 3.4V again; and being higher in potential than the battery, it will prevent current from flowing from battery. This difference in potentials allows the circuit to automatically switch between the two supplies.

Happy tinkering. Feel free to comment and to contact us on [email protected]

If you spot any error or discrepancy, feel free to let us know :)


Share



How to install Kodi on a Raspberry Pi 3

posted 27 Mar 2016, 14:51 by Behind The Sciences [ updated 20 Apr 2016, 13:59 ]


The Raspberry Pi model 3, 1.2GHz quad core, 1 GB RAM version is out and we have decided to test Kodi on it. We have Kodi running on multiple PCs and Pis in the office. Although Kodi works on the previous model of the Pi, it can be laggy at times.

What does it take to install Kodi on a Raspberry Pi 3?

The first things you need, is of course the hardware. Here is a list:
  • Raspberry Pi 3
  • Raspberry Pi 3 Case (Optional)
  • 2.5 A Micro USB Power Supply
  • 8 GB (minimum) micro SD card.
  • A way of connecting a micro SD card to your PC.
  • HDMI cable
  • A TV or monitor.
  • Keyboard/mouse.
  • Internet through ethernet or WiFi
For this project, we decided to invest in a USB wireless media remote. We bought it on eBay for a modest price of £9.49 and next day delivery. These remotes were also available for a lot cheaper but we did not want to wait for the long delivery time.

Installation

This time, we decided to use Openelec as opposed to OSMC for Kodi.

  • Download the latest version of Openelec.
Go to http://openelec.tv/get-openelec to get the latest stable image for the Pi 2/3.


  • Uncompress the downloaded file to reveal the .img file
  • Connect the SD card to your PC
  • Using Win32Imager, write the .img file to the SD card and wait for the process to finish
  • Insert SD card into the Pi. Connect to the TV through HDMI, connect keyboard/mouse/wireless remote.
  • Connect the power supply and watch the setup scroll through :)
  • Once the Kodi interface appears, follow the usual Kodi configuration wizard.
Our first impression of Kodi on the Pi3 is that the interface feels so much faster and smoother. To test the capacity, we installed a few add-ons on it and here is a work-through of how to do it.

The wireless remote worked straight away and no configuration was needed.

We are going to show the steps for installing the popular 1Channel add-on. Please note that the tutorial is for educational purposes only.

Go to SYSTEM->File manager


->Add Source


Click on ->None


In the path, type “http://fusion.tvaddons.ag” without quotations and click Done.


Select the bottom text input box under the “Enter a name for the media Source” field and type in "fusion". Click Done.


Click OK on the next screen.


Return to main screen.


Go to SYSTEM->Settings->Add-ons


Select "Install from zip file"


Select fusion


-> xbmc-repos ->


-> english


-> repository.tknorris.release-1.0.2.zip


Wait for the installation to finish and go back to SYSTEM->settings->Add-ons->Install from repository-> tknorris Release Repository


-> Video add-ons


Click on "1Channel" and wait for installation to finish.


Now head to the main screen->Video->Add-ons->1Channel

Browse to movies or tv shows and enjoy!


Please feel free to comment on our post :)


Raspberry Pi 3 review

posted 25 Mar 2016, 11:37 by Behind The Sciences [ updated 20 Apr 2016, 14:00 ]

The latest Raspberry Pi was unveiled on the 29th of February and we decided to acquire one to try it out. Physically, the Pi 3 looks very similar to the previous model until you notice a new chip on the underside, the BCM43438. The new chip adds built-in wifi and bluetooth to the Pi, removing the need for USB dongle.

To complement the Pi 3, we also bought an official case. The case has been well-designed and snaps into shape fairly easily, definitely a good investment.





On the technical side, the Pi 3 is packed with a BCM2837 SoC and features a 64-bit ARM Cortex A53 quad core processor running at 1.2GHz. However, there was no upgrade on the RAM, only 1 GB, just like previous models.

There is a subtle upgrade on Pi 3 is the VideoCore IV which handles video and graphics now clocking in at 400MHz compared to earlier models at 250Mhz.

The upgrade in performance do come at a cost, with the Pi 3 consuming one and a half times more power than the Pi 2. The recommended PSU current capacity for the Pi 3 is 2.5 A.

Performance

We connected our Pi 3 to a TV, keyboard and mouse, plugged in the power supply. The Raspbian startup script scrolled past on the screen and the familiar desktop environment appeared. Our immediate impression is that the Raspberry Pi 3 is much faster than other versions of the Pi we have tested previously. The Pi 3 booted much faster and all of the built-in apps felt more responsive.

Making a WIFI connection was very easy using the network tool at the top right of the menu bar. See a screenshot of the BBC homepage:

Based on the performance we have observed, we can confidently say that the Pi 3 is as good as a basic Linux PC. We have been using it for a few days now for word processing and internet browsing. We are definitely impressed.

Our Verdict

In short

The Raspberry Pi 3 is a remarkable piece of technology for costing so little. The Raspberry Pi 3 makes the device 64-bit ready (although still running 32-bit software) and powerful enough to be used as a basic Linux PC. The built-in wireless connectivity enables Internet of Things projects at a lower price. The higher processing power of the Pi 3 should enable better performances for applications such as Kodi for instance.

The good

More powerful quad-core processor, WiFi and Bluetooth support, compatible with existing hardware and software.

The bad

Higher rated power supply needed.

Please leave comments, we are happy to listen to what you have to say. Happy tinkering internet people.


Raspberry Pi Kodi Media Center

posted 15 Mar 2016, 09:45 by Behind The Sciences [ updated 20 Apr 2016, 14:01 ]

We, at BehindTheSciences, are great fans of the Raspberry Pi. We are also frequent users of Kodi. However we never actually tried running Kodi on the Pi. This post is how we went about to get Kodi running on the Pi. Feel free to comment and/or provide suggestions. :)

There are various linux images out there that have Kodi already built-in. The two most popular ones are OSMC and OpenELEC. As a start, we decided to try OSMC and the followings give a brief description of the steps to installing and configuring OSMC.

List of the required hardware/Software:

  • Raspberry pi B+
  • Micro-USB power supply 5V, 1.2A
  • A SDHC memory card (8Gb in our case)
  • An image of OSMC
  • HDMI cable
  • Ethernet connection
  • Win32DiskImager software
  • Keyboard/mouse

Download the latest OSMC release from https://osmc.tv/download/

Select the correct image for your Raspberry Pi. Download it and extract the image from the archive.

With Win32DiskImager, write the img file to the SD card.

This might take a few minutes to complete.

Connect the Pi to a monitor or TV using the HDMI connection, ethernet, keyboard/mouse and Insert the SD card in the Pi. Power the Pi and the following sequence of screen will appear.

After those 2 initial screen, you will have to configure basic things such as languages, country, the Default Skin and so on. Personally, we prefer the classic Kodi skin as opposed to the OSMC. Make sure that SSH is set to enabled as this helps to install add-ons and for troubleshooting.

That's pretty much it for installing and running Kodi on the Pi, fairly straightforward.

Video Add-ons

As a start, we decided to install the popular SALTS video add-on. The link to the plugin is: https://github.com/tknorris/tknorris-beta-repo/tree/master/zips Download the latest release.

Using Filezilla, establish a SSH connection to the Pi, with the Host address being the IP address of the Pi. The user and Password for OSMC is osmc.


Click on Connect and transfer the downloaded Zip to the Pi. We chose to transfer it to the movie folder. Any other folder is OK as well.

On Kodi, go to SYSTEM->SETTINGS->Add-ons->Install from zip file. Select the zip transferred in the movie folder. The add-on will take a few minutes to install. Once installed, go back to the Home screen and then to video. And Voila! SALTS should be listed in the menu. Here is our attempt to watch an episode of The Big Bang Theory:
PLEASE NOTE THAT THIS IS FOR EDUCATIONAL PURPOSES ONLY.







Raspberry Pi iButton system

posted 26 Feb 2016, 10:20 by Behind The Sciences [ updated 13 Jun 2016, 14:07 by Behind The Sciences ]


Over the years, I have come across various security door access systems such as keypad access, magnetic strip, RFID tags and iButtons. I have found ibuttons and RFID tags to be the most user-friendly. The basic iButton contains just a unique serial number and advanced models contain various amounts of EPROM, EEPROM, NVRAM, clocks, temperature sensors and so on. The iButton is a chip enclosed in a stainless steel can. The steel button can be mounted virtually anywhere because it is rugged enough to withstand harsh environments, indoors or outdoors. It is durable enough to attach to a key fob, ring, watch, or other personal items and used daily for applications such as access control to buildings and computers.

iButtons can be read using a 1-wire bus. The 1-Wire bus is a system that has a single bus master and one or more slaves. In all instances, the iButton is a slave device. The bus master is typically a microcontroller or PC.

A number of iButton door lock systems are available on the market: Commercial iButton systems


As an engineer, I always aim to design my own system that can be adapted specifically to my application at low cost. A raspberry pi is a low cost standalone computer that could in principle be used as an iButton reader and an access controller. The 1-wire interface on a raspberry pi can be access by using the w1-gpio kernel on linux running on the raspberry pi. The instructions to build a Raspberry Pi iButton are as follows:

Activate the 1-wire bus driver and the GPIO

modprobe w1-gpio
modprobe w1-smem

Set permissions

chmod a+w /sys/devices/w1_bus_master1/w1_master_slaves
chmod a+w /sys/devices/w1_bus_master1/w1_master_remove
chmod a+w /sys/devices/w1_bus_master1/w1_master_search
Connect an iButton probe to the Raspberry Pi as shown below. IButton probes are nothing fancy and can be made easily. I chose to buy one from Farnell. Most major online electronic shops sell them.

After the connections has been made, try an ibutton on the probe... and have a look in this folder of the raspberry pi:

/sys/devices/w1_bus_master1/w1_master_slaves

Et voila! You should see the ID number of the iButton.

I have written a python script to make reading iButton easier. It basically read an iButton and compares the ID with a database. If the ID is on the database, it toggles a pin to high for a few seconds. It also saves the ID of all the iButtons, that make contact with the probe, in a database. My python script is as follows:
import os
import time
import datetime as date
import sqlite3 as lite
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
print(time.strftime("%c"))

os.system('modprobe wire timeout=1 slave_ttl=5')
os.system('modprobe w1-gpio')
os.system('modprobe w1-smem')
GPIO.setup(24,GPIO.OUT)
base_dir = '/sys/devices/w1_bus_master1/w1_master_slaves'
delete_dir = '/sys/devices/w1_bus_master1/w1_master_remove'
GPIO.output(24,False)

while True:
f = open(base_dir, "r")
ID = f.read()
f.close()
inlist = lite.connect('in.db')
data = lite.connect('accesslist.db')
curs = data.cursor()
curs.execute("SELECT * FROM user")
cursin = inlist.cursor()
now = time.strftime("%c")
rows = curs.fetchall()
if ID != 'not found.\n':
print(ID)
for row in rows:
if str(ID) ==str(row[1])+"\n":
print("Success0")
cursin.execute('INSERT INTO listin(name, date) VALUES (?,?)',(row[0],now))
GPIO.output(24,True)
inlist.commit()
time.sleep(3)
GPIO.output(24,False)
break
else:
GPIO.output(24,False)

if ID != 'not found.\n':
d = open(delete_dir, "w")
d.write(ID)

inlist.close()
data.close()
GPIO.cleanup()

I will comment the code when I get some time. For now, happy programming internet people! :)

UPDATE

Due to recent updates on the linux kernel, the 1-wire feature is disabled by default. To enable it, add the following line to /boot/config.txt and reboot the Pi.

dtoverlay=w1-gpio,gpiopin=4

Share




1-8 of 8

Comments