Install Dafang custom firmware to Neos Smartcam

The Neos Smart cam is a small indoor security camera based on the Xiaomi Xiaofang hardware, this is similar to the Wyze Cam 2 which is also based on the same Xiaomi hardware.

I’ve wanted one of these for a while, and now the Neos smart cam is readily available on Amazon in the UK, I thought now would be a good opportunity to try one out. Currently they’re retailing for £24.99 and can be delivered through Amazon Prime.

By default, Neos offer 14 days of cloud storage for free (no monthly subscription) which is pretty great considering the price. But I already have a CCTV solution at home running open-source Shinobi DVR software and needed something that could provide an RTSP stream.

This is where the Xiaomi DaFang Hacks software comes in. Available on GitHub here, the code for the Neos camera only available through this commit for the moment; until it is merged into the master branch: https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/pull/964.

DaFang hacks is custom firmware which you can flash to the camera via a MicroSD card. This give you benefits such as; no relying on the manufacturer’s cloud services, SSH and FTP services on the camera itself, and the best: RTSP stream support – this will allow you to integrate the camera into any DVR recording software, such as Shinobi, ZoneMinder or Synology’s Surveillance Station.

How to install

  1. Firstly, download the custom firmware .bin file, this is the same firmware for the Wyzecam: https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/raw/master/hacks/cfw/wyzecam_v2/cfw-1.1.bin or via the repo page here: https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/
  2. Now have your MicroSD card ready. I used this Toshiba 16GB card, and setup a single 512mb partition using gParted. This is how I formatted the card using gParted:
    1. Insert the MicroSD card into your computer and load up gParted. Select your card/drive from the dropdown at the top right, and delete all partitions so it is only showing ‘unallocated’:
    2. Now create a FAT32 512mb partition:
    3. Click add, then you should see the new partition ready to be created:
    4. Click the ‘tick’ icon to apply the operations. You should see a success message:
  3. Once your partition has been created, copy the ‘cfw-1.1.bin’ file to the drive. You must then rename this file to: ‘demo.bin’. It is important that you ensure this is the only file on your MicroSD card.
  4. Now insert the MicroSD card into the base of your Neos Smartcam, ensure no USB cable is connected.
  5. Connect the USB cable and ensure you’re holding down the setup button. Whilst holding the setup button, the LED indicator on the Smart cam should light-up blue, once you see this carry on holding the setup button down for 20 seconds, then let go. The instructions on Dafang’s Github page state this may take up to 3 minutes, but for me this was much less. I knew this process was finished when the LED started to flash yellow rapidly. Looking up this response, means ‘Ready to setup’, source. This process alters the bootloader on the Smart cam so it can boot custom firmware. If you’re having issues, check this video – it helped me a lot with this process:
  6. Now re-insert your MicroSD card into your computer and empty all files on this MicroSD card. Then download the ‘Xiaomi-Dafang-Hacks’ repository, here: https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks. Click the green button named ‘Clone or download’, then select ‘Download ZIP’.
  7. Once the .zip file has downloaded, extract this and copy the entire contents of ‘firmware_mod’ to your MicroSD card.
  8. You will want to add your Wireless Network settings. On the MicroSD card, find the folder named ‘config’. Enter this directory and find the file named ‘wpa_supplicant.conf.dist’, rename this file to ‘wpa_supplicant.conf’.
  9. Now edit the ‘wpa_supplicant.conf’ file in a code editor. Change the values for ‘ssid’ and ‘psk’ with your own wireless network name and password, e.g:
  10. Now save the file, and insert the MicroSD card back into your Neos Smartcam and power-on.
  11. If all goes well, you should be able to access the web interface in a web browser at: https://dafang with the default login details; username: root and password: ismart12
  12. The default RTSP stream URL is: rtsp://ip-address:8554/unicast (replace the IP address with the one associated with your smart cam).

 

Updates

[Update: 11/08/2019]: I use Shinobi to record the RTSP stream, but have been having some issues with the stream recordings only being around 30 to 45 seconds long, they should have been 5 minutes.

I have managed to fix this by altering the settings within the Dafang web interface to:

  • Disable audio recording
  • Disable motion detection
  • After disabling these two options, I saw the CPU usage drop from 80% to around 20%.

I also set these options for the video feed:

  • Video size: 1600×900
  • Bitrate: 500kbps
  • Video format: VBR
  • Frame rate: 24 every 1 second

Finally, I setup the SWAP with a swapfile size of 512MB within the ‘run.sh’ file.

 

Help me out

If you’re interested in the Neos smartcam with the Dafang custom firmware, help me out by purchasing one from Amazon UK with my affiliate code:

Links: Neos Smart cam on Amazon UK and Toshiba 16GB Micro SD card on Amazon UK

Comments

Jeff Hartley
  • July 21st, 2019

Many thanks for this excellent “how to”. I’d tried all sorts of other ways of installing custom firmware and thought I’d bricked the camera but your method actually worked.

Only thing, I wish I’d known you have to keep the SD card in the camera once the bootloader had been altered. I now need to buy another 5 SD cards for the other cameras Lol.

Do you know if you can increase the size of the partition once you have everything working for recording video etc? I will be buying a QNAP NAS drive soon so this point will be moot.

Anyway, thanks for setting my Neos cameras free! (I hate closed systems)

Jeff.

Ryan
  • July 21st, 2019

Hi Jeff,

Glad it’s working for you!

Yes, the micro SD card will need stay in the camera, I believe removing it will let the camera boot the factory installed Neos firmware instead.

Sorry, I havent looked into re-sizing the card yet. Perhaps posting a question on the Dafang GitHub page will help. Otherwise, gParted may be able to re-size the partition but it may corrupt the data on the card.

Jo
  • July 21st, 2019

Any chance you could check to see if removing the SD card (or putting a blank one) reverts the camera back to the default firmware? I’m really tempted to flash the firmware but I’d like the option of reverting if I don’t like it

Ryan
  • July 22nd, 2019

Hi Jo,

I’ve tried this, booted up my camera with the SD card inserted. The docs for the Dafang firmware state the original firmware of the camera should load – unfortunately my camera doesn’t seem to be doing this, not sure if it’s a bug or not.

Ryan Massey
  • July 23rd, 2019

Hi Ryan,

I keep trying to do this but i cannot get it to work. Fails after the solid blue light and i hold for 20secs it then waits 10secs and reverts to a solid yellow light.

Any help?

Ryan
  • July 24th, 2019

Hi Ryan,

Is this happening before you get to step 6 from my instructions? If so, I’d double check you have formatted the card properly, or if possible try another Micro SD card.

Sean
  • July 28th, 2019

Would I follow similar instructions to install wyze firmware on it?

Ryan
  • July 28th, 2019

Hi Sean, I’m not sure about that. But they have posted their own video about flashing firmware here: https://youtu.be/vzu5aNePOz8. I’d be cautious as your device could be bricked if the instructions are not followed carefully. In the past, I’ve heard people say the Wyze firmware will ask/check your location so if you’re not located in the US you may have issues accessing their services – I’d try and double check to see what other maybe have said about this.

Joao
  • July 30th, 2019

Hi Ryan, thanks for posting this. I’ve just bough me a couple of these cameras on Amazon.co.uk. Although when reading around, it seems there’s some things that the Dafang hack will break? For example, people are telling the feed will be massive slowdown and night vision will stop working.. 🙁 Can you comment on it?

Thanks for the help.

Rechena
  • July 30th, 2019

Hi Ryan,
Thanks for this post. I just bought a pair of these cameras and while reading on the internet it seems there’s some issues with the Dafang hack, for example the feed being slow down and the night vision stop working. Can you confirm or deny this?

Thanks for the help

Ryan
  • July 30th, 2019

Hi Rechena,

I’ve not seen anything about the nightvision stop working as mine still does work. But there have been slow downs with the feed, but I don’t know if this is my WiFi signal as it works better in certain places of the house, I’m going to test it be connecting a USB ethernet adapter to the camera and run it wired for a bit to test.

I enabled some SWAP space on the card, you can set the ‘swap’ flag to ‘TRUE’ in the ‘run.sh’ file, I changed the swap amount to ‘512’. More info here: https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/blob/230f4d3cf306d7842287e9e5002d806513c4b2b8/firmware_mod/run.sh#L59

Rechena
  • July 31st, 2019

Hi Ryan, first apologies for the double posting.
Second, thank you for taking the time for the reply. Just to clarify, the only space needed is 512MB in total? Including the swap?

Thanks and please do let me know what was the conclusion about the speed. I’m also happy the night vision still works 🙂

Thanks

Ryan
  • July 31st, 2019

Hi Rechena,

No worries. I tested it with an ethernet cable last night and I’m still seeing my RTSP freeze after around 30 seconds, I’ve played around with the video settings (frame rate, video resolution,etc) but that doesn’t seem to work. I’m holding out for an update to Dafang to try help resolve this.

For the SWAP the best way is probably to extend the partition on the card, I am using a 16GB card and resized my cards partition to take the full 16GB with gParted, then enabled a 1GB swap and it boots up without issues. It’s probably better setup the SWAP and re-sizing of partitions once you’ve booted Dafang with the 512MB partition first just so you know it’s working.

Alex
  • July 31st, 2019

Hi Ryan, firstly, thank you for your very useful tutorial. Made getting Dafang on my spare Neos cam very seamless.

I too am struggling with the rtsp feed, not so much that is slows down but more so that previous frames seem to get repeated. Almost like a boomerang effect! Is this what you are seeing too?

Such a shame as I had high hopes for getting rtsp working for this little cam with Dafang after Neos said they would not support it under their software.

Ryan
  • July 31st, 2019

Hi Alex,

Glad it’s helped. I’m not seeing any frames going backwards and forwards. My main issue is the feed freezes and does not recover unless I re-open VLC which I’m using to view it. I look at the timestamp’s seconds in the video feed.

Alex
  • July 31st, 2019

I’ve fiddled with the video settings a bit more and whilst not perfect, it does make the feed (also viewed via VLC) a lot more smoother.
Size: 1280×720
Bitrate: 2000
Format: Smart
Rate: 25 per 1

Ryan
  • July 31st, 2019

Hi Alex, thanks – I’ll try those settings.

Rechena
  • July 31st, 2019

My plan is to use it with either my Synology or the Shinobi software, and also on Home Assistant, so wondering if it will be affected also on the rtsp feed? …

thanks once again

Ryan
  • July 31st, 2019

Rechena: I’m using Shinobi and the connection is getting stopped every 15 to 30 seconds resulting in very small video files – I’ve setup Shinobi to record in 5 minute segments. I have some other Hikvision outdoor cameras and works fine with them.

Rechena
  • August 2nd, 2019

Darn it… well, thats not good 🙁
Well, I still have the cameras in the boxes so I might actually return 🙁

Jeff Hartley
  • August 3rd, 2019

Well, mine gave up the ghost after 1 night. No amount of reflashing the bootloader or loading a new image to SD works any more. I get a blue light when the camera is first plugged in then yellow for 5 seconds then blue for two, quick flash to yellow and then light blue changing to dark blue. Camera can no longer be detected on the network. Shame as it worked really well too that first night. Enjoyed having a go at getting it working as these cameras are amazingly cheap so no tears when it didn’t work out.

Ryan
  • August 4th, 2019

That’s unfortunate, this might help you to unbrick your device, never tried it and it does look complicated https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/blob/master/hacks/unbrick.md

Rechena
  • August 9th, 2019

Hi Ryan, I finally got the cameras and the 16GB cards, I created a 512MB partition and copied the demo.bin file.. But I’m suffering from the same as Ryan, 20 seconds blue then solid Yellow 🙁
Could it be the new firmware not allowing me?

Any hints?

Ryan
  • August 9th, 2019

Hi Rechena,

This is strange, is it a FAT32 partition? I’ve seen FAT32 should work too. The instructions on the Dafang GitHub page also mention to not have any other files other than the demo.bin file – it might be worth checking there are no hidden files.

Rechena
  • August 12th, 2019

Yep, the hidden files we my first suspicious but nope, theres nothing.. what made me curious is the fact that it gets to a weird stage, and then I need to use the original firmware on that github thread to bring the camera back 🙁

Not really sure what to do…

Rechena
  • August 12th, 2019

YAY!! I got it to work 🙂
Adjusted some settings and seems to be working 🙂
The live feed does not stall at all, the only thing I’m finding weird is the image is B&W only 🙁

Ryan
  • August 12th, 2019

Glad it’s working! You might want to try disabling the night mode option within the web interface.

Neal
  • August 12th, 2019

Hi Rechena,
Not sure if you’re still on here now you have it working.
I am just about to tackle this. What settings did you play with to get it working?

JohnRigby
  • August 13th, 2019

Could this then be added to Homebridge if so what plugin would you use ?

Ryan
  • August 13th, 2019

Hi John, not something I use personally, but these docs should help: https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/blob/master/integration/homekit/homekit.md

Rechena
  • August 13th, 2019

Thank for all your help Ryan, and sorry for all the spam comments 😛
I did got one of the two cameras working with rtsp and my Synology, but I had to disable the mqtt and night vision is kinda bad.. but its better than nothing.

Now on the second camera I just can’t pass the load of the boot loader, it just stays there with the blue light on 🙁

Oh well… guess this is what happens when you try to use cheap stuff lol

Again, thanks man

Ryan
  • August 13th, 2019

Hi Rechena, no worries.

I’m lad at least one is working for you. The process your followered should work for the other camera. All I can think is they changed something during the manufacturing process.

Rechena
  • August 13th, 2019

Agree that it should work, what I find weird, is that the first one I think I got it working ‘by accident’ as I saw the solid yellow led after booting on the demo.bin and decided to give a try and copy the firmware to the card….

this second one, I notice that after trying when I go and look at the card the camera already created those timelapses and stuff folders… so wondering if something on the time I keep the button pressed or so… will give another try thats for sure…

Tony
  • August 18th, 2019

Hi Ryan
How do I setup Shinobi ?
I am using hassio with motioneye.
Thanks
Tony

Ryan
  • August 18th, 2019

Hi Tony,

Not sure about MotionEye, as Shinobi itself is similar to motion eye, and is able to provide motion events: https://shinobi.video/articles/2018-10-06-how-to-use-motion-detection

It looks like there is a Hassio add-on https://github.com/hassio-addons/addon-shinobi – never used Hassio myself, so unfortunately I cannot provide much help with setup.

Post a Comment