A tiny Arduino project: Generic IR receiver using ATTiny85 and TL1838

This project uses a small arduino compatible microcontroller board called Digispark which is based on attiny85 chip. It has a PCB usb header which can directly communicate with PC through a USB bootloader. The board is relatively inexpensive compared to regular arduino board. As it comes with a usb connector, no other programmers are needed. It is best suited for projects which require less memory and few i/o pins.

digispark_arduino_irreceiver

Board setup

  • Go to, File->preferences->in ‘Additional Boards Manager URLs’ enter
http://digistump.com/package_digistump_index.json

digispark_setup

  • Go to,  Tools->Board->Boards Manager->Contributed-> Install ‘Digistump AVR Board’

board_manager_digispark

  • Install the drivers from here
  • Tools->Board->Select ‘Digispark (Default – 16.5mhz)’

arduino_digispark

Software

  • Arduino code is here, the irPin is ‘p2’ of board which is connect to IR module TL1838, 300ms debounce time is added to avoid false triggering. There is an inbuilt LED which is connected to ‘p1’ that is turned ON and OFF with the IR pulse.
int irPin=2;
int onoff = 0;

void setup()
{
  pinMode(irPin,INPUT);
  pinMode(1,OUTPUT);
}
 
void loop()
{
  if(pulseIn(irPin,LOW))
  {
    delay(300); // the debounce time 300ms;
    if(onoff == 0)
    {
      digitalWrite(1,HIGH);
      onoff =1;
    }
    else
    {
      digitalWrite(1,LOW);
      onoff =0;
    }
  }
}
  • The code is looking for a low transition on the IR receiver to toggle pin 1, any IR remote can be used since this is a generic receiver which does not actually decode the IR signals.

IRreceiver_arduino_TL1838_digispark

  •  Programming is different from normal arduino boards since USB bootloader is active for first 10s from power on. After 10 seconds the board will switch from bootloader to sketch execution state. The board needs to be plugged-in where the arduino IDE shows notification for programming.

arduino digispark programming

Hardware

  • Pin out of TL1838 is shown below,

1838_ir_sensor_arduino

  • The connection for IR module is shown below, IR input is connected to p2 of the board.

  • Any IR remote can be used to give the signal. Here is the board connected to a usb powerbank and controlled by TV remote

arduino_irsensor

Setup for crypto mining on GIGABYTE Z370 HD3P motherboard: BIOS settings

When machine learning turns to mining,

Recently, I turned my desktop hardware which I assembled to learn AI into a mining rig. Most of the time, the desktop is sitting idle since my full time job is not on machine learning. So, it makes sense to mine on the hardware when I don’t use. I bought a couple of GPUs: 1050 Ti’s since, it is the only one available in market for a decent price, bought some pcie 1x to 16x risers and hooked up all those to make a mining rig. Here are the motherboard settings which worked for me to get it up and running with nicehash/ethminer. The motherboard is GIGABYTE Z370 HD3P with 6 PCIE slots.

  • Enter BIOS by pressing F12 while boot, click ‘Enter Setup’bootmenu_z370_mining
  • On the first tab ‘Motherboard Intelligent Tweaker’ click on ‘Miscellaneous Settings’pcie_gen2_for_mining_z370_hd3p
  • Choose Max link Speed to Gen2: default is Gen3, GPU don’t need Gen3 speed for mining. pcie_to_gen2_z370hd3p_mining
  • On BIOS tab, CSM support to Enabled and Fast boot to Disabledbios_settings_z370_hd3p_mining
  • On Peripherals tab, Graphics to internal Intel HD (IGFX) and 4G decoding to Enabled. Connect Display to Motherboard HDMI slot. peripheral_settings_z370_hd3p_mining
  • On Chipset tab, Enable Internal GFX. Save and Reboot.chipset_settings_z370_hd3p_mining

Install the drivers for GPU on device manager (right click on unknown device and click ‘Update driver’), If windows does not install it by default. Install nicehash miner and you are ready for mining.